SlideShare a Scribd company logo
1 of 5
Download to read offline
圖 4
主題二 : Archimedean π
Let π be the arc length of semicircle with radius 1 (圖 1)
我們的目的是利用 Vpython 來計算π 的值
我們首先證明 , 給任兩個 convex E1 , E2
假設 E1 包住 E2 , 則 E1 的邊長和會大於 E2 的邊長和
給一例子
我們將圖 2 沿著 L1 線切割得到圖 3
我們知道 E1 的邊長和 > E3 的邊長和
我們再將圖 3 沿著 L2 線切割得到圖 4
相同 E1 的邊長和 > E3 的邊長和 > E4 的邊
長和
依此類推 , 我們可得知 E1 的邊長和會大於 E2 的邊長和
圖 1
圖 2
圖 3
由上面的推論就可得知圖 5 的正方形邊
長會大於圓的圓周長也就是 4 > π
我們將圖 6 的三角形分割成圖 7
由角平分限定理可得
k1=k0 / (sqrt(k0*k0+1)+1)
則以 2*k1 為邊長所形成的正八邊形也會把
圓給剛好包住 (圖 8)
就可得到 4=4*k0 > 8*k1 > π
相同我們再將圖 9 得三角形分割成圖 10
由角平分限定理可得
k2=k1 / (sqrt(k1*k1+1)+1)
則以 2*k2 為邊長所形成
的正 16 邊形也會把圓給
剛好包住 (圖 11)
連續以上步驟所形成的以
圖 5
圖 6
圖 7
圖 8
圖 9
圖 10
圖 11
2*kn 為邊長所形成的正 8*n 邊形也會把圓給剛好包住
則 (2*2*…….*2)*kn > π
n+2 個
當 n 很大時 , 所形成的正 8*n 邊形 , 就會非常接近圓 , 則
其邊長和的一半也就會非常接近π
則我們要如何以 Vpython 來寫出程式呢 ?
我們要設計出一個可以讓使用者按一下得
………… …………
首先我們先利用圖 5 中的 a1, 讓 a1 以原點為軸
旋轉負 90 度可得 a1--1, 相同 a1--1 以原點為軸旋
轉負 90 度可得 a1--2, a1--2 以原點為軸旋轉負 90
度可得 a1--3
再來我們利用圖 8 中的 a2, 讓 a2 以原點為軸
旋轉負 45 度可得 a2--1, 相同 a2--1 以原點為
軸旋轉負 45 度可得 a2--2, 依此類推得 a2—3 ,
a2--4 , a2—5 , a2--6 , a2--7
重複上面的動作讓 am 以原點為軸旋轉負(180/(2 的 m 次方))
按一下 按一下 按一下
正八邊形 正 16 邊形
度可得 an--1, 相同an--1以原點為軸旋轉負(180/(2 的m次方))
度可得 an--2 , 想同 an--3, an--4, an--5, an—6………
所以根據上面所得的結果 , 我們現在只要定義一個旋轉函
數 , 就能依上面所說的想法寫出程式了
我們知道 A = 是一旋轉矩陣
亦即讓
得到的 (x2 , y2) 是 (x , y) 以原點(0 , 0) 為
軸旋轉θ角 (圖 12)
但我們現在想做一個讓 (x , y) 可以 以任何
一點 (a , b) 為軸旋轉得到 (x2 , y2 ) 的函數
, 因為我們在下一主題也會用到此函數(圖
13)
所以我們就用 (x , y) 向量減掉 (a , b) 向量 , 得到 (x-a,y-b)
向量 , 再讓 (x-a,y-b) 以原點為軸旋轉θ角得到 (x3 , y3)
圖 12
圖 13
亦即
再讓 (x3 , y3) 向量加上之前減掉的 (a , b) 向量 , 就可得
到我們所要的 (x2 , y2)
所以綜合以上所說的 , 就可以定義出一個旋轉函數 r ,如下
def r( v , u ,θ) :
v=vector(v)
u=vector(u)
w=v-u
w=vector(w.x*cos(θ)-w.y*sin(θ),w.x*sin(θ)+w.y*cos(θ))
w=w+u
return (w.x,w.y)
v : 所要旋轉的那一點
u : v 這一點所要旋轉的軸心
θ :所要旋轉的角度
則我們就可以依上面所說的完成程式了

More Related Content

Featured

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Featured (20)

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 

Pi

  • 1. 圖 4 主題二 : Archimedean π Let π be the arc length of semicircle with radius 1 (圖 1) 我們的目的是利用 Vpython 來計算π 的值 我們首先證明 , 給任兩個 convex E1 , E2 假設 E1 包住 E2 , 則 E1 的邊長和會大於 E2 的邊長和 給一例子 我們將圖 2 沿著 L1 線切割得到圖 3 我們知道 E1 的邊長和 > E3 的邊長和 我們再將圖 3 沿著 L2 線切割得到圖 4 相同 E1 的邊長和 > E3 的邊長和 > E4 的邊 長和 依此類推 , 我們可得知 E1 的邊長和會大於 E2 的邊長和 圖 1 圖 2 圖 3
  • 2. 由上面的推論就可得知圖 5 的正方形邊 長會大於圓的圓周長也就是 4 > π 我們將圖 6 的三角形分割成圖 7 由角平分限定理可得 k1=k0 / (sqrt(k0*k0+1)+1) 則以 2*k1 為邊長所形成的正八邊形也會把 圓給剛好包住 (圖 8) 就可得到 4=4*k0 > 8*k1 > π 相同我們再將圖 9 得三角形分割成圖 10 由角平分限定理可得 k2=k1 / (sqrt(k1*k1+1)+1) 則以 2*k2 為邊長所形成 的正 16 邊形也會把圓給 剛好包住 (圖 11) 連續以上步驟所形成的以 圖 5 圖 6 圖 7 圖 8 圖 9 圖 10 圖 11
  • 3. 2*kn 為邊長所形成的正 8*n 邊形也會把圓給剛好包住 則 (2*2*…….*2)*kn > π n+2 個 當 n 很大時 , 所形成的正 8*n 邊形 , 就會非常接近圓 , 則 其邊長和的一半也就會非常接近π 則我們要如何以 Vpython 來寫出程式呢 ? 我們要設計出一個可以讓使用者按一下得 ………… ………… 首先我們先利用圖 5 中的 a1, 讓 a1 以原點為軸 旋轉負 90 度可得 a1--1, 相同 a1--1 以原點為軸旋 轉負 90 度可得 a1--2, a1--2 以原點為軸旋轉負 90 度可得 a1--3 再來我們利用圖 8 中的 a2, 讓 a2 以原點為軸 旋轉負 45 度可得 a2--1, 相同 a2--1 以原點為 軸旋轉負 45 度可得 a2--2, 依此類推得 a2—3 , a2--4 , a2—5 , a2--6 , a2--7 重複上面的動作讓 am 以原點為軸旋轉負(180/(2 的 m 次方)) 按一下 按一下 按一下 正八邊形 正 16 邊形
  • 4. 度可得 an--1, 相同an--1以原點為軸旋轉負(180/(2 的m次方)) 度可得 an--2 , 想同 an--3, an--4, an--5, an—6……… 所以根據上面所得的結果 , 我們現在只要定義一個旋轉函 數 , 就能依上面所說的想法寫出程式了 我們知道 A = 是一旋轉矩陣 亦即讓 得到的 (x2 , y2) 是 (x , y) 以原點(0 , 0) 為 軸旋轉θ角 (圖 12) 但我們現在想做一個讓 (x , y) 可以 以任何 一點 (a , b) 為軸旋轉得到 (x2 , y2 ) 的函數 , 因為我們在下一主題也會用到此函數(圖 13) 所以我們就用 (x , y) 向量減掉 (a , b) 向量 , 得到 (x-a,y-b) 向量 , 再讓 (x-a,y-b) 以原點為軸旋轉θ角得到 (x3 , y3) 圖 12 圖 13
  • 5. 亦即 再讓 (x3 , y3) 向量加上之前減掉的 (a , b) 向量 , 就可得 到我們所要的 (x2 , y2) 所以綜合以上所說的 , 就可以定義出一個旋轉函數 r ,如下 def r( v , u ,θ) : v=vector(v) u=vector(u) w=v-u w=vector(w.x*cos(θ)-w.y*sin(θ),w.x*sin(θ)+w.y*cos(θ)) w=w+u return (w.x,w.y) v : 所要旋轉的那一點 u : v 這一點所要旋轉的軸心 θ :所要旋轉的角度 則我們就可以依上面所說的完成程式了