Lorenz Attractor

2-lorenz-attractor2

Option Explicit
'Script written by <karthik.dondeti>
'Script copyrighted by <yet.another.script>
'Script version Monday, February 02, 2009 12:24:27 AM
'Reference : http://en.wikipedia.org/wiki/Lorenz_attractor

Call Main()

Dim a,b,c
a=10 : b=28 : c=8/3

Sub Main()
	Dim mpoints:mpoints = 10000
	Dim arrPt(10000)
	Dim x,y,z
	x=1 : y=1 : z=1

	Dim dt:dt=0.01
	Dim i:i=0

	'ReDim arrPt(50000)
	Do While (i<mpoints+1)

		arrPt(i)= array(x,y,z)

		x=x+dt*dx(x,y,z)
		y=y+dt*dy(x,y,z)
		z=z+dt*dz(x,y,z)

		i=i+1
	Loop

	Call rhino.addcurve (arrPt)
End Sub

Function dx(x,y,z)
	dx=a*(y-x)
End Function

Function dy(x,y,z)
	dy=-(x*z) + (b*x)-y
End Function

Function dz(x,y,z)
	dz= x*y-(c)*z
End Function
Advertisements

~ by Karthik Dondeti on February 2, 2009.

2 Responses to “Lorenz Attractor”

  1. how do you use that script in vb.net. I can’t seem to make it work, could you tell me how to get the script to function in gh

  2. Apologies for the late reply. I was busy making the transition from one place to another. Haven’t coded this on gh yet. Will try and send it across soon.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: