internal void Generate_BasicPolyadic_CASExpression(GMacParametricSymbolicExpression casExpr, OperandsByName operands) { Log.Append("("); var flag = false; foreach (var pair in operands.OperandsDictionary) { if (flag) { Log.Append(", "); } else { flag = true; } Log.Append(pair.Key); Log.Append(" = "); pair.Value.AcceptVisitor(this); } Log.Append(")"); }
public ILanguageExpression Generate_SymbolicExpression(MathematicaScalar casExpr, OperandsByName operands) { var exprType = ScalarType; //var expr_type = this.VerifyType_SymbolicExpression(cas_expr, operands) as TypePrimitive; if (operands.OperandsDictionary.Count == 0) { return(ValuePrimitive <MathematicaScalar> .Create(exprType, casExpr)); } var basicExpr = BasicPolyadic.Create(exprType, GMacParametricSymbolicExpression.Create(casExpr)); basicExpr.Operands = operands; return(basicExpr); }
private ILanguageExpression CompileSymbolicExpressionCall(GMacParametricSymbolicExpression expr, OperandsByName operands) { var compiledOperands = OperandsByName.Create(); foreach (var pair in operands.OperandsDictionary) { var compiledRhsExpr = (ILanguageExpressionAtomic)CompileExpression(pair.Value); compiledOperands.AddOperand(pair.Key, compiledRhsExpr); } var compiledExpr = BasicPolyadic.Create(GMacRootAst.ScalarType, expr); compiledExpr.Operands = compiledOperands; return(compiledExpr); }
private ValuePrimitive <MathematicaScalar> EvaluateBasicPolyadicSymbolicExpressionCall(GMacParametricSymbolicExpression symbolicExpr, OperandsByName operands) { var exprText = symbolicExpr.AssociatedMathematicaScalar.ExpressionText; foreach (var pair in operands.OperandsDictionary) { var rhsValue = pair.Value.AcceptVisitor(this); exprText = exprText.Replace(pair.Key, ((ValuePrimitive <MathematicaScalar>)rhsValue).Value.ExpressionText); } var scalar = MathematicaScalar.Create(symbolicExpr.AssociatedMathematicaScalar.CasInterface, exprText); //May be required //scalar = MathematicaScalar.Create(scalar.CAS, scalar.CASEvaluator.FullySimplify(scalar.MathExpr)); return (ValuePrimitive <MathematicaScalar> .Create( GMacRootAst.ScalarType, scalar )); }