【python代码】math与turtle库之蝴蝶曲线的运用

几个turtle库基本函数:
1:turtle.pensize(x) :X大小控制画笔大小
2:turtle.pencolor(“color”):画笔颜色控制,color为想要输入的颜色名称

引入turtle库跟math库:
from turtle import*
from math import*
几个math函数:
exp(x):表示为e的x次方
pow(x,y):表示为x的y次方

[python] math与turtle库之蝴蝶曲线代码:
**from turtle import * from math import * pensize(3) pencolor("red") #画笔颜色 def draw(a,end): t=0 while t<24*end: x=a*sin(t)*(exp(cos(t))-2*cos(4*t)+pow(sin(t/12),5)) y=a*cos(t)*(exp(cos(t))-2*cos(4*t)+pow(sin(t/12),5)) goto(x,y) t=t+0.05 if __name__ == '__main__': draw(60,pi)**
[python] math与turtle库之蝴蝶曲线
[python] math与turtle库之蝴蝶曲线

相关文章:

  • 2021-05-25
  • 2021-09-18
  • 2021-10-01
  • 2022-12-23
  • 2021-09-21
  • 2021-09-02
  • 2021-05-28
  • 2022-12-23
猜你喜欢
  • 2022-01-05
  • 2021-05-03
  • 2022-12-23
  • 2022-02-17
  • 2021-09-10
  • 2022-02-08
  • 2022-01-05
相关资源
相似解决方案