예제 #1
0
 private void UpdateGraph()
 {
     var cFunction = new Function2D { source = _function};
     cFunction.Compile(true);
     cFunction.lineWidth = 0.001F;
     cFunction.Color = Color.DeepSkyBlue;
     graph.Model.Items.Add(cFunction);
 }
예제 #2
0
		private void mandelbrotClick(object sender, System.EventArgs e) {
			Function2D m = new Function2D();
			//The source represents the body of the following function:
			//double[] p, dfdp;
			//double f(double x, double y) {
			//  ...
			//}
			m.source = "double xn = 0, yn = 0, x2 = 0, y2 = 0;" +
				"for (int n = 0; n < 500; n++) {" +
				"  yn = 2*xn*yn + y;" +
				"  xn = x2 - y2 + x;" +
				"  x2 = xn*xn; y2 = yn*yn;" + 
				"  if (x2 + y2 > 4) return n;" +
				"} return 0;";
				m.Compile(true);
			graph.SetRange(graph.x0, graph.x1, graph.y0, graph.y1, 0, 20);  
			graph.Model.Items.Add(m);
			graph.Invalidate();
		}