博客
关于我
[python] math与turtle库之蝴蝶曲线
阅读量:365 次
发布时间:2019-03-04

本文共 533 字,大约阅读时间需要 1 分钟。

【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)**
代码
效果图

转载地址:http://diyg.baihongyu.com/

你可能感兴趣的文章
mysql定时任务事件清理单表数据
查看>>
MySQL定时器Events
查看>>
Mysql定时备份脚本
查看>>
mysql实战01|基础架构:一条SQL查询语句是如何执行的?
查看>>
Mysql实战之数据备份
查看>>
MySQL实战教程:从小白到大神的进阶之路!
查看>>
mysql实现成绩排名
查看>>
Mysql客户端中文乱码问题解决
查看>>
mysql客户端工具使用
查看>>
MySQL密码忘记,怎么办?
查看>>
mysql对同一张表进行查询和赋值更新
查看>>
mysql导入数据库出现:Incorrect string value: '\xE7\x82\xB9\xE9\x92\x9F' for column 'chinese' at row 1...
查看>>
mysql导入(ibd文件)
查看>>
Mysql工作笔记006---Mysql服务器磁盘爆满了_java.sql.SQLException: Error writing file ‘tmp/MYfXO41p‘
查看>>
MySQL工具1:mysqladmin
查看>>
mysql常用命令
查看>>
MySQL常用命令
查看>>
mysql常用命令
查看>>
Warning: mkdir(): No such file or directory in D:\phpstudy_pro\WWW\**** linux mkdir
查看>>
MySQL常用指令集
查看>>