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 錦囊妙計
168
|
第四章
若不使用
Verbatim
指令,第一個範例將輸出錯誤的結果。
若不使用
Verbatim
指令,第二個範例也會失敗,因為模式並非有效的模式名稱。
Verbatim[expr]
的意思是,按照
expr
的字面進行匹配。你通常不會使用到
Verbatim
令,除非正在撰寫一個 Mathematica 程式用來轉換 Mathematica 的程式碼,或是你的程
式需讀取或重寫包含模式的 Mathematica 程式碼。[Page-170]
延伸資訊
Roman Maeder 所著的《
The Mathematica Programmer II
》(Academic Press 出版),
書中以
Verbatim
指令設計類 Prolog 程式語言的翻譯器。
4.10 規則式最佳化
問題點
你擁有大量的常用規則式,並希望能加速其執行速度。
解決方案
使用
Dispatch
指令建立分派表(dispatch table)以取代規則式。
ch04.indd 168 2014/4/2 上午 05:39:14
4.11 以模式作為資料檢索語言
|
169
討論說明
[Page-171]
如果你需要進行多重規則式轉換,將所有規則式儲存於單一變數是很方便,只需維護一
個模式變數可使得程式碼較簡單。不過,後果是當模式數量變多時效率
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