Documentation of 'jv.number.PuComplex' Java class
PuComplex ("JavaView Reference Manual")
"JavaView? v5.03.003"
jv.number

Class PuComplex

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable


    public class PuComplex
    extends java.lang.Object
    implements java.lang.Cloneable, java.io.Serializable
    Complex number and basic complex functions.

    Static methods typically allocate a new complex number as return value while non-static methods try to avoid allocations as far as possible.

    Here is a listing with all implemented functions.

     
      set(re, im)        u=(re,im)       with u PuComplex, re, im double
      copy(v)            u=(v.re,v.im)   with u PuComplex, v PuComplex
      add(u,v)           w=u+v           with u PuComplex, v PuComplex or double
      u.add(v)           u+=v            with u PuComplex, v PuComplex or double
      sub(u,v)           w=u-v           with u PuComplex, v PuComplex or double
      u.sub(v)           u-=v            with u PuComplex, v PuComplex or double
      mult(u,v)          w=u*v           with u PuComplex, v PuComplex or double
      u.mult(v)          u*=v            with u PuComplex, v PuComplex or double
      div(u,v)           w=u/v           with u PuComplex, v PuComplex or double
      u.div(v)           u/=v            with u PuComplex, v PuComplex or double
      sqr(u)             w=u*u           with u PuComplex
      u.sqr()            u=u*u           with u PuComplex
      cube(u)            w=u*u*u         with u PuComplex
      u.cube()           u=u*u*u         with u PuComplex
      abs(u)             r=|u|           with u PuComplex
      u.abs()            r=|u|           with u PuComplex
      u.sqrAbs()         r=|u|^2         with u PuComplex
      inv(u)             w=1/u           with u PuComplex
      u.inv()            u=1/u           with u PuComplex
      re(u)              r=re(u)         with u PuComplex
      u.re()             r=re(u)         with u PuComplex
      im(u)              r=im(u)         with u PuComplex
      u.im()             r=im(u)         with u PuComplex
      conj(u)            w=re(u)-i*im(u) with u PuComplex
      u.conj()           u=re(u)-i*im(u) with u PuComplex
      neg(u)             w=-u            with u PuComplex
      u.neg()            u=-u            with u PuComplex
      rot(u, f)          w=u*exp(i*f)    with u PuComplex, f double
      rot(u, f)          u=u*exp(i*f)    with u PuComplex, f double
      rotJ(u)            w=J*u           with u PuComplex
      rotJ()             u=J*u           with u PuComplex
      arg(u)             r=arg(u)        with u PuComplex
      u.arg()            r=arg(u)        with u PuComplex
      argPB(u)           r=argPB(u)      with u PuComplex
      u.argPB()          r=argPB(u)      with u PuComplex
      polarToRect(r,f)   w=r*exp(i*f)    with r double, f double
      exp(u)             w=exp(u)        with u PuComplex
      u.exp()            u=exp(u)        with u PuComplex
      log(u)             w=log(u)        with u PuComplex
      u.log()            u=log(u)        with u PuComplex
      logPB(u)           w=logPB(u)      with u PuComplex
      u.logPB()          u=logPB(u)      with u PuComplex
      sqrt(u)            w=sqrt(u)       with u PuComplex, result with im >= 0.
      u.sqrt()           u=sqrt(u)       with u PuComplex, result with im >= 0.
      pow(u,v)           w=u**v          with u PuComplex, v PuComplex
      pow(u,d)           w=u**d          with u PuComplex, d double
      pow(u,i)           w=u**i          with u PuComplex, i integer
      sin(u)             w=sin(u)        with u PuComplex
      cos(u)             w=cos(u)        with u PuComplex
      sinh(u)            w=sinh(u)       with u PuComplex
      cosh(u)            w=cosh(u)       with u PuComplex
      blend(a, u, b, v)  w=a*u+b*v       with u,v PuComplex, a,b double
      moebius(a, b, c, d, v)  w=(a*u+b)/(c*u+d)  with u PuComplex, a,b,c,d double
      moebius(a, b, c, d, v)  w=(a*u+b)/(c*u+d)  with u PuComplex, a,b,c,d PuComplex
     
    See Also:
    Serialized Form
    Author:
    Konrad Polthier and Ulrich Reitebuch
    Version:
    09.04.07, 2.40 revised (kp) New methods rot(), rotJ, pow(.,int), blend(), moebius().
    04.08.03, 2.30 revised (pl) Added toString method.
    26.09.99, 2.20 revised (kp) Methods set and copy added. Now most methods return 'this'.
    14.06.99, 2.10 revised (kp) isNaN and others added. In case of error function now return NaN etc.
    00.05.99, 2.00 revised (ur) Converted to Java and revisions.
    29.06.98, 1.00 created (kp)
    • Field Detail

      • NEG_ONE

        public static final PuComplex NEG_ONE
      • PI_OVER_4

        public static final PuComplex PI_OVER_4
      • PI3_OVER_4

        public static final PuComplex PI3_OVER_4
      • PI5_OVER_4

        public static final PuComplex PI5_OVER_4
      • PI7_OVER_4

        public static final PuComplex PI7_OVER_4
      • re

        public double re
      • im

        public double im
    • Constructor Detail

      • PuComplex

        public PuComplex()
      • PuComplex

        public PuComplex(double r)
      • PuComplex

        public PuComplex(double aReal,
                         double aImag)
    • Method Detail

      • set

        public PuComplex set(double aReal,
                             double aImag)
        this = (re, im)
      • toString

        public java.lang.String toString()
        Create a string in the form "a+b*i".
        Overrides:
        toString in class java.lang.Object
        Since:
        JavaView 2.90.001
        Author:
        Peter Liepa
        Version:
        29.08.08, 2.00 revised (kp) String has a multiplication star in front of i.
        10.08.03, 1.00 created (pl)
      • isInfinite

        public boolean isInfinite()
      • isNaN

        public boolean isNaN()
      • equals

        public static boolean equals(PuComplex w,
                                     PuComplex z,
                                     double tolerance)
        Compare two complex numbers of (nearly) equality.
        Version:
        21.04.13, 1.50 revised (kp) Changed to 'static' since now access to an instance.
      • equals

        public boolean equals(PuComplex z,
                              double tolerance)
        Compare two complex numbers of (nearly) equality. Calls static method.
      • add

        public PuComplex add(double r)
        this += r.
      • sub

        public PuComplex sub(double r)
        this -= r.
      • mult

        public PuComplex mult(double r)
        this *= r.
      • div

        public static PuComplex div(PuComplex u,
                                    PuComplex v)
        w = u / v

        In case of zero division the following result occurs:

         
         If |v|==0 and u.re==0 then w.re==Double.NaN.
         If |v|==0 and u.re>0 then w.re==Double.POSITIVE_INFINITY.
         If |v|==0 and u.re<0 then w.re==Double.NEGATIVE_INFINITY.
         
        Same handling is taken for imaginary part of u.
      • div

        public static PuComplex div(double r,
                                    PuComplex v)
        w = r / v

        In case of zero division the following result occurs:

        
         If |v|==0 and r==0 then w.re==Double.NaN.
         If |v|==0 and r>0 then w.re==Double.POSITIVE_INFINITY.
         If |v|==0 and r<0 then w.re==Double.NEGATIVE_INFINITY.
         
      • div

        public PuComplex div(PuComplex v)
        this /=v

        In case of zero division the following result occurs:

        
         If |v|==0 and re==0 then re==Double.NaN.
         If |v|==0 and re>0 then re==Double.POSITIVE_INFINITY.
         If |v|==0 and re<0 then re==Double.NEGATIVE_INFINITY.
         
        Same handling is taken for imaginary part of 'this'.
      • div

        public static PuComplex div(PuComplex u,
                                    double r)
        w = u / r

        In case of zero division the following result occurs:

        
         If |r|==0 and re==0 then re==Double.NaN.
         If |r|==0 and re>0 then re==Double.POSITIVE_INFINITY.
         If |r|==0 and re<0 then re==Double.NEGATIVE_INFINITY.
         Same handling is taken for imaginary part of 'this'.
         
      • div

        public PuComplex div(double r)
        this /= r

        In case of zero division the following result occurs:

        
         If |r|==0 and re==0 then re==Double.NaN.
         If |r|==0 and re>0 then re==Double.POSITIVE_INFINITY.
         If |r|==0 and re<0 then re==Double.NEGATIVE_INFINITY.
         Same handling is taken for imaginary part of 'this'.
         
      • cube

        public PuComplex cube()
        u = this**3.
      • abs

        public static double abs(PuComplex u)
        r = |u|
      • abs

        public double abs()
        r = |this|
      • sqrAbs

        public double sqrAbs()
        r = |this|^2
      • inv

        public static PuComplex inv(PuComplex u)
        w = 1./u

        In case of |u|==0 the following result occurs: w = PuComplex(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY)

      • inv

        public PuComplex inv()
        u = 1./this

        In case of |u|==0 the following result occurs: u.re = Double.POSITIVE_INFINITY, u.im = Double.POSITIVE_INFINITY.

      • re

        public static double re(PuComplex u)
        Deprecated. since JavaView 3.97.061, use this.re() instead.
        r = re(u)
      • re

        public double re()
        r = re(this)
      • im

        public static double im(PuComplex u)
        Deprecated. since JavaView 3.97.061, use this.im() instead.
        r = im(u)
      • im

        public double im()
        r = im(this)
      • conj

        public PuComplex conj()
        u = re(this) - i*im(this)
      • rot

        public PuComplex rot(double f)
        u = J(f)*this
      • arg

        public static double arg(PuComplex u)
        r = arg(u) in [0,2Pi), with slit at positive real axis.
      • arg

        public double arg()
        r = arg(this) in [0,2Pi), with slit at positive real axis.
      • argPB

        public static double argPB(PuComplex u)
        r = argPB(u) in [-Pi,Pi), principal branch with slit at negative real axis.
      • argPB

        public double argPB()
        r = argPB(this) in [0,2Pi), principal branch with slit at negative real axis.
      • polarToRect

        public static PuComplex polarToRect(double r,
                                            double f)
        w = r*exp(i*f)
      • logPB

        public static PuComplex logPB(PuComplex u)
        w = logPB(u), principal branch of complex logarithm with slit at negative real axis.

        By definition, logPB is defined on the complex plane slit at the negative real axis, denoted by C-. Thus, the argument is expected to be greater than -π and less or equal than π. Therefore, the given parameter z is considered as an element in C-. This interpretation does not affect the norm, but the argument of z.

        Note that every z with arg(z)>pi will be considered as an element w such that |w| =|z| and arg(w)=arg(z)-2pi;.

        Returns:
        the principal branch of z, i.e. w=logPB(z) = ln|z|+i*arg(z).
      • logPB

        public PuComplex logPB()
        u = logPB(this), principal branch with slit at negative real axis.
      • sqrt

        public PuComplex sqrt()
        u= sqrt(this)
      • pow

        public PuComplex pow(double r)
        u = this**r.
      • pow

        public static PuComplex pow(PuComplex u,
                                    int n)
        w = u**n

        For small integer exponents, including negative exponents. Method avoids transcendental functions and uses float multiplication only.

        Since:
        JavaView 3.97.061
        Version:
        09.04.07, 1.00 created (kp)
      • sinh

        public PuComplex sinh()
        u = sinh(this)
      • cosh

        public PuComplex cosh()
        u = cosh(this)
      • tanh

        public PuComplex tanh()
        u = tanh(this)
      • coth

        public PuComplex coth()
        u = coth(this)
      • blend

        public static PuComplex blend(double a,
                                      PuComplex v,
                                      double b,
                                      PuComplex w)
        Create a new complex number this = a*v + b*w.
        Parameters:
        a - weight of first complex number
        v - first complex number
        b - weight of second complex number
        w - second complex number
        Returns:
        new complex number
        Since:
        JavaView 3.97.061
        Version:
        08.04.07, 1.00 created (kp)
      • moebius

        public static PuComplex moebius(PuComplex a,
                                        PuComplex b,
                                        PuComplex c,
                                        PuComplex d,
                                        PuComplex u)
        Applies Moebius transformation given by complex parameters a,b,c,d to complex argument u.

                             au + b
            w = moebius(u) = ------  with complex a,b,c,d,u.
                             cu + d
         
        Parameters:
        a - complex number
        b - complex number
        c - complex number
        d - complex number
        u - complex number argument
        Returns:
        new complex number
        Since:
        JavaView 3.97.061
        Version:
        09.04.07, 1.00 created (kp)
      • moebius

        public static PuComplex moebius(double a,
                                        double b,
                                        double c,
                                        double d,
                                        PuComplex u)
        Applies Moebius transformation given by real parameters a,b,c,d to complex argument u.

                              au + b
            w = moebius(u) =  ------  with double a,b,c,d and complex u.
                              cu + d
         
        Parameters:
        a - double number
        b - double number
        c - double number
        d - double number
        u - complex number argument
        Returns:
        new complex number
        Since:
        JavaView 3.97.061
        Version:
        09.04.07, 1.00 created (kp)
"JavaView? v5.03.003"

"

The software JavaView? is copyright protected. All Rights Reserved.
"

Ads help maintain this website.