Volume 9, Issue 2
Tricks of the Trade
In and Out
Download This Issue
In and Out
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 (firstname.lastname@example.org) 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.