Oxygen Basic

Programming => Example Code => Topic started by: Peter on May 29, 2013, 08:59:55 AM

Title: Lorenz
Post by: Peter on May 29, 2013, 08:59:55 AM
Deleted
Title: Re: Lorenz
Post by: JRS on June 04, 2013, 08:34:37 PM
Here is your Butterfly example in SB/JAPI after running about a minute. I'm surprised how well/fast JAPI works being a socket interface to Java primitives.

(http://files.allbasic.info/ScriptBasic/butflyfc.png)

Code: [Select]
import japi.bas

j_start
win = j_frame("Peter's Butterfly")
can = j_canvas(win, 640, 480)
j_pack(win)
j_show(win)

x =  0.0
y = 20.0
z = 20.0

while obj <> win
  xx = x + 0.01 * ( -10.0 * x + 10.0 * y)
  yy = y + 0.01 * (  28.0 * x - y - x * z )
  zz = z + 0.01 * ( -8.0  * z / 3.0  + x * y )
  j_setcolor(can, Rnd(), Rnd(), Rnd())
  j_drawline(can, x*10+320, -z*10+500, xx*10+320, -zz*10+500)
  x = xX
  y = yY
  z = zZ
  obj = j_getaction()
wend                          
j_quit

I attached Peter's Simple Window in OxygenBasic version as well.


X
Title: Re: Lorenz
Post by: JRS on June 04, 2013, 10:38:19 PM
Peter,

Do you think you could come up with the code for this Lorenz example?

(http://paulbourke.net/fractals/lorenz/lorenz11.gif)

Something like this would also be nice.

(http://paulbourke.net/fractals/lorenz/lorenz2.png)
Title: Re: Lorenz
Post by: Charles Pegge on June 05, 2013, 02:29:08 AM
Good article on Chaos theory:

http://www.imho.com/grae/chaos/chaos.html
Title: Re: Lorenz
Post by: JRS on June 05, 2013, 07:41:13 AM
Quote
Chaos has already had a lasting effect on science, yet there is much still left to be discovered. Many scientists believe that twentieth century science will be known for only three theories: relativity, quantum mechanics, and chaos.
Title: Re: Lorenz
Post by: JRS on June 05, 2013, 09:24:46 PM
I think this is what Peter intended with his example.

(http://files.allbasic.info/ScriptBasic/chaos.png)

(http://files.allbasic.info/ScriptBasic/chaosbutfly.png)

Chaos: When the present determines the future, but the approximate present does not approximately determine the future.

"By Edward Lorenz"