資源描述:
《混沌之蝴蝶效應.doc》由會員上傳分享,免費在線閱讀,更多相關內容在教育資源-天天文庫。
1、混沌之蝴蝶效應PublicFunctionfx(x,y,z)fx=-10*x+10*yEndFunctionPublicFunctionfy(x,y,z)fy=28*x-y-x*zEndFunctionPublicFunctionfz(x,y,z)fz=x*y-8*z/3EndFunctionPrivateSuboption1_click()Picture1.ClsPicture1.Scale(-26,51)-(26,-1)Picture1.Line(-25,50)-(25,0),vbRed,B
2、h=0.01x=1y=1z=1Forn=0To5000X1=h*fx(x,y,z)Y1=h*fy(x,y,z)Z1=h*fz(x,y,z)X2=h*fx(x+X1/2,y+Y1/2,z+Z1/2)Y2=h*fy(x+X1/2,y+Y1/2,z+Z1/2)Z2=h*fz(x+X1/2,y+Y1/2,z+Z1/2)X3=h*fx(x+X2/2,y+Y2/2,z+Z2/2)Y3=h*fy(x+X2/2,y+Y2/2,z+Z2/2)Z3=h*fz(x+X2/2,y+Y2/2,z+Z2/2)X4=h*fx
3、(x+X3,y+Y3,z+Z3)Y4=h*fy(x+X3,y+Y3,z+Z3)Z4=h*fz(x+X3,y+Y3,z+Z3)xa=xya=yza=zx=x+(X1+2*X2+2*X3+X4)/6y=y+(Y1+2*Y2+2*Y3+Y4)/6z=z+(Z1+2*Z2+2*Z3+Z4)/6Ifn>2000ThenPicture1.Line(x,z)-(xa,za),vbYellowPicture1.PSet(x,z),vbRedEndIfNextEndSubPrivateSubOption2_Cli
4、ck()Picture1.ClsPicture1.Scale(-26,31)-(26,-31)Picture1.Line(-25,30)-(25,-30),vbRed,Bh=0.01x=1y=1z=1Forn=0To5000X1=h*fx(x,y,z)Y1=h*fy(x,y,z)Z1=h*fz(x,y,z)X2=h*fx(x+X1/2,y+Y1/2,z+Z1/2)Y2=h*fy(x+X1/2,y+Y1/2,z+Z1/2)Z2=h*fz(x+X1/2,y+Y1/2,z+Z1/2)X3=h*fx(x
5、+X2/2,y+Y2/2,z+Z2/2)Y3=h*fy(x+X2/2,y+Y2/2,z+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