Discussion forum about PANORAMIC language

Mac, Windows & Android application development with PANORAMIC language
 
HomeFAQSearchRegisterMemberlistUsergroupsLog in
Latest topics
» Hello world.
by Mon Jun 19, 2017 1:37 am

» Biomorphes de PICKOVER
by Sun Jun 18, 2017 2:33 am

» In less than 10 lines of code
by Fri Jun 16, 2017 5:03 am

» Effect Dopler
by Fri Jun 16, 2017 3:29 am

» SuperEllipse
by Wed Jun 14, 2017 4:01 am

» Plants
by Wed Jun 14, 2017 3:38 am

» Mira's attractor
by Wed Jun 14, 2017 3:30 am

» Triangle of Sierpinski
by Wed Jun 14, 2017 3:22 am

» Esthétique polaire
by Wed Jun 14, 2017 3:16 am

» Butterfly effect : Lorenz equations
by Wed Jun 14, 2017 3:08 am

» Collision detection
by Tue Jun 13, 2017 5:09 am

» The Bees Laline Paull Epub Books
by Mon Oct 10, 2016 8:58 pm

» PANORAMIC for Mac OSX 10 is available
by Tue Aug 09, 2016 6:08 pm

» ide
by Sat Jul 16, 2016 12:27 am

» Can I change the program icon/logo in my application ?
by Thu Jul 07, 2016 3:32 am

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Share | 
 

 Butterfly effect : Lorenz equations

View previous topic View next topic Go down 
AuthorMessage
papydall

avatar

Number of posts : 39
Age : 67
Localisation : TUNISIA
Registration date : 2013-03-16

PostSubject: Butterfly effect : Lorenz equations   Wed Jun 14, 2017 3:08 am

Code:

rem ============================================================================
rem     Butterfly effect : Lorenz equations
rem             Papydall June 2017
rem ============================================================================
Init()
Loop()
end
rem ============================================================================
SUB Init()
    dim xa(2), ya(2), za(2)
    dim c1, dt, a, b, c, i, x, y, z, x1, y1, z1, xd, yd
        
    picture 10 : width 10,width(0)-50 : height 10,height(0)-60 : top 10,10: left 10,20
    2d_target_is 10 : color 10,0,0,0 : caption 0,"Butterfly effect .... <ESC> to stop ..."
    
    xa(0) = 3.051522 : xa(1) = 3.051522
    ya(0) = 1.592542 : ya(1) = 1.582542
    za(0) = 15.62388 : za(1) = 15.62388    
    c1 = 0.292893 : dt = 0.02 : a = 5 : b = 15 : c = 1
    
END_SUB
rem ============================================================================
SUB Loop()
    repeat
        for i = 0 to 1
            x  = xa(i) : y = ya(i) : z = za(i)
            x1 = x-a*x*dt+a*y*dt
            y1 = y+b*x*dt-y*dt-z*x*dt
            z1 = z-c*z*dt+x*y*dt
            x  = x1 : y = y1 : z = z1
            xd = y-x*c1 : yd = z+x*c1

            if i = 1
               draw(xd,yd,128)
            else
               draw(xd,yd,255)
            end_if
            xa(i) = x : ya(i) = y : za(i) = z
        next i
    until scancode = 27

END_SUB
rem ============================================================================
' Draw a shiny ball
SUB Draw(xd,yd,cl)
    dim_local i1,j1,c,c1,c2,d1,d2,i,k
    c1 = 19.3 : c2 = width(10)/2
    d1 = 11.0 : d2 = 392.0
    k  = 10
    i1 = c1*xd+c2
    j1 = 0-d1*yd+d2
    for i = 127 to 255 step 16
        c = 0.09*(10-k)
        2d_pen_color cl,i,i : 2d_fill_color cl,i,i
        2d_circle i1+c,j1+c,k
        k = k - 1
    next i
END_SUB
rem ============================================================================
Back to top Go down
View user profile
 
Butterfly effect : Lorenz equations
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» The Bystander effect
» C# Matrix Effect
» Super Mario Mushroom Kingdom Warp Pipe Game
» Fioricet and Codeine
» Strange side effect?

Permissions in this forum:You cannot reply to topics in this forum
Discussion forum about PANORAMIC language :: Panoramic for Windows :: Source code (snippets)-
Jump to: