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 錦囊妙計
30
|
第二章
而另一種定義方式稍嫌冗長,但當 upvalue 的歸屬權模糊不清的情況下,還蠻方便的。
例如:定義四元數與複數的加法時,若使用前述第一種方式定義 upvalue,此時 upvalue
應屬於四元數或複數並未清楚界定,則可使用
TagSet
及
TagSetDelayed
語法明確指定屬
於
四元數
quaternion
的 upvalue,而非複數
Complex
。[Page-029]
upvalue 的語 法 解決 了 兩個 問 題:首 先,你 不 必解 除 保護 Mathematica 的內 建指 令;
其次,設定 upvalue 可以避免 Mathematica 每次執行更改過的內建指令時(如
Plus
或
Times
指令),均優先檢查自訂定義,而導致效能變差的情況。藉由新物件的 upvalue
設定,Mathematica 只 有 在新 物 件出 現 的情 況 下才 須 考慮 其 操作 定 義,當 upvalue 與
downvalue 同時存在的情況下,upvalue 有較高的優先權,但你應盡量避免這種情況。
函數屬性
Mathematica 根據一組事先規範的函數屬性控制函數行為,使用者應熟悉這些屬性,
因 為 自 訂 函 數 要 輸 出 正 確 的 結 果 經 常 需 要 這 些 函 數 屬 性 的 配 合。
Attributes[f]
、
SetAttributes[f,attr]
與
ClearAttributes[f,attr]
指 令 分 別 對 函 數 f 的 屬 性 進 行 查
詢、設定
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