Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
What command or operation i have to do in order to find the number of iterations performed for solving an Mathcad equation like f(x):=e^x-x that has in the final the solution 0.5671?
I need to find the number of iterations in order to evaluate the efficiency of the solving method.
I searched a lot for this aspect and I'm surprised that nobody had this question until now.
Solved! Go to Solution.
Thank you again. Now, the problem is solved for me.
In Mathcad Prime the Debugging function was not possible like for Mathcad 15 View> Toolbars> Debug resulting Trace Window.
In fact the best version of Mathcad remains for me Mathcad 13 where the displayed equations weren't limited at the length. Today, especially in Symbolic Tool , when results a very long equation it will not be displayed unfortunately. However, it is another subject.
I attached the updated files from your suggestions. Maybe will benefit others in the future.
Simply return a vector with both value of interest:
Thank you very much! It worked for both versions, Mathcad 15 and Mathcad Prime too.
Also, a history of the iterations it is possible to be presented? For example, in Mathcad 15 exists a function Trace(x) that permits the view of the succesive values of the root x in a Trace Window.
However, in Mathcad Prime I cannot find the history of values of x in a Trace Window. I dont know why.
Prime is clearly inferior to Mathcad in many ways and is missing a lot of functionality compared to Mathcad.
The trace function simply is not implemented in Prime.
To return the history you'd like to see you could store all x-values in a vector and return that vector instead of the last calculated value.
Thank you again. Now, the problem is solved for me.
In Mathcad Prime the Debugging function was not possible like for Mathcad 15 View> Toolbars> Debug resulting Trace Window.
In fact the best version of Mathcad remains for me Mathcad 13 where the displayed equations weren't limited at the length. Today, especially in Symbolic Tool , when results a very long equation it will not be displayed unfortunately. However, it is another subject.
I attached the updated files from your suggestions. Maybe will benefit others in the future.
I found a strange difference between Mathcad 15 and Prime: Mathcad 15 solved the equation with 13 iterations while Mathcad Prime solved the equation with 19 iterations.
@tubar wrote:
I found a strange difference between Mathcad 15 and Prime: Mathcad 15 solved the equation with 13 iterations while Mathcad Prime solved the equation with 19 iterations.
Nothing strange - you get the same number of iterations if you use the same tolerance value for "tol".
You have different values in your two sheets.
BTW, as you now return the vector of x-values you can get rid of returning the value of i - you can determine the number of iterations by counting the number of values in the result vector:
Yes, indeed... Too many zeroes.
Now I will extend the algorithms for Chords, Secant and Newton-Raphson methods.
In Mathcad 15 with the trace function:
Thank you. Indeed, the debugging functions are available in Mathcad 15 but Mathcad Prime missed this functionality.