C_R

3577 Reputation

21 Badges

6 years, 95 days

MaplePrimes Activity


These are replies submitted by C_R

@acer  Highlighted in red in the attachment Why_and_how_arctan_xy.mw is a simplification step that did not work. Is that worth branching off?

@acer 

You provided a solution that I wasn't even looking for, but could prove to be a great asset in more complex problems.

I have summarized my findings for myself for future projects in the attachment and share them here for others dealing with inverse trig functions.

The attachment might also underline why I think getting/forcing arctan(x,y) output is beneficial: It is the extended definition range for the angle. This can help to avoid “jumping” solutions in inverse kinematic problems by reducing the number of angular discontinuities.

Even with arctan(x,y), the need to switch between solutions sometimes can’t be avoided. Yes, a solution that "fits all" is not possible. The question is rather how to derive and identify the correct solution for a given problem in an efficient way. In the example of my question, this means finding for given set of input variables x,y,z  with specific ranges the appropriate equations.

Your solution with the explicit option was not obvious to me. It’s probably not obvious to others. But it can make the whole process of finding the correct equations much more generic.

Thank you again!

Why_and_how_arctan_xy.mw

@Maplesoft: Maybe there are improvements by new or more power full options (or including examples in the documentation (I consulted invtrig,details and arctan as well as the FunctionAdvisor)).  

@Mariusz Iwaniuk 
I am not sure if that explains all. If you simplify

-sin(arcsin(y(t)/(sin(alpha(t))*(l + s(t)))))*(l + s(t))*cos(alpha(t)) - z(t)

to

-sin(arcsin(y(t)/(sin(alpha(t))*(l + s(t)))))*(l + s(t))*cos(alpha(t)) - z(t)

there is still enought information left to find all solutions. Solve this

solve(-y(t)*cos(alpha(t))/sin(alpha(t)) - z(t), [alpha(t)], allsolutions = true)

gives

solve(-y(t)*cos(alpha(t))/sin(alpha(t)) - z(t), [alpha(t)], allsolutions = true)

This includes all branches. Often in a technical context only the frist two branches are of interest (e.g. they describe the angular position of a mechanical link). Arctan(y,z) combines the two solutions and I got this desirable format by coincidence when I used subs inside solve.

I have to post a new question on forcing that output format.

Thank you for the clarifying  links

@Mariusz Iwaniuk 

I was probably not clear. I want

solve(-sin(arcsin(y(t)/(sin(alpha(t))*(l + s(t)))))*(l + s(t))*cos(alpha(t)) - z(t), [alpha(t)])

to produce the output

[[alpha(t) = arctan(-y(t), z(t))], [alpha(t) = arctan(y(t), -z(t))]]

However, your answer indicates that when subs() is used inside solve(), no simplification is applied.

That has the same effect as putting the expression to be solved in single quotes ' ' (delayed excecution).

Does this mean that each time when dealing with an output with arctan I have to test with delayed excecution if Maple can provide an arctan(y,z) version?

 

works well in extended typesetting mode.

Thank you all!

I got a solution to add images by inserting and filling a shape:

https://de.maplesoft.com/support/help/MapleSim/view.aspx?path=tasks/building/annotate/drawing/addShapeWithImage

@nm

Start menus are identical.

Maybe it is the other way around that importing older preferences had a "positive effect" on my W10 installation or for “some reason” you have a persitent entry in the file

C:\Users\%USERNAME%\AppData\Roaming\Maple\2021\Maple.ini

that I do not have.

At a frist glance I could not spot any entry that sounds like engine or server in my file. (I don't know if there are other files where Maple stores user preference data.)

[Options]
Code Editor Zoom=100
Save Options=false
MapleTADocExchange=documentexchange
DataSetsWebSearch=false
SubexpressionPopupsEnabled=true
HelpBGColor=255 255 255
StackLimit=2048
AutoSaveKeepFiles=false
MathDictionaryPopupsEnabled=true
ProxySet=false
CodeEditorMaximizedState=false
Default Zoom=100
SingleUnderscoreSubscript=false
Kernel Mode=2
ProxyAuth=false
Plot Printer DPI=200
MapleLib=
ContextBar=true
HelpNavigator=true
AutoSaveEnabled=true
MDIWin Maximized=false
StatusBar=true
CodeEditorWidth=1297
Home Worksheet=MAPLE_DEFAULT_HOME_PAGE
AutoCompleteEnabled=true
Length of Startup in ms=5712
SyntaxCheckLevel=2
UndoBufferLength=15
Automatic Maple Last Update=738610
SearchBoxCloudGroup=MathApps
HelpLanguages=en
MDIOnOpenAndNew=true
Automatic Maple Update Interval=5
Language=default
Bracket Matching=true
EnterForNewline=true
Window=134 91 730 635
CodeEditorDiagnosticPaneHeight=91
Automatic Maple Updates=true
CodeEditorHeight=737
Remember Plot Options=true
Last Revision Startup=0
Markers=true
MainWin Maximized=false
Space to Dot Operator=true
Default Document Type=0
PlotBGColor=default
Translate Typefaces=true
Use Two Math Fonts Size=18
ToolBar=true
CodeEditorPosX=6
AutoSaveDuration=3
CodeEditorPosY=66
Code Editor Auto Check Syntax=true
Code Editor=true
Kernel Type=1
ContextPanelClosed=false

@nm I can't reproduce this. That's what I get after restart

I have installed Maple with import of 2021 preferences.
Its maybe worth reinstalling Maple and check if preferences have an impact.

@Joe Riel 

Reading your answer, a third option for Modelica outsiders could be: Generating a custom component for the first solution and adding an if statement to the Modelica code for the second solution plus adding a parameter statement for the Boolean. Nevertheless, your first solution is the best and worth mentioning in the custom application help section.


Thanks again!

@Joe Riel 

Allow me two remarks:

- I could not deduce from the parameter description of the cond_i parameter ("relation or boolean combination of inequalities") in the piecewise help page that a simple boolean switch is possible. Good to know and maybe of interest for Maple users.

- The type reference in the parameter section of the custom app only lists physical domains. I wrongly interpreted the reference as a complete list of all possible types.

In the attached I have added to your solution an unsuccessfull attempt of using an if statement. Can this be fixed or is piecewise the only way?

Thank you!

 

CustComp_with_boolean.msimCustComp_with_boolean.msim

@Joe Riel I think you are referring to this detail

I was always wondering what this is good for. Now I know. Frist time for me to use this. When adding a third RBF in my example I could not create the popup.

Thank you

@nm  If you expand the integrand no error is produced but some expressions are returned unevaluated. If reasonable assumptions are added the original error returns. That’s really strange.

Download int_problem_02.mw

If you want to keep the symbols try

_local(D);
interface(imaginaryunit = i);
i*i;
D:=1;

 

Could you solve the integral?

@acer Originally my intention was to show equality with commands instead of disassembling expressions (with op()) and showing equality manually component wise. In failing on that task, I realized that even manual is not straight forward.
That’s why I was asking for advise on the follow-up example -sqrt(r^2-1)/(r-1). Retrospectively, I should have asked much earlier. This simple example is very instructive and shows why Maple sometimes does not simplify. Thank you for taking the time and sharing many techniques that were new to me!!!

@acer  Even my not performing assumption 0<r<1 finally worked in a 1-line statement. As originally intended, I could make it work in an expression where rhs-lhs is not an option. 

Ei(sqrt(r+1)*sqrt(1/(r-1))) = Ei(-sqrt(r^2-1)/(r-1))

Ei((r+1)^(1/2)*(1/(r-1))^(1/2)) = Ei(-(r^2-1)^(1/2)/(r-1))

(1)

`assuming`([is(Ei((r+1)^(1/2)*(1/(r-1))^(1/2)) = Ei(-(r^2-1)^(1/2)/(r-1)))], [r > 0, r < 1])

FAIL

(2)

`assuming`([combine(Ei((r+1)^(1/2)*(1/(r-1))^(1/2)) = Ei(-(r^2-1)^(1/2)/(r-1)))], [r > -1])

Ei(((r+1)/(r-1))^(1/2)) = Ei(-(r^2-1)^(1/2)/(r-1))

(3)

`assuming`([is(Ei(((r+1)/(r-1))^(1/2)) = Ei(-(r^2-1)^(1/2)/(r-1)))], [r > 0, r < 1])

true

(4)

`assuming`([(`@`(is, combine))(Ei((r+1)^(1/2)*(1/(r-1))^(1/2)) = Ei(-(r^2-1)^(1/2)/(r-1)))], [0 < r and r < 1])

true

(5)

NULL

I am unsure what conclusion to draw from the answers. It seems to me that r>0, r<1 works in some instances better. Is it advisable to write assumptions always as a sequence of simple relations and stop using 0<r<1? Is the order in the sequence of importance? And finally, is there a difference between separate commands and nested commands?

If there are no simple answer for these questions I will wait until the next time that I discover a rare species 🦋

Thank you again!

Download Simplify_exp_with_roots_02.mw

First 64 65 66 67 68 69 70 Page 66 of 70