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 錦囊妙計
40
|
第二章
接下來,我將應用這個技巧兩次,表列出前 12 個正多邊形,並且於圖形中央印出其邊
數與內角值。[Page-039]
首先是使用
Table
指令產生角度的陣列,這是程式碼最深層的部分,它包含
n
個圓周上
平均分布的圓周角,其中
n
3 依序增加至 14。以下以表格方式列出
angles
的內容。
如前文所述,一旦我們已有此串列,直接使用
Map
指令運算是較好的方法。
ch02.indd 40 2014/4/2 上午 03:32:04
2.4 於單次運算中映射數個函數
|
41
Polygon
繪圖物件需使用座標串列,因此需使用
Sin
Cos
映射至
angle
的第二層,將
圓周角轉換為座標。為節省空間,以下僅列出前三個結果。[Page-040]
接著使用相同技巧,同時建立多邊形與字串的插入;
Partition
GraphicsGrid
只用來
排列圖形。
延伸資訊
訣竅 2.5 中討論
MapIndexed
映射指令,這是
Map
指令的變形,它會將元素於串列中的位
置索引值(index)作為函數的第 2 個引數。
ch02.indd 41 2014/4/2 上午 03:32:05
42
|
第二章
2.5 於映射指令中加入元素索引值(Index
問題點
Map
指令相同地,你想將函數映射至串列中,但此函數除了元素值之外
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