Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
Hi,
I have an expression like:
tan (alpha) - alpha = 0.48
where 'alpha' is angle in radians, and want to calculate the Value of Alpha.
How to solve this using Mathcad?
Pl Help!
Regards,
Shashank
Hi ssharma,
You have to be aware that your task has an infinite number of soltions:You may use the symbolics but you will always get the very same solution even if you use something like the "assume" command to limit alpha to a certain range. An old bug in the symbolics.
So you will have to resort to numerical methods and you have the choice amongst two.
The "root" command usually works pretty well and there are two ways of using it - provinding an interval or providing a guess value. Usually different guesses would give you different solutions, but in case of your equation we get the very same result most of the times - crazy.The other numeric method is using a solve block with "Find". Here again you have to provide a guess value which seems to have more impact on the outcome this time
Has anybody an explanation for the different solutions Valery and I get with the guesses 3 and -5?
I am using Prime 3.0 and TOL is by default 10^-3.
Valery sure used a newer version at which setting of TOL?
@WernerExinger wrote:
Has anybody an explanation for the different solutions Valery and I get with the guesses 3 and -5?
I am using Prime 3.0 and TOL is by default 10^-3.
Valery sure used a newer version at which setting of TOL?
By me Prime 4 and TOL=0.001
@ValeryOchkov wrote:
By me Prime 4 and TOL=0.001
impressive!
you and me are using MP4 with TOL=0.001 and got different results.
Ah! the one MP4 is russian and mine is the german edition...
Sorry - I have used Prime 3.1
And second!
Without the vectorization - no ansver
With the vectorization - crash! Check please
My Solutions are:
MP4
and with MC15 the same solution:
EDIT: MP4 with TOL=10^-7 and MC15 with TOL=0.001
MP4 with TOL=0.001 i got the same results.
@WernerExinger wrote:
Has anybody an explanation for the different solutions
I have no idea why the root function behaves so differently with different guess values.
But in mathcad 11, there is a way to show the steps that the root function takes. ( I guess it won't work in Mathcad 15, but please try).
Here's the function, and a couple of examples of its usage with the function: tan(x)-x-0.48:
In most cases root finds the positive value closest to zero, unless the guess valua is close to another solution.
This is also illustrated by a scan of guess values:
Note that the trace is absent at times, that's when a complex root was found.
Oh, and my TOL=10^-7.
Luc
You are right. RootPath does not work in MC15. The return vector would only contain the last guess (aka the solution).
Only ways I can think of to get the interim guess values of the algorithm is either to throw in a trace-command in the function and turn on debug mode. or throw in a READPRN command which appends the current argument to a data file.
Both ways would slow down calculations significantly.
I get the following in MC15:
I can't explain the difference between the implicit and explicit vectorisations!
TOL is the default 10^-3; however, setting it much tighter didn't alter anything.
Alan
Interesting effects we experience here.
Here is a nother one (done in MC15). I always thought that "root" would use the same LM algorithm as "Find" in the solve block (not in Prime as here we have the Knitro algorithms). Obviously root works in a different way, not sure how. Most of the times we get 0,966. Only with some selected guess values we get a different result.
The algorithm in the solve block for "Find" was set to "Levenberg-Marquardt" (default). "Conjugate Gradient" and "Quasi Newton" give the very same result with exception of guess value 0 - here "Conjugate Gradient" returns 0,966 and no errror.