Exemple #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            Function function = null;

            try
            {
                function = new Implicit2DFunction(txtImplicitFunction.Text);
                for (int i = 1; i <= nudDerivativeImpl.Value; i++)
                {
                    function = function.Derivative;
                }
                txtImplicitResult.Text = function.Expression;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "MathX Demo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
        protected override void InitFunction()
        {
            if (this.SourceType == SourceType.Equation)
            {
                _function = new Implicit2DFunction(this.Formula);
            }
            else
            {
//				BivariateFunctionnEvalutor evalutor = new BivariateFunctionnEvalutor();
//				evalutor.Text = this.CodeBody;
//				switch(this.CodeLanguage)
//				{
//					case CodeLanguage.CSharp:
//						evalutor.language= CodeLanguage.CSharp;
//						break;
//					case CodeLanguage.VBNET:
//						evalutor.language = CodeLanguage.VBNET;
//						break;
//				}
//				_function = new Implicit2DFunction(new BivariateRealFunction(evalutor.Invoke));
                FunctionEvalutor evalutor = new FunctionEvalutor(this.CodeBody, new string[] { "x", "y" }, this.CodeLanguage);
                _function = new Implicit2DFunction((BivariateRealFunction)evalutor.CreateDelegate(typeof(BivariateRealFunction)));
            }

            if (this.DerivativeMode)
            {
                for (int i = 0; i < this.OrderOfDerivative; i++)
                {
                    _function = _function.Derivative;
                    if (_function is Constant)
                    {
                        return;
                    }
                }
            }
        }
Exemple #3
0
 public Implicit2DFunctionPlotter(Implicit2DFunction function)
 {
     _function = function.ValueAt;
 }