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 錦囊妙計
2.13 善用複合(Composition)函數與反函數
|
65
InverseFunction
指令於複合函數時,它將輸出成分函數反函數所組成的複合指令,
反函數的順序是反序的。依前文所提供的範例,你可以得到下列複合函數:
不幸的是,數學函數經常是不可逆的,因此上述方法並非總是可行的。然而很棒的一點
是,即使函數並非數學函數或可逆函數,只要你直接定義其反函數,這個方法就行得
通了。
以下範例可看出儘管
RotateRight
的反函數是
RotateLeft
指令,但 Mathematica 卻完全
不知。[Page-065]
不過你可以藉由 upvalue 定義它的反函數(參見第 28 頁的「DownValue UpValue」一
文)。
UpValue 定義 rotate Right 的反函數
很明顯地
reverse 的反函數就是它自己
接下來,不管你怎麼複合上列函數,都可輕鬆地建立其反函數。你不覺得這相當具說服
力嗎?
這個簡單的例子也暗示我們,經由提供函數與反函數的定義,對這組函數的任意組合操
作,都可輕易復原。你甚至可以使用
Drop
指令,僅回復上一步動作。
去除反函數組合中的第一個函數
ch02.indd 65 2014/4/2 上午 03:32:36
66
|
第二章
在訣竅 2.7 中,曾提及 ...
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