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 錦囊妙計
80
|
第二章
預設以第一個元素作為基準值,並以
Less
指令進行比較。[Page-080]
習慣上最後一個引數用來設定選項。
在選項決定之後,
qsort2
指令用來進行大部分的工作,
partition
的用法來自於訣竅 2.10。
在 Mathematica 6 以 前 的 版 本 中, 並 未 提 供
OptionValue[]
指 令, 語 法 上 可 使 用
ReplaceAll
(
/.
)方式優先使用使用者的自訂選項,未設定的選項再替換為選項預設
值,在較早期的程式碼中經常見類似的用法。
使用預設行為及自訂選項測試此函數。[Page-081]
ch02.indd 80 2014/4/2 上午 03:32:52
2.17 建立可接受選項之函數
|
81
以下基準值的挑選及比較函數都使用自訂函數
對已排序的串列而言,
設定第一個元素為基準值會導致較差的效能,
因此隨機選擇基準值或許是較保險的用法
討論說明
當你的函數有許多不同選項時(Mathematica 的
Graphics
指令是一個不錯的範例),或
當預設選項足夠應付大部分使用者時,選項是比預設引數(見訣竅 2.16)更好的選擇,
而且選項可讓函數介面不至於包含太多低階細節而顯得過於凌亂。
有 時 候 並 不 是 你 自 己 的 函 數 要 使 用 選 項, 而
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