MathCAD While Loop
MathCAD While Loop
(OP)
I'm trying to get a very simple example started used the Kepler Equation, E = M + e sin E, which is an iterative solution set given M and e as constants.
So I guess E and compute the right hand side, thus generating E' on the left. This would then feed into E on the right and I would recompute E'. Usually I have a set point for loop exit as the difference between E' and E as a neglegibly small number, 0.00001.
I can't understand the syntax to MathCAD14. Any ideas?
So I guess E and compute the right hand side, thus generating E' on the left. This would then feed into E on the right and I would recompute E'. Usually I have a set point for loop exit as the difference between E' and E as a neglegibly small number, 0.00001.
I can't understand the syntax to MathCAD14. Any ideas?
Kenneth J Hueston, PEng
Principal
Sturni-Hueston Engineering Inc
Edmonton, Alberta Canada





RE: MathCAD While Loop
M:21
e:4
E:21 "That's a guess
root( M+e*sin(E)-E,E)=
gives you the normal way of solving it. I'll leave the users of the new improved Mathcad (sarcasm intended) to answer your loops question.
Cheers
Greg Locock
New here? Try reading these, they might help FAQ731-376: Eng-Tips.com Forum Policies http://eng-tips.com/market.cfm?
RE: MathCAD While Loop
e := something
E := your guess value
Given
E <CTRL>= M + e*sin(E)
Find(E)=
Unless you're purposely wanting to solve it manually, in which case you'll need to create program loop.
But it's generally more complicated than your sketchup in your OP, since you essentially need to implement Newton's method, and iterate to find a point on the opposite side of the actual solution, and then iterate down to the solution within the tolerance. The selection and variation of step size as you hunt around the solution and close in is relatively non-trivial.
TTFN
FAQ731-376: Eng-Tips.com Forum Policies
RE: MathCAD While Loop
TTFN
FAQ731-376: Eng-Tips.com Forum Policies
RE: MathCAD While Loop
IRStuff, is there any advantage in using a Solve block instead of root in this case?
Cheers
Greg Locock
New here? Try reading these, they might help FAQ731-376: Eng-Tips.com Forum Policies http://eng-tips.com/market.cfm?
RE: MathCAD While Loop
Ken,
As always, you should plot the function so that you can get a visual on where the solutions should be expected. In Greg's example there are 3 possible solutions, requiring 3 different guess values to find the exact values. Now, that's something you could possibly place into a FOR loop, iterating through different guess values of E to find unique solutions.
TTFN
FAQ731-376: Eng-Tips.com Forum Policies