public double evaluate(DoubleEvaluator engine, FunctionNode function) { double result = Double.MAX_VALUE; double temp; int end = function.size(); for (int i = 1; i < end; i++) { temp = Math.min(result, engine.evaluateNode(function .getNode(i))); if (temp < result) { result = temp; } } return result; } }
public Complex evaluate(IEvaluator<Complex, ComplexVariable> engine, FunctionNode function) { Complex result = null; int end = function.size(); for (int i = 1; i < end; i++) { result = engine.evaluateNode(function.getNode(i)); if (DEBUG) { System.out.println(result); } } return result; } }
public double evaluate(DoubleEvaluator engine, FunctionNode function) { double result = 0.0; for (int i = 1; i < function.size(); i++) { result += engine.evaluateNode(function.getNode(i)); } return result; } }
public double evaluate(DoubleEvaluator engine, FunctionNode function) { double result = Double.MIN_VALUE; double temp; int end = function.size(); for (int i = 1; i < end; i++) { temp = Math.max(result, engine.evaluateNode(function .getNode(i))); if (temp > result) { result = temp; } } return result; } }
public boolean dependsOn(String variableName) { for (int i = 1; i < size(); i++) { if (get(i).dependsOn(variableName)) { return true; } } return false; }
public double evaluate(DoubleEvaluator engine, FunctionNode function) { double result = 1.0; for (int i = 1; i < function.size(); i++) { result *= engine.evaluateNode(function.getNode(i)); } return result; } }
@Override public boolean dependsOn(String variableName) { for (int i = 1; i < size(); i++) { if (get(i).dependsOn(variableName)) { return true; } } return false; }
@Override public double evaluate(DoubleEvaluator engine, FunctionNode function) { double result = 0.0; for (int i = 1; i < function.size(); i++) { result += engine.evaluateNode(function.getNode(i)); } return result; } }
@Override public double evaluate(DoubleEvaluator engine, FunctionNode function) { double result = 1.0; for (int i = 1; i < function.size(); i++) { result *= engine.evaluateNode(function.getNode(i)); } return result; } }
@Override public double evaluate(DoubleEvaluator engine, FunctionNode function) { double result = Double.NaN; int end = function.size(); for (int i = 1; i < end; i++) { result = engine.evaluateNode(function.getNode(i)); if (DEBUG) { System.out.println(result); } } return result; } }
public double evaluate(DoubleEvaluator engine, FunctionNode function) { double result = Double.NaN; int end = function.size(); for (int i = 1; i < end; i++) { result = engine.evaluateNode(function.getNode(i)); if (DEBUG) { System.out.println(result); } } return result; } }
/** * {@inheritDoc} Depends on. */ @Override public boolean dependsOn( String variableName ) { for ( int i = 1; i < size(); i++ ) { if ( get( i ).dependsOn( variableName ) ) { return true; } } return false; }
/** * Evaluate. * * @param engine the engine * @param function the function * @return the double */ @Override public double evaluate( DoubleEvaluator engine, FunctionNode function ) { double result = 0.0; for ( int i = 1; i < function.size(); i++ ) { result += engine.evaluateNode( function.getNode( i ) ); } return result; } }
/** * Evaluate. * * @param engine the engine * @param function the function * @return the double */ @Override public double evaluate( DoubleEvaluator engine, FunctionNode function ) { double result = 1.0; for ( int i = 1; i < function.size(); i++ ) { result *= engine.evaluateNode( function.getNode( i ) ); } return result; } }
@Override public double evaluate(DoubleEvaluator engine, FunctionNode function) { double result = Double.NaN; double temp; int end = function.size(); if (end > 1) { result = engine.evaluateNode(function.getNode(1)); for (int i = 2; i < end; i++) { temp = Math.max(result, engine.evaluateNode(function.getNode(i))); if (temp > result) { result = temp; } } } return result; } }
public Complex evaluate(IEvaluator<Complex, ComplexVariable> engine, FunctionNode function) { Complex result = new Complex(1.0, 0.0); for (int i = 1; i < function.size(); i++) { result = result.multiply(engine.evaluateNode(function.getNode(i))); } return result; } }
public Complex evaluate(IEvaluator<Complex, ComplexVariable> engine, FunctionNode function) { Complex result = new Complex(0.0, 0.0); for (int i = 1; i < function.size(); i++) { result = result.add(engine.evaluateNode(function.getNode(i))); } return result; } }
/** * Evaluate. * * @param engine the engine * @param function the function * @return the complex */ @Override public Complex evaluate( IEvaluator<Complex, ComplexVariable> engine, FunctionNode function ) { Complex result = new Complex( 0.0, 0.0 ); for ( int i = 1; i < function.size(); i++ ) { result = result.add( engine.evaluateNode( function.getNode( i ) ) ); } return result; } }
/** * Converts a parsed FunctionNode expression into an IAST expression */ public IAST convert(IAST ast, FunctionNode functionNode) throws ConversionException { ast.set(0, convert(functionNode.get(0))); for (int i = 1; i < functionNode.size(); i++) { ast.add(convert(functionNode.get(i))); } return ast; }
@Override public ASTNode createFunction(final INodeParserFactory factory, final ASTNode lhs, final ASTNode rhs) { if (rhs instanceof FunctionNode) { FunctionNode r = (FunctionNode) rhs; if (r.size() == 3) { if (r.get(0).equals(factory.createSymbol("Set"))) { return factory.createFunction(factory.createSymbol("TagSet"), lhs, r.get(1), r.get(2)); } else if (r.get(0).equals(factory.createSymbol("SetDelayed"))) { return factory.createFunction(factory.createSymbol("TagSetDelayed"), lhs, r.get(1), r.get(2)); } } } return factory.createFunction(factory.createSymbol("TagSet"), lhs, rhs); } }