欢迎光临散文网 会员登陆 & 注册

整点散点积分,备用

2023-04-05 13:39 作者:韩言悦欣  | 我要投稿

往后打算做傅里叶级数的二位拟合。。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)


整点散点积分,备用的评论 (共 条)

分享到微博请遵守国家法律