本文整理汇总了C#中System.Function.addDefinitions方法的典型用法代码示例。如果您正苦于以下问题:C# Function.addDefinitions方法的具体用法?C# Function.addDefinitions怎么用?C# Function.addDefinitions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Function
的用法示例。
在下文中一共展示了Function.addDefinitions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: runTest1
//.........这里部分代码省略.........
if ( MathFunctions.abs(value-reg) <= 0.00001)
testResult = true;
mXparser.consolePrint(value + " reg ... " + reg + " --> ");
break;
case 99:
i = new Argument("i", 5);
expStr = "2*i+sum(i,1,10,i)";
mXparser.consolePrint(expStr + " ...... ");
exp[testId] = new Expression(expStr,i);
value = exp[testId].calculate();
reg = 65;
if ( value == reg)
testResult = true;
mXparser.consolePrint(value + " reg ... " + reg + " --> ");
break;
case 100:
x = new Argument("x",3);
expStr = "sin(x)-sin(x-1)-int(cos(x),x,2,3)";
mXparser.consolePrint(expStr + " ...... ");
exp[testId] = new Expression(expStr,x);
value = exp[testId].calculate();
reg = 0;
if ( MathFunctions.abs(value-reg) <= 0.00001)
testResult = true;
mXparser.consolePrint(value + " reg ... " + reg + " --> ");
break;
case 101:
f = new Function("mg", "sin(x)+cos(y)", "x", "y");
x = new Argument("x", 3);
y = new Argument("y", 2);
expStr = "sin(x)+cos(y)-mg(x,y)";
mXparser.consolePrint(expStr + " ...... ");
exp[testId] = new Expression(expStr,x, y);
exp[testId].addDefinitions(f);
value = exp[testId].calculate();
reg = 0;
if ( MathFunctions.abs(value - reg) <= 0.000000000001)
testResult = true;
mXparser.consolePrint(value + " reg ... " + reg + " --> ");
break;
case 102:
f = new Function("mg", "sin(x)+cos(y)", "x", "y");
expStr = "der(sin(x)+cos(y),x)-der(mg(x,y),x)";
mXparser.consolePrint(expStr + " ...... ");
exp[testId] = new Expression(expStr,new Argument("x", 3), new Argument("y", 2));
exp[testId].addDefinitions(f);
value = exp[testId].calculate();
reg = 0;
if ( MathFunctions.abs(value - reg) <= 0.00000001)
testResult = true;
mXparser.consolePrint(value + " reg ... " + reg + " --> ");
break;
case 103:
f = new Function("f", "x^2", "x");
g = new Function("g", "f(x)^2", "x");
g.addDefinitions(f);
expStr = "g(x)";
mXparser.consolePrint(expStr + " ...... ");
exp[testId] = new Expression(expStr, new Argument("x", 3));
exp[testId].addDefinitions(g);
value = exp[testId].calculate();
reg = 81;
if ( value == reg )
testResult = true;
mXparser.consolePrint(value + " reg ... " + reg + " --> ");
break;