Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.singularsys.jep.functions
Class Power

    java.lang.Object
      com.singularsys.jep.functions.PostfixMathCommand
          com.singularsys.jep.functions.Power

All Implemented Interfaces:
  PostfixMathCommandI, RealBinaryFunction, java.io.Serializable

    public class Power

extends PostfixMathCommand
implements RealBinaryFunction

Computes the power of an number. Implements a fast algorithm for integer powers by Patricia Shanahan pats@acm.org.

Author:
  N Funk, R Morris, Patricia Shanahan
See Also:
  Serialized Form

Field Summary

Fields inherited from class com.singularsys.jep.functions.PostfixMathCommand
`curNumberOfParameters, numberOfParameters`

Constructor Summary
`Power()`

Method Summary
`double` | `evaluate(double l, double r)`
`java.lang.Object` | `power(Complex c1, Complex c2)`
`java.lang.Object` | `power(Complex c, java.lang.Number d)`
`double` | `power(double x, int n)` A fast routine for computing integer powers.
`java.lang.Object` | `power(java.lang.Number d, Complex c)`
`java.lang.Object` | `power(java.lang.Number d1, java.lang.Number d2)`
`java.lang.Object` | `power(java.lang.Object param1, java.lang.Object param2)`
`void` | `run(java.util.Stack<java.lang.Object> inStack)` Run the function on the stack.

Methods inherited from class com.singularsys.jep.functions.PostfixMathCommand
`checkNumberOfParameters, checkStack, getNumberOfParameters, setCurNumberOfParameters`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Power

    public Power()

Method Detail

### run

    public void run(java.util.Stack<java.lang.Object> inStack)
             throws EvaluationException

  Description copied from interface: `PostfixMathCommandI`
  Run the function on the stack. Pops the arguments from the stack, and pushes the result on the top of the stack.

  Specified by:
    `run` in interface `PostfixMathCommandI`
  Throws:
    `EvaluationException`

### power

    public java.lang.Object power(java.lang.Object param1,
                                  java.lang.Object param2)
                           throws EvaluationException

  Throws:
    `EvaluationException`

### power

    public java.lang.Object power(java.lang.Number d1,
                                  java.lang.Number d2)

### power

    public java.lang.Object power(Complex c1,
                                  Complex c2)

### power

    public java.lang.Object power(Complex c,
                                  java.lang.Number d)

### power

    public java.lang.Object power(java.lang.Number d,
                                  Complex c)

### power

    public double power(double x,
                        int n)

  A fast routine for computing integer powers. Code adapted from efficient power by Patricia Shanahan pats@acm.org Almost identical to the method Knuth gives on page 462 of The Art of Computer Programming Volume 2 Seminumerical Algorithms.

  Parameters:
    `x` - number to be taken to a power.
    `n` - power to take x to. 0 <= n <= Integer.MAX_VALUE Negative numbers will be treated as unsigned positives.
  Returns:
    x to the power n

### evaluate

    public double evaluate(double l,
                           double r)

  Specified by:
    `evaluate` in interface `RealBinaryFunction`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008 Singular Systems http://www.singularsys.com/jep