Skip to Main Content
Mathematica 錦囊妙計
book

Mathematica 錦囊妙計

by Sal Mangano
April 2014
Beginner to intermediate content levelBeginner to intermediate
830 pages
15h 21m
Chinese
GoTop Information, Inc.
Content preview from Mathematica 錦囊妙計
754
|
第十九章
19.6  使用 EvaluationMonitor StepMonitor
項對內建指令進行除錯
問題點
使 Mathematica 法,
FindRoot
NDSolve
NIntegrate
等,但這些有如黑箱作業的指令經常輸出奇怪的運算結果,你想深入了解究
竟內部運作出了什麼問題。
解決方案
FindRoot
令( 題,
圈, 點, 便 息。 使
Quiet
指令禁止錯誤訊息的產生,我刻意設計一個問題方程式。
FindRoot
指令提供了
EvaluationMonito
r 選項, 用來取出每次呼叫函 數進行迭代的資訊,以下使
Reap
Sow
指令擷取迭代過程以作除錯分析。注意使用
EvaluationMonitor
選項時,必須使用
RuleDelayed
:>
)方式設定而不能用
Rule
->
)。
討論說明
有時
StepMonitor
選項對除錯也很有幫助,相較於
EvaluationMonitor
選項在每次呼叫
函數時均執行,
StepMonitor
選項只在往解答方向迭代時才執行,Stephen Wolfram 將它
們之間的差異解釋得最好:
ch19.indd 754 2014/4/2 下午 05:10:42
19
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Ubuntu for Non-Geeks, 4th Edition

Ubuntu for Non-Geeks, 4th Edition

Rickford Grant, Phil Bull

Publisher Resources

ISBN: 9789863470106