生活随笔
收集整理的這篇文章主要介紹了
笛卡尔心形曲线
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
笛卡爾的愛情故事相比大家都已經非常熟悉了,在傳遞給公主的第十八封信里面隱藏著這個函數
(x2+y2)3=x2y3(x^2+y^2)^3 = x^2y^3 (x2+y2)3=x2y3
利用python就可以將這個函數給畫出來,當然首先得解出這個函數。
import matplotlib
.pyplot
as plt
import numpy
as np
plt
.style
.use
('dark_background')
fig
, ax
= plt
.subplots
(figsize
=(5,5))
ax
.spines
['right'].set_color
('none')
ax
.spines
['top'].set_color
('none')
ax
.spines
['bottom'].set_color
('white')
ax
.spines
['left'].set_color
('white')ax
.xaxis
.set_ticks_position
('bottom')
ax
.spines
['bottom'].set_position
(('data',0))
ax
.yaxis
.set_ticks_position
('left')
ax
.spines
['left'].set_position
(('data',0))ax
.set_yticks
([-1.0,-0.5,0.5,1.0,1.5])
ax
.set_xticks
([-1.0,-0.5,0.5,1.0])plt
.title
('Cardioid', fontsize
=24)
x
= np
.linspace
(-1,1,200)
y1
= np
.sqrt
(1-np
.power
(x
, 2)) + np
.power
(np
.square
(x
), 0.33)
y2
= -np
.sqrt
(1-np
.power
(x
, 2)) + np
.power
(np
.square
(x
), 0.33)
plt
.plot
(x
, y1
, color
='#FFC0CB')
plt
.plot
(x
, y2
, color
='#FFC0CB')
plt
.show
()
具體的圖像就是下面這幅了。
總結
以上是生活随笔為你收集整理的笛卡尔心形曲线的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。