Differences between revisions 11 and 12
 ⇤ ← Revision 11 as of 2007-11-03 10:28:34 → Size: 3283 Editor: Chris Batho Comment: ← Revision 12 as of 2008-12-08 10:45:42 → ⇥ Size: 3299 Editor: anonymous Comment: converted to 1.6 markup Deletions are marked like this. Additions are marked like this. Line 4: Line 4: || inline:Maycontrol.jpg|| || {{attachment:Maycontrol.jpg}}|| Line 43: Line 43: || inline:May1.jpg|| || {{attachment:May1.jpg}}||

Describe ChrisBatho/TestC here.

This is The Control Panel

May was the pioneer who first detected the onset of chaos in this population model.

«Mays Equation»=
```NB. May's Equation;- xn=rx(1-x)
NB. By Chris Batho and Oleg Kobchenko for J601  v1.01
NB. http://www.jsoftware.com/jwiki/Scripts/mays equation
NB.===========================================================
```

The main function ie Mays equation.

«Mays Equation»=
```        may=: 3 : 0         NB. main function
'Rval Rinc'=: y

NB. nom val Rval:- 2.6 2.75 3.00 3.55 3.75 Rinc:-0.00015
r=: Rval
X=: 0.6
[R=: r
[NX=: X
ctr=:0
while. (ctr < 66000) *. (X > 0.01) do.
r=: r + Rinc
z=: (r*X)*(1-X)
X=: z
[R=: R, r
[NX=: NX, X
ctr=: ctr + 1
j=. ctr%450
pct=: (3.994-Rval)%Rinc
j=. (ctr*100)%pct
wd 'set progress ',":j
end.
)
NB.===========================================================
```

This is a sample plot

The GUI Viewer.

«Mays Equation»=
```        require 'graph numeric trig plot strings'

view=: 3 : 0           NB. viewer
'nRval nRinc'=: y
may     nRval, nRinc
pd 'axes 1 1'
pd 'labels 1'
pd 'viewsize 2'
pd 'color darkblue'
pd 'pensize 1'
'type dot; title The Equation of May (R v X); framebackcolor white' plot R; NX
)

NB.===========================================================
```

Window Control.

«Mays Equation»=
```require 'printf plot strings'

MAY=: 0 : 0
pc May;pn "Mays equation";
menu new "&New" "" "" "";
menu open "&Open" "" "" "";
menu exit "&Exit" "" "" "";
xywh 153 12 41 11;cc editRstart edit;
xywh 154 37 41 11;cc editRinc edit;
xywh 162 2 27 10;cc static1 static;cn "R Start ";
xywh 165 26 23 10;cc static2 static;cn "R Inc.";
xywh 27 37 34 11;cc bnPlot button;cn "Plot";
xywh 21 20 50 11;cc progress progress;
xywh 24 8 46 10;cc static3 static;cn "Plot Progress";
xywh 73 49 75 30;cc stDesc static;
pas 6 6;pcenter;
rem form end;
)
```

Execution

«Mays Equation»=
```May_run=: 3 : 0
wd MAY
NB. initialize form here
wd 'set editRstart 3.55'
wd 'set editRinc 0.000035'
j=: 0
wd 'set progress ',":j
wd 'set stDesc *',Desc rplc LF;''
wd 'pshow;'
)
```

Go control.

«Mays Equation»=
```May_bnPlot_button=: 3 : 0
fire''
'Plot completed 'printf here=: ''
)

May_close=: 3 : 0
wd'pclose'
)
```

Go

«Mays Equation»=
```fire=: 3 : 0
m=: 1>.{.0".editRstart
n=: ".editRinc
view m, n
)
```

A warning to the user should you select very small values.

«Mays Equation»=
```Desc =: 0 : 0
Take care. A small value
of Rinc
causes a long
Plot time.
)
```

Run.

«Mays Equation»=
```May_run''
```

An Example of a simple diagnostic test if required for debugging.

«Mays Equation»=
```NB.view 3.55 0.00015
```

Progress button (no additional control here.)

«Mays Equation»=
```May_progress_button=: 3 : 0
)
```

ChrisBatho/Mays Population Equation (last edited 2008-12-08 10:45:42 by anonymous)