当前位置: 首页>>代码示例>>C#>>正文


C# Function.addDefinitions方法代码示例

本文整理汇总了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;
开发者ID:RoganMatrivski,项目名称:Math-Problem-Generator,代码行数:67,代码来源:RegTestExpression.cs


注:本文中的System.Function.addDefinitions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。