首页 > 编程知识 正文

笛卡尔心形线公式表白图片,笛卡尔心形线python代码

时间:2023-05-05 17:28:45 阅读:20543 作者:2394

本文概述了安装方程的参数方程极坐标方程源代码扩展仓库的其他参考实例

个人资料

在python的matplotlib库中绘制一个心形。

演示心-直角坐标心-极坐标系http://www.Sina.com/http://www.Sina.com/pipinstallmatplotlib方程参数方程{x((=a )1cos) sIny ) begin{matrix}x ) ) theta ) ) a ) left )1-costhetaright ) sinthetathetaend { matrix }right.{ x

极坐标方程r=a(1sIn) r=a(1-sin(theta ) r=a(1sIn) ) ) ) ) ) ) ) )

源代码根据参数方程绘制心形。 importmatplotlib.pyplotaspltimportnumpyasnpdefcardioid _ parametric (a ) : theta=NP.linspace (0,2 * NP.pi ), 1000 ) x=a*(1-NP.cos(Theta ) ) NP.sin ) Theta ) y=a* (1- NP.cos ) Theta ) PLT.ploot ) heart.png ) ) plt.show ) if _ _ name _=(_ _ ) ) ) ) importmatplotlib.pyplotaspltimportnumpyasnpdeflib 1000 ) r=a*(1-NP.sin ) theta ) ) graph=PLT.subplot(111,polar=True ) graph.plot ) theta,r, color='red ' ) PLT.savefig('./img/heart-polar.png ) ) plt.show ) ) if__name__=='_main__ () ) ) 65 importmatplotlib.pypll 1000 ) x=NP.sinspace 2/3) PLT.plot(x,y,color='r ' ) PLT.plot(-x,y, c='r ' ) PLT.axis(off ) PLT.savefig ) (/img/heart-flat.png ) (PLT.savefig )./img/热平面() ) ) ) ) ) ) ) 65 importnumpyasnpimportmatplotlib.pyplotaspltfrommatplotlibimportanimationfigure=PLT.PLT=PLT.axes ) line1 0.45 ).plot ()、)、c='r ' ) line2、=PLT.axes (xlim=(-1.5,1.5 )、ylim=(-2.2,0.45 ) line2def更新(I,a ) a]:theta=NP.linspace[0,i/np.pi, 100 ) x=a*(1-NP.cos(theta ) ) NP.sin (theta ) y=a* )1-NP.cos ) theta ) ) NP.cos ) theta ) line1. seecta line2defcardioid _ animate (a ) : ani=animation.func anion blit=true(PLT.Axis(off ) ani.save ) )/img/heart.gif (PLT.show ) if _ _ name _=(_ MIF ) ) ) 笛卡尔落魄,贫穷,也不愿向别人讨钱,每天只是拿破笔破纸研究数学题。 有一天,克里斯汀的马车穿过街道发现笛卡尔在研究数学。 公主下了车问道。 最后笛卡尔发现公主有数学天赋。 告别几天后,笛卡尔接到通知,请求国王成为克里斯汀公主的wxdcdq。 在随后的几年里,相差34岁的笛卡尔和克里斯汀相爱,国王发现笛卡尔后死亡。 最后,笛卡尔写给克里斯汀的情书中,出现了R=A(1-sin)的数学坐标方程,求解后会变成心形图案。 是有名的“心形线”。 这封情书最后收录在欧洲笛卡尔博物馆。

仓库https://github.com/xavierjiezou/python-cardio id-matplotlib

其他

请参见3https://en.Wikipedia.org/wiki/cardio id

3359 matplotlib.org/3.2.1/API/_ as _ gen/matplotlib.animation.func animation.html

3359砖局域网. zhi Hu.com/p/32380300

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。