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
- :
- Is there any way to determine how many 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

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

10-15-2014
02:40 PM

10-15-2014
02:40 PM

I am trying to check if my Minerr solution to a nonlinear-regression, Levenberg-Marquardt curvefit of a circle to data points worked correctly. I did not get an error message, so I think the iterations converged. But I cannot check simply by the error at each data point, because, obviously, it is a minimization problem, so one expects to get error at each data point - it is a best curvefit problem. I set the TOL and CTOL convergence-error values to 1e-010, and I still got no error message. So I think it converged, but I want to make sure. If I could confirm that a non-trivial number of iterations was performed, then I could be somewhat reassured. But if it stopped after, say, 2 iterations, then I would guess that something got misinterpreted by Mathcad, perhaps in the required vectorization.

Labels:

9 REPLIES

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

10-15-2014
03:53 PM

10-15-2014
03:53 PM

You may be able to use the trace feature. See here for an example.

http://communities.ptc.com/message/164648#164648

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

10-15-2014
03:55 PM

10-15-2014
03:55 PM

Please provide a worksheet if you require further help.

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

10-15-2014
03:57 PM

10-15-2014
03:57 PM

You may have a look at the built in variable ERR to get a measurement about the quality of the fit. Or you calculate your own sum of squared errors (SSE).

Wouldn't a plot of the raw data and the fitted function give you a quick idea of if the iteration succeeded?

There are two ways I can think of to get information how many iterations Mathcad's built-in numeric iteration algorithms have done.

Both would require that you turn one of the expressions used into a function which is defined before the solve block. The function would return the usual result but before it does so it would...

1) [does not work in Prime] ... call trace("xxx"). If you toggle degug you can then see how many times the line xxx is shown in the debug window. With some more work you may even be able to implement a counter so you don't have to count yourself.

2) ... use any of Mathcads WRITE commands (e.g. WRITEPRN resp. ADDPRN) to write a line to a file on disk. This slows down execution considerably. You may also implement a counter - read in the content of the file, incerement and write.

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

10-15-2014
04:59 PM

10-15-2014
04:59 PM

Thanks. I will try this. I didn't know that one could make a compose program after a boolean equals. I'll let you know how it came out.

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

10-15-2014
05:03 PM

10-15-2014
05:03 PM

I just finished the ERR calculation, and confirmed that ERR was returning the square-root of the sum of the residuals (radial deviations from the circle) at each data point. I think the circle curvefit is working. I just want to be sure that Mathcad is actually doing what I intended it to do. I don't know why the forum searcher didn't return the above thread when I searched on: "maximum iterations".

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

10-15-2014
05:06 PM

10-15-2014
05:06 PM

Dave Rosenbaum wrote:

Yes it's not a very well documented feature.

Yes, please let us know how you get on.

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

10-15-2014
05:08 PM

10-15-2014
05:08 PM

Dave Rosenbaum wrote:

I don't know why the forum searcher didn't return the above thread when I searched on: "maximum iterations".

Don't worry, I only managed to find it because I contributed in the thread I directed you to.

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

10-15-2014
07:46 PM

10-15-2014
07:46 PM

Mike Armstrong wrote:

You may be able to use the trace feature. See here for an example.

... with animation http://communities.ptc.com/videos/1460

or http://communities.ptc.com/videos/1472

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

10-16-2014
02:31 AM

10-16-2014
02:31 AM

Valery Ochkov wrote:

Mike Armstrong wrote:

You may be able to use the trace feature. See here for an example.

... with animation http://communities.ptc.com/videos/1460

Very clever Valery, I do recall seeing this before.

Top Tags