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 錦囊妙計
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.

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

Publisher Resources

ISBN: 9789863470106