Butterfly effect

Miscellaneous Forums/General Discussion/Butterfly effect

i've been doing some research about this and i came up to this code:

read this first:
there are two universes; in universe 1 the balls are blue, in universe 2 the balls are green. both universes does not affect each other!

the green and the blue universes start at exactly the same beginning conditions, except that in the green one i moved ONE little ball ONE pixel.
and now watch, how this tiny change makes the differences of our life!!


Graphics 1024, 768, 32, 2
SetBuffer BackBuffer()
SeedRnd MilliSecs()

Type Ball1
	Field x#, y#
	Field vx#, vy#
	Field oldx#, oldy#
	Field fric#, mass#
End Type
Type Ball2
	Field x#, y#
	Field vx#, vy#
	Field oldx#, oldy#
	Field fric#, mass#
End Type

;Many balls
For i = 1 To 20
	x# = Rand(0, GraphicsWidth())
	y# = Rand(0, GraphicsHeight())
	fric# = Rnd(.9, 1)
	mass# = Rnd(1, 30)
	CreateBall1(x#, y#, fric#, mass#)
	CreateBall2(x#, y#, fric#, mass#)
Next
;The center ball
CreateBall1(GraphicsWidth() / 2, GraphicsHeight() / 2, 0, 100)
CreateBall2(GraphicsWidth() / 2, GraphicsHeight() / 2, 0, 100)
;The shifted ball
CreateBall1(100, 100, 0, 10)
CreateBall2(100, 101, 0, 10)

speed# = 1
Repeat
	Cls
	order = 1 - order
	If order Then
		UpdateBalls1(speed#)
		UpdateBalls2(speed#)
	Else
		UpdateBalls2(speed#)
		UpdateBalls1(speed#)
	EndIf
	Flip
Until KeyHit(1)
End

Function CreateBall1(x#, y#, fric#, mass#)
b.Ball1 = New Ball1
b\x# = x#
b\y# = y#
b\oldx# = b\x#
b\oldy# = b\y#
b\fric# = fric#
b\mass# = mass#
End Function

Function CreateBall2(x#, y#, fric#, mass#)
b.Ball2 = New Ball2
b\x# = x#
b\y# = y#
b\oldx# = b\x#
b\oldy# = b\y#
b\fric# = fric#
b\mass# = mass#
End Function

Function UpdateBalls1(speed# = 1)
Color 128, 128, 255
For b.Ball1 = Each Ball1
	b\vy# = 0
	b\vx# = 0
	For b2.Ball1 = Each Ball1
		xdiff# = b2\x# - b\x#
		ydiff# = b2\y# - b\y#
		dis# = Sqr(xdiff# * xdiff# + ydiff# * ydiff#)
		If Abs(dis#) > 0 Then
			b\vx# = b\vx# + (xdiff# / dis#) / (dis# * b\mass# / 10)
			b\vy# = b\vy# + (ydiff# / dis#) / (dis# * b\mass# / 10)
		End If
	Next
	tx# = b\x#
	ty# = b\y#
	b\x# = b\x# + b\x# * b\fric# - b\oldx# * b\fric# + b\vx# * speed#
	b\y# = b\y# + b\y# * b\fric# - b\oldy# * b\fric# + b\vy# * speed#
	If b\x# < 0 Then b\x# = 0
	If b\x# > GraphicsWidth() Then b\x# = GraphicsWidth()
	If b\y# < 0 Then b\y# = 0
	If b\y# > GraphicsHeight() Then b\y# = GraphicsHeight()
	b\oldx# = tx#
	b\oldy# = ty#
	
	Oval b\x# - b\mass# / 2, b\y# - b\mass# / 2, b\mass#, b\mass#
Next
End Function

Function UpdateBalls2(speed# = 1)
Color 128, 255, 128
For b.Ball2 = Each Ball2
	b\vy# = 0
	b\vx# = 0
	For b2.Ball2 = Each Ball2
		xdiff# = b2\x# - b\x#
		ydiff# = b2\y# - b\y#
		dis# = Sqr(xdiff# * xdiff# + ydiff# * ydiff#)
		If Abs(dis#) > 0 Then
			b\vx# = b\vx# + (xdiff# / dis#) / (dis# * b\mass# / 10)
			b\vy# = b\vy# + (ydiff# / dis#) / (dis# * b\mass# / 10)
		End If
	Next
	tx# = b\x#
	ty# = b\y#
	b\x# = b\x# + b\x# * b\fric# - b\oldx# * b\fric# + b\vx# * speed#
	b\y# = b\y# + b\y# * b\fric# - b\oldy# * b\fric# + b\vy# * speed#
	If b\x# < 0 Then b\x# = 0
	If b\x# > GraphicsWidth() Then b\x# = GraphicsWidth()
	If b\y# < 0 Then b\y# = 0
	If b\y# > GraphicsHeight() Then b\y# = GraphicsHeight()
	b\oldx# = tx#
	b\oldy# = ty#
	
	Oval b\x# - b\mass# / 2, b\y# - b\mass# / 2, b\mass#, b\mass#
Next
End Function


btw: the basic verlet code is not by myself....

cool, looks good too. Jeff Goldblum's smiling right now.

Exactly what is this?

I shows that just a slight difference in something, even though they look identical can create dramatically different results.

Dabz

And what does that tell you?

It tells you the world we live in isnt as uniformed as we think it is and events can change dramatically just by changing the smallest detail.

The general Butterfly Effect theory is that a flap of a butterflys wing could cause a hurricane on the other side of the world.

http://en.wikipedia.org/wiki/Butterfly_effect

I know, I watched both films! :D

Dabz

Can you elaborate on that?

Not really!

Dabz

Are you being negative?

Nope, I'm getting ready to take our lass to Durham! :)

Dabz

Excellent film.

Ah, a new patient has arrived.

Please go on.

Thank you.

Have any of you seen both endings of the first one? I prefer the second ending.

The Butterfly effect 2 sucked coconuts. :)

It's a bit like this alternate reality stuff where everything you do is done differently in other realities.

If that is true then I'm going to try and become rich, build a machine so that I can travel to the other realities and make myself in those realities rich also. Now it means that if I fail in this reality then a me from another reality should pop in here and make me rich. Because it's guaranteed that in atleast one of them I'll succeed.

:)

Do any other reasons not come to mind?

Basicly, to model anything correctly over a long period of time, you need a model just as big as the original, and it needs to run just as long as the original.

The term "Butterfly effect" is used to say that, (Simply)
If you were going to model the weather (its normaly the weather, but it could be anything), then you wouldnt model down to the level of a butterflys wings, but that in actual reality you would have to. That is, any model at all goes wrong eventualy if you make any assumption about either the original variables or the external influences or the level of detail.

Of course Bishop Berkly said that the whole universe is being modeled by God in his imagination, and the Buttyflys wings are only applicable if someone happens to be looking at them when they flap, meaning that if you never think of adding the buttiflys wings into the model, it wont effect it, but once you have concidered it then it will effect it.

Seen the ending where he strangles himself in the womb.

Glad he saved the dog though.

The mother lived did she?

From what I gather.

I'm back...

Yeah, she lived! :)

And Amon, the second one was a pile of dross! ;)

Dabz

How do you know which balls are which? Are the big balls the mothers?

i've seen the first movie, but not the second one.
i think the movie wants to tell, that live is perfect, and you shouldnt change things this way...

ps: while you are reading this thread, you miss your next train to the city. well, maybee that train will completely burn out in accident and i saved your life!

Loved the first film, an interesting concept - the second film sucked.

It demonstrates chaos. Chaos being the term humans seem to give to something thats 'unpredictable' - except, this is entirely predictable, as everything in the universe conforms to rigid rules of physics.


well, maybee that train will completely burn out in accident and i saved your life!



Then again, you may of missed that train and caught the next one, which in turn... burnt out and turned you into toasted brown bread! :)

Dabz