- 博客(5)
- 收藏
- 关注
原创 processing画正弦波-列表应用
r1=100 #大圆半径r2=10 #小圆半径t=0 #时间变量circleList=[]def setup(): size(600,600)def draw(): global t,circleList background(200) translate(width/4,height/2) noFill()#不给大圆着色 stroke(0)#黑色轮廓 ellipse(0,0,2*r1,2*r1) #转圈的小圆 .
2022-02-20 00:32:42
456
原创 processing画正多边形
#用循环画一个正多边形def setup(): size(1000,1000)def draw(): pushMatrix() polygon(45,20)#多边形,边数,边长,可改参数 popMatrix() polygon1(45,100)#多边形,边数,到原点的距离,可改参数def polygon(sides,sl): translate(width/3,height/3) step1=radians(360/2/sides) s.
2022-02-19 00:14:20
3377
原创 processing画坐标系,画函数图像
xmin=-10xmax=10ymin=-10ymax=10rangex = xmax-xminrangey = ymax-ymindef setup(): global xscl, yscl ##全局变量 size(600,600) xscl=width/rangex#比例尺 yscl=-height/rangey#比例尺“-是用来改变Y轴方向的”def draw(): global xscl,yscl background(255) .
2022-02-16 14:00:27
1610
原创 求因数,公因数,最大公因数
###求因数def factors(num): '''返回一个num的因数数组列表factorList''' factorList=[] for i in range(1,num+1): if num%i==0: factorList.append(i) return factorList###求公因数def commonfactors(num1,num2): '''返回num1,num2的公因数的数组cfs''' .
2022-02-12 01:29:50
387
原创 求一个数的算数平方根
def average(a,b): return (a+b)/2def squareRoot(num,low,high): for i in range(20): guess=average(low,high) if guess**2==num: print(guess) elif guess**2>num: high=guess else : lo...
2022-02-09 00:48:15
249
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅