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


C# Constant.getConstantName方法代码示例

本文整理汇总了C#中Constant.getConstantName方法的典型用法代码示例。如果您正苦于以下问题:C# Constant.getConstantName方法的具体用法?C# Constant.getConstantName怎么用?C# Constant.getConstantName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Constant的用法示例。


在下文中一共展示了Constant.getConstantName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: runTest1


//.........这里部分代码省略.........
         reg = 36;
         if ( MathFunctions.abs(reg - value) < 0.00001 )
             testResult = true;
         mXparser.consolePrint(value + " reg ... " + reg + " --> ");
         break;
     case 275:
         expStr = "sum(i,1,10,harm(i)) - sum(i,1,10,Harm(1,i))";
         mXparser.consolePrint(expStr + " ...... ");
         exp[testId] = new Expression(expStr);
         value = exp[testId].calculate();
         reg = 0;
         if ( MathFunctions.abs(reg - value) < 0.00001 )
             testResult = true;
         mXparser.consolePrint(value + " reg ... " + reg + " --> ");
         break;
     case 276:
         expStr = "1/4*2";
         mXparser.consolePrint(expStr + " ...... ");
         exp[testId] = new Expression(expStr);
         value = exp[testId].calculate();
         reg = 0.5;
         if (MathFunctions.abs(reg - value) < 0.00001)
             testResult = true;
         mXparser.consolePrint(value + " reg ... " + reg + " --> ");
         break;
     case 277:
         expStr = "n1_geq_2(0)";
         Constant c1 = new Constant("c1", 0.25+0.01);
         RecursiveArgument z1 = new RecursiveArgument("z1","z1(n-1)^2+c1", "n");
         z1.addDefinitions(c1);
         z1.addBaseCase(0, 0);
         Function n1_geq_2 = new Function("n1_geq_2", "if( z1(k) > 2, k, n1_geq_2(k+1) )", "k");
         n1_geq_2.addDefinitions(z1);
         mXparser.consolePrint(c1.getConstantName() + " = " + c1.getConstantValue() + " ; " + z1.getArgumentName() + " = " + z1.getArgumentExpressionString() + " ; " + n1_geq_2.getFunctionName() + " = " + n1_geq_2.getFunctionExpressionString() + " ; " + expStr + " ...... ");
         exp[testId] = new Expression(expStr);
         exp[testId].addDefinitions(n1_geq_2);
         value = exp[testId].calculate();
         reg = 30;
         if ( MathFunctions.abs(reg - value) < 0.00001 )
             testResult = true;
         mXparser.consolePrint(value + " reg ... " + reg + " --> ");
         break;
     case 278:
         expStr = "n2_geq_2(0)";
         Constant c2 = new Constant("c2", 0.25+0.01);
         Function z2 = new Function("z2","if( n>0, z2(n-1)^2+c2, 0)", "n");
         z2.addDefinitions(c2);
         Function n2_geq_2 = new Function("n2_geq_2", "if( z2(k) > 2, k, n2_geq_2(k+1) )", "k");
         n2_geq_2.addDefinitions(z2);
         mXparser.consolePrint(c2.getConstantName() + " = " + c2.getConstantValue() + " ; " + z2.getFunctionName() + " = " + z2.getFunctionExpressionString() + " ; " + n2_geq_2.getFunctionName() + " = " + n2_geq_2.getFunctionExpressionString() + " ; " + expStr + " ...... ");
         exp[testId] = new Expression(expStr);
         exp[testId].addDefinitions(n2_geq_2);
         value = exp[testId].calculate();
         reg = 30;
         if ( MathFunctions.abs(reg - value) < 0.00001 )
             testResult = true;
         mXparser.consolePrint(value + " reg ... " + reg + " --> ");
         break;
     case 279:
         expStr = "n1_geq_2(0) - n2_geq_2(0)";
         c1 = new Constant("c1", 0.25+0.01);
         z1 = new RecursiveArgument("z1","z1(n-1)^2+c1", "n");
         z1.addDefinitions(c1);
         z1.addBaseCase(0, 0);
         n1_geq_2 = new Function("n1_geq_2", "if( z1(k) > 2, k, n1_geq_2(k+1) )", "k");
         n1_geq_2.addDefinitions(z1);
开发者ID:RoganMatrivski,项目名称:Math-Problem-Generator,代码行数:67,代码来源:RegTestExpression.cs


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