Skip to Content
Mathematica 錦囊妙計
book

Mathematica 錦囊妙計

by Sal Mangano
April 2014
Beginner to intermediate
830 pages
15h 21m
Chinese
GoTop Information, Inc.
Content preview from Mathematica 錦囊妙計
19.4 以 Trace 指令擷取有用的除錯資訊
|
749
輸出仍是相當原始的資料,但相較之下此結果已十分易於閱讀與操作了!
討論說明
一旦將
Trace
輸出線性化之後,擷取部分執行步驟或以模式擷取特定形式的資料便容易
多了! [Page-752]
ch19.indd 749 2014/4/2 下午 05:10:39
750
|
第十九章
以下使用
ReplaceList
指令找出所有
A
函數的呼叫,其中第一個引數為 0,並將其執行
前與執行後的表示式均擷取出來。
更重要地,我們要找出
"bug"
之處,並擷取其前後表示式。
但很明顯地,有些
Trace
所輸出的原始資訊在線性化動作中失去了,這些失去的資訊紀
錄著表示式的巢狀呼叫結構,但就除錯角度而言(或從嘗試了解複雜資料的角度),判
斷錯誤發生的區域才是重點。找到錯誤處之後,接下來就可放置除錯程式碼或
Print
指
令以進一步除錯與修正。
還有另一個與本方式極為相似的方法,使用
Trace
相關指令
TraceScan
並搭配
Reap
與
Sow
,差別在於此方法會輸出更詳細的資訊,包含所有符號與常數的計算。以下使用
Short
指令省略部分輸出。[Page-753]
延伸資訊
Trace
指 令 還 有 本 文 未 提 及 的 更 進 階 用 途, 詳 見 Mathematica 教 學
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.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Mathematica Cookbook

Mathematica Cookbook

Sal Mangano
人工智能技术与大数据

人工智能技术与大数据

Posts & Telecom Press, Anand Deshpande, Manish Kumar

Publisher Resources

ISBN: 9789863470106