Example #1
0
  public Object power(Number d, Complex c) {
    Complex base = new Complex(d.doubleValue(), 0.0);
    Complex temp = base.power(c);

    if (temp.im() == 0) return new Double(temp.re());
    else return temp;
  }
Example #2
0
 public Complex sub(Number d, Complex c) {
   return new Complex(d.doubleValue() - c.re(), -c.im());
 }
Example #3
0
 public Complex sub(Complex c, Number d) {
   return new Complex(c.re() - d.doubleValue(), c.im());
 }
Example #4
0
 public Double sub(Number d1, Number d2) {
   return new Double(d1.doubleValue() - d2.doubleValue());
 }
Example #5
0
  public Object power(Complex c, Number d) {
    Complex temp = c.power(d.doubleValue());

    if (temp.im() == 0) return new Double(temp.re());
    else return temp;
  }
Example #6
0
 public Object power(Number d1, Number d2) {
   if (d1.doubleValue() < 0 && d2.doubleValue() != d2.intValue()) {
     Complex c = new Complex(d1.doubleValue(), 0.0);
     return c.power(d2.doubleValue());
   } else return new Double(Math.pow(d1.doubleValue(), d2.doubleValue()));
 }