整点散点积分,备用
往后打算做傅里叶级数的二位拟合。。numpy,scipy没弄好,先垫上这些。

import math,turtle
xy = [0,
0,1,
1,1,
2,1,
3,1,
4,1,
5,2,
6,3,
7,4,
8,5,
9,5,
10,4
]#0,x,y,x,y....
a = int(len(xy)/2)
c = 0
turtle.speed(speed=0)
turtle.penup()
turtle.goto(-300,0)
turtle.pendown()
turtle.goto(500,0)
turtle.goto(-500,0)
turtle.goto(-300,0)
turtle.goto(-300,500)
turtle.goto(-300,-500)
turtle.goto(-300,0)
for i in range(1,a):
c = c + (xy[2*i+1]-xy[2*i-1])*(xy[2*i+2]+xy[2*i])/2
turtle.goto(50*xy[2*i+1]-300,50*xy[2*i])
turtle.goto(50*(xy[2*i+1]+1)-300,50*xy[2*i+2])
print(c)