Exemplo n.º 1
0
 /**
  * Call this function if you want to parse expressions which involve complex numbers. This method
  * specifies "i" as the imaginary unit (0,1). Two functions re() and im() are also added for
  * extracting the real or imaginary components of a complex number respectively.
  *
  * <p>
  *
  * @since 2.3.0 alpha The functions cmod and arg are added to get the modulus and argument.
  * @since 2.3.0 beta 1 The functions complex and polar to convert x,y and r,theta to Complex.
  * @since Feb 05 added complex conjugate conj.
  */
 public void addComplex() {
   // add constants to Symbol Table
   symTab.addConstant("i", new Complex(0, 1));
   funTab.put("re", new Real());
   funTab.put("im", new Imaginary());
   funTab.put("arg", new Arg());
   funTab.put("cmod", new Abs());
   funTab.put("complex", new ComplexPFMC());
   funTab.put("polar", new Polar());
   funTab.put("conj", new Conjugate());
 }
Exemplo n.º 2
0
 /**
  * Adds a constant. This is a variable whose value cannot be changed.
  *
  * @since 2.3.0 beta 1
  */
 public void addConstant(String name, Object value) {
   symTab.addConstant(name, value);
 }
Exemplo n.º 3
0
 /**
  * Adds the constants pi and e to the parser. As addStandardFunctions(), this method should be
  * called immediately after the JEP object is created.
  */
 public void addStandardConstants() {
   // add constants to Symbol Table
   symTab.addConstant("pi", new Double(Math.PI));
   symTab.addConstant("e", new Double(Math.E));
 }