示例#1
0
        private void cosClick(object sender, System.EventArgs e)
        {
            Function1D cos = new Function1D();

            cos.source = "return cos(x);";
            cos.Compile(true);
            cos.Color     = Color.Red;
            cos.lineWidth = 2;
            cos.lineStyle = DashStyle.Dash;
            graph.Model.Items.Add(cos);
            graph.Invalidate();
        }
示例#2
0
        private void gaussClick(object sender, System.EventArgs e)
        {
            Function1D gauss = new Function1D();

            //Here the source accesses the array p, an array of function parameters.
            //When you compile the item, the size of p is automatically set to the
            //highest element referred to in the source.
            gauss.source = "double arg = (x-p[0])/p[1]; return p[2]*exp(-arg*arg);";
            gauss.Compile(true);
            gauss.p[0] = 1;
            gauss.p[1] = 1;
            gauss.p[2] = 4;
            graph.Model.Items.Add(gauss);
            graph.Invalidate();
        }
示例#3
0
        private void sinClick(object sender, System.EventArgs e)
        {
            Function1D sin = new Function1D();

            //The source represents the body of the following function:
            //double[] p, dfdp;
            //double f(double x) {
            //  ...
            //}
            sin.source = "return sin(x);";
            sin.Compile(true);
            sin.Color     = Color.Blue;
            sin.lineWidth = 2;
            graph.Model.Items.Add(sin);
            graph.Invalidate();
        }