Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Question on how to count the number of iterations ...

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

03-19-2018
08:16 AM

03-19-2018
08:16 AM

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.

Labels:

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

03-19-2018
09:45 AM

03-19-2018
09:45 AM

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.

9 REPLIES 9

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

03-19-2018
08:52 AM

03-19-2018
08:52 AM

Re: Question on how to count the number of iterations for an Mathcad equation

Simply return a vector with both value of interest:

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

03-19-2018
09:13 AM

03-19-2018
09:13 AM

Re: Question on how to count the number of iterations for an Mathcad equation

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

03-19-2018
09:28 AM

03-19-2018
09:28 AM

Re: Question on how to count the number of iterations for an Mathcad equation

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

03-19-2018
09:45 AM

03-19-2018
09:45 AM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

03-19-2018
10:07 AM

03-19-2018
10:07 AM

Re: Question on how to count the number of iterations for an Mathcad equation

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

03-19-2018
10:49 AM

03-19-2018
10:49 AM

Re: Question on how to count the number of iterations for an Mathcad equation

@tubar wrote:

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:

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

03-19-2018
10:56 AM

03-19-2018
10:56 AM

Re: Question on how to count the number of iterations for an Mathcad equation

Yes, indeed... Too many zeroes.

Now I will extend the algorithms for Chords, Secant and Newton-Raphson methods.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

03-19-2018
04:01 PM

03-19-2018
04:01 PM

Re: Question on how to count the number of iterations for an Mathcad equation

In Mathcad 15 with the trace function:

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

03-19-2018
04:07 PM

03-19-2018
04:07 PM

Re: Question on how to count the number of iterations for an Mathcad equation

Thank you. Indeed, the debugging functions are available in Mathcad 15 but Mathcad Prime missed this functionality.