本文整理汇总了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);