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

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