KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > StandardPlot


1 import java.applet.*;
2 import java.awt.*;
3 import JSci.awt.*;
4 import JSci.maths.NumericalConstants;
5 import JSci.maths.chaos.*;
6
7 /**
8 * Plot of the Standard map.
9 * @author Mark Hale
10 * @version 1.1
11 */

12 public final class StandardPlot extends Applet {
13         private StandardMap cm;
14         private ScatterGraph graph;
15         private final int N=10000;
16         public void init() {
17                 cm=new StandardMap(2.5);
18                 float xData[]=new float[N];
19                 float yData[]=new float[N];
20                 double x[]={0.1,0.1};
21                 for(int i=0;i<N;i++) {
22                         xData[i]=(float)(x[0]<0.0?x[0]+NumericalConstants.TWO_PI:x[0]);
23                         yData[i]=(float)x[1];
24                         x=cm.map(x);
25                 }
26                 DefaultGraph2DModel model=new DefaultGraph2DModel();
27                 model.setXAxis(xData);
28                 model.addSeries(yData);
29                 graph=new ScatterGraph(model);
30                 graph.setNumbering(false);
31                 setLayout(new BorderLayout());
32                 add(graph,"Center");
33         }
34 }
35
36
Popular Tags