當前位置: 首頁>>代碼示例>>C#>>正文


C# Function.getFunctionExpressionString方法代碼示例

本文整理匯總了C#中System.Function.getFunctionExpressionString方法的典型用法代碼示例。如果您正苦於以下問題:C# Function.getFunctionExpressionString方法的具體用法?C# Function.getFunctionExpressionString怎麽用?C# Function.getFunctionExpressionString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Function的用法示例。


在下文中一共展示了Function.getFunctionExpressionString方法的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


注:本文中的System.Function.getFunctionExpressionString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。