The Mathematica Journal
Volume 9, Issue 2

Search

In This Issue
Articles
Tricks of the Trade
In and Out
Trott's Corner
New Products
New Publications
Calendar
News Bulletins
New Resources
Classifieds

Download This Issue 

About the Journal
Editorial Policy
Staff
Submissions
Subscriptions
Advertising
Back Issues
Contact Information

In and Out
Edited by Paul Abbott

StepMonitor

Q: I am running a complex FindMinimum calculation that takes a long time to run. If I abort the computation, is there a way to output the last fully solved iteration that FindMinimum has found?

A: Robert Knapp (rknapp@wolfram.com) answers: In Version 5, you can use the StepMonitor option to keep track of the iterations.

Here is a simple function that uses Pause to simulate running a complex computation.

StylePrint is used to provide intermediate results as Output style cells.

To get a result when you abort the computation, you need to use CheckAbort.

If the problem runs to completion, you will get the result from FindMinimum, If you abort the computation, you will obtain the last step taken in the iteration.

When FindMinimum gets close to a solution, differences between iterations do not show up in Output style cells. One can output results with more digits by changing the PrintPrecision display option as follows:

1. Open the Option Inspector by clicking Format Option Inspector. Set the scope to notebook (or global).

2. Locate PrintPrecision by typing "printp" in the Lookup text field.

3. Set PrintPrecision to the number of digits you want displayed.



     
About Mathematica | Download Mathematica Player
Copyright © Wolfram Media, Inc. All rights reserved.