Codota Logo
DoubleEvaluator
Code IndexAdd Codota to your IDE (free)

How to use
DoubleEvaluator
in
org.matheclipse.parser.client.eval

Best Java code snippets using org.matheclipse.parser.client.eval.DoubleEvaluator (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Gson g =
  • Codota Iconnew Gson()
  • Codota IconGsonBuilder gsonBuilder;gsonBuilder.create()
  • Codota Iconnew GsonBuilder().create()
  • Smart code suggestions by Codota
}
origin: axkr/symja_android_library

/**
 * Parse the given <code>expression String</code> and return the resulting ASTNode
 * 
 * @param expression
 * @return
 * @throws SyntaxError
 */
public static ASTNode parseNode(String expression, boolean relaxedSyntax) {
  DoubleEvaluator doubleEvaluator = new DoubleEvaluator(relaxedSyntax);
  return doubleEvaluator.parse(expression);
}
origin: axkr/symja_android_library

/**
 * Reevaluate the <code>expression</code> (possibly after a new Variable assignment)
 * 
 * @param Expression
 * @return
 * @throws SyntaxError
 */
public double evaluate() {
  if (fNode == null) {
    throw new SyntaxError(0, 0, 0, " ", "No parser input defined", 1);
  }
  return evaluateNode(fNode);
}
origin: axkr/symja_android_library

/**
 * Get the variable names from the given expression.
 * 
 * @param expression
 * @param result
 *            a set which contains the variable names
 */
public static void getVariables(String expression, Set<String> result) {
  getVariables(expression, result, true);
}
origin: org.refcodes/refcodes-criteria

/**
 * Parse the given <code>expression String</code> and evaluate it to a
 * double value.
 * 
 * @param expression the expression
 * @return the double
 * @throws SyntaxError the syntax error
 */
public double evaluate( String expression ) {
  Parser p = new Parser();
  fNode = p.parse( expression );
  if ( fNode instanceof FunctionNode ) {
    fNode = optimizeFunction( (FunctionNode) fNode );
  }
  return evaluateNode( fNode );
}
origin: org.appdapter/ext.bundle.math.symja_jas

 public double evaluate(DoubleEvaluator engine, FunctionNode function) {
  if (function.size() != 3) {
   throw new ArithmeticException(
     "SetFunction#evaluate(DoubleEvaluator,FunctionNode) needs 2 arguments: "
       + function.toString());
  }
  if (!(function.getNode(1) instanceof SymbolNode)) {
   throw new ArithmeticException(
     "SetFunction#evaluate(DoubleEvaluator,FunctionNode) symbol required on the left hand side: "
       + function.toString());
  }
  String variableName = ((SymbolNode) function.getNode(1)).getString();
  double result = engine.evaluateNode(function.getNode(2));
  IDoubleValue dv = engine.getVariable(variableName);
  if (dv == null) {
   dv = new DoubleVariable(result);
  } else {
   dv.setValue(result);
  }
  engine.defineVariable(variableName, dv);
  return result;
 }
}
origin: org.appdapter/ext.bundle.math.symja_jas

if (obj instanceof IBooleanBoolean1Function) {
 return ((IBooleanBoolean1Function) obj)
   .evaluate(evaluateNodeLogical(functionNode.getNode(1)));
if (obj instanceof IBooleanDouble2Function) {
 return ((IBooleanDouble2Function) obj).evaluate(
   evaluateNode(functionNode.getNode(1)),
   evaluateNode(functionNode.getNode(2)));
} else if (obj instanceof IBooleanBoolean2Function) {
 return ((IBooleanBoolean2Function) obj).evaluate(
   evaluateNodeLogical(functionNode.getNode(1)),
   evaluateNodeLogical(functionNode.getNode(2)));
origin: org.appdapter/ext.bundle.math.symja_jas

   .getNode(i)).doubleValue()));
} else if (functionNode.getNode(i) instanceof FunctionNode) {
 ASTNode optNode = optimizeFunction((FunctionNode) functionNode
   .getNode(i));
 if (!(optNode instanceof DoubleNode)) {
 return new DoubleNode(evaluateFunction(functionNode));
} catch (Exception e) {
origin: org.appdapter/ext.bundle.math.symja_jas

  return ComplexEvaluator.toString(c);
} else {
  DoubleEvaluator engine = new DoubleEvaluator();
  double d = engine.evaluate(strEval);
  return Double.toString(d);
origin: org.appdapter/ext.bundle.math.symja_jas

/**
 * Parse the given <code>expression String</code> and store the resulting
 * ASTNode in this DoubleEvaluator
 * 
 * @param expression
 * @return
 * @throws SyntaxError
 */
public ASTNode parse(String expression) {
 Parser p = new Parser();
 fNode = p.parse(expression);
 if (fNode instanceof FunctionNode) {
  fNode = optimizeFunction((FunctionNode) fNode);
 }
 return fNode;
}
origin: org.appdapter/ext.bundle.math.symja_jas

public boolean evaluateNodeLogical(final ASTNode node) {
 if (node instanceof FunctionNode) {
  return evaluateFunctionLogical((FunctionNode) node);
 }
 if (node instanceof SymbolNode) {
  BooleanVariable v = fBooleanVariables.get(node.toString());
  if (v != null) {
   return v.getValue();
  }
  Boolean boole = SYMBOL_BOOLEAN_MAP.get(node.toString());
  if (boole != null) {
   return boole.booleanValue();
  }
 }
 throw new ArithmeticException(
   "EvalDouble#evaluateNodeLogical(ASTNode) not possible for: "
     + node.toString());
}
origin: org.appdapter/ext.bundle.math.symja_jas

return evaluateFunction((FunctionNode) node);
origin: org.refcodes/refcodes-criteria

  /**
   * Evaluate.
   *
   * @param engine the engine
   * @param function the function
   * @return the double
   */
  @Override
  public double evaluate( DoubleEvaluator engine, FunctionNode function ) {
    if ( function.size() != 3 ) {
      throw new ArithmeticException( "SetFunction#evaluate(DoubleEvaluator,FunctionNode) needs 2 arguments: " + function.toString() );
    }
    if ( !(function.getNode( 1 ) instanceof SymbolNode) ) {
      throw new ArithmeticException( "SetFunction#evaluate(DoubleEvaluator,FunctionNode) symbol required on the left hand side: " + function.toString() );
    }
    String variableName = ((SymbolNode) function.getNode( 1 )).getString();
    double result = engine.evaluateNode( function.getNode( 2 ) );
    IDoubleValue dv = engine.getVariable( variableName );
    if ( dv == null ) {
      dv = new DoubleVariable( result );
    }
    else {
      dv.setValue( result );
    }
    engine.defineVariable( variableName, dv );
    return result;
  }
}
origin: org.refcodes/refcodes-criteria

Object obj = FUNCTION_BOOLEAN_MAP.get( symbol );
if ( obj instanceof IBooleanBoolean1Function ) {
  return ((IBooleanBoolean1Function) obj).evaluate( evaluateNodeLogical( functionNode.getNode( 1 ) ) );
Object obj = FUNCTION_BOOLEAN_MAP.get( symbol );
if ( obj instanceof IBooleanDouble2Function ) {
  return ((IBooleanDouble2Function) obj).evaluate( evaluateNode( functionNode.getNode( 1 ) ), evaluateNode( functionNode.getNode( 2 ) ) );
  return ((IBooleanBoolean2Function) obj).evaluate( evaluateNodeLogical( functionNode.getNode( 1 ) ), evaluateNodeLogical( functionNode.getNode( 2 ) ) );
origin: org.appdapter/ext.bundle.math.symja_jas

/**
 * Parse the given <code>expression String</code> and evaluate it to a double
 * value
 * 
 * @param expression
 * @return
 * @throws SyntaxError
 */
public double evaluate(String expression) {
 Parser p = new Parser();
 fNode = p.parse(expression);
 if (fNode instanceof FunctionNode) {
  fNode = optimizeFunction((FunctionNode) fNode);
 }
 return evaluateNode(fNode);
}
origin: axkr/symja_android_library

  functionNode.set(i, new DoubleNode(((NumberNode) functionNode.getNode(i)).doubleValue()));
} else if (functionNode.getNode(i) instanceof FunctionNode) {
  ASTNode optNode = optimizeFunction((FunctionNode) functionNode.getNode(i));
  if (!(optNode instanceof DoubleNode)) {
    doubleOnly = false;
  return new DoubleNode(evaluateFunction(functionNode));
} catch (Exception e) {
origin: org.refcodes/refcodes-criteria

DoubleEvaluator engine = new DoubleEvaluator();
double d = engine.evaluate( strEval );
return Double.toString( d );
origin: org.refcodes/refcodes-criteria

/**
 * Parse the given <code>expression String</code> and store the resulting
 * ASTNode in this DoubleEvaluator.
 * 
 * @param expression the expression
 * @return the AST node
 * @throws SyntaxError the syntax error
 */
public ASTNode parse( String expression ) {
  Parser p = new Parser();
  fNode = p.parse( expression );
  if ( fNode instanceof FunctionNode ) {
    fNode = optimizeFunction( (FunctionNode) fNode );
  }
  return fNode;
}
origin: org.refcodes/refcodes-criteria

/**
 * Evaluate node logical.
 * 
 * @param node the node
 * @return a boolean.
 */
public boolean evaluateNodeLogical( final ASTNode node ) {
  if ( node instanceof FunctionNode ) {
    return evaluateFunctionLogical( (FunctionNode) node );
  }
  if ( node instanceof SymbolNode ) {
    BooleanVariable v = fBooleanVariables.get( node.toString() );
    if ( v != null ) {
      return v.getValue();
    }
    Boolean boole = SYMBOL_BOOLEAN_MAP.get( node.toString() );
    if ( boole != null ) {
      return boole.booleanValue();
    }
  }
  throw new ArithmeticException( "EvalDouble#evaluateNodeLogical(ASTNode) not possible for: " + node.toString() );
}
origin: org.refcodes/refcodes-criteria

return evaluateFunction( (FunctionNode) node );
origin: axkr/symja_android_library

  @Override
  public double evaluate(DoubleEvaluator engine, FunctionNode function) {
    if (function.size() != 3) {
      throw new ArithmeticMathException(
          "SetFunction#evaluate(DoubleEvaluator,FunctionNode) needs 2 arguments: " + function.toString());
    }
    if (!(function.getNode(1) instanceof SymbolNode)) {
      throw new ArithmeticMathException(
          "SetFunction#evaluate(DoubleEvaluator,FunctionNode) symbol required on the left hand side: "
              + function.toString());
    }
    String variableName = ((SymbolNode) function.getNode(1)).getString();
    double result = engine.evaluateNode(function.getNode(2));
    IDoubleValue dv = engine.getVariable(variableName);
    if (dv == null) {
      dv = new DoubleVariable(result);
    } else {
      dv.setValue(result);
    }
    engine.defineVariable(variableName, dv);
    return result;
  }
}
org.matheclipse.parser.client.evalDoubleEvaluator

Javadoc

Evaluate math expressions to double numbers.

Most used methods

  • <init>
  • defineVariable
    Define a value for a given variable name.
  • evaluateFunction
    Evaluate an already parsed in FunctionNode into asouble number value.
  • evaluateFunctionLogical
    Evaluate function logical.
  • evaluateNode
    Evaluate an already parsed in abstract syntax tree node into adouble number value.
  • evaluateNodeLogical
    Evaluate node logical.
  • getVariable
    Returns the double variable value to which the specified variableName is mapped, or null if this map
  • getVariables
    Get the variable names from the given AST node.
  • optimizeFunction
    Optimize an already parsed in functionNode into anASTNode.
  • parse
    Parse the given expression String and store the resulting ASTNode in this DoubleEvaluator
  • evaluate
    Parse the given expression String and evaluate it to a double value
  • derivative
    TODO: add more derivation rules
  • evaluate,
  • derivative,
  • getDerivativeResult,
  • isSymbol

Popular in Java

  • Running tasks concurrently on multiple threads
  • putExtra (Intent)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • setContentView (Activity)
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • List (java.util)
    A List is a collection which maintains an ordering for its elements. Every element in the List has a
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement.A servlet is a small Java program that runs within
  • JFileChooser (javax.swing)
  • JFrame (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now