Package org.python.core

Examples of org.python.core.PyComplex


    private static PyComplex half = new PyComplex(0.5, 0.0);
    private static PyComplex i = new PyComplex(0.0, 1.0);
    private static PyComplex half_i = new PyComplex(0.0, 0.5);

    private static PyComplex c_prodi(PyComplex x) {
        return (new PyComplex(-x.imag, x.real));
    }
View Full Code Here


            return (PyComplex)newObj;
        }

        // If neither of the above works, interpret op as a float giving the real part of
        // the result, and fill in the imaginary part as 0
        return new PyComplex(obj.asDouble(), 0);
    }
View Full Code Here

        // the result, and fill in the imaginary part as 0
        return new PyComplex(obj.asDouble(), 0);
    }
   
    public static PyObject acos(PyObject in) {
        PyComplex x = complexFromPyObject(in);
        return (c_prodi(log(x.__add__(i
                .__mul__(sqrt(one.__sub__(x.__mul__(x))))))).__neg__());
    }
View Full Code Here

        return (c_prodi(log(x.__add__(i
                .__mul__(sqrt(one.__sub__(x.__mul__(x))))))).__neg__());
    }

    public static PyComplex acosh(PyObject in) {
        PyComplex x = complexFromPyObject(in);
        PyComplex r = null;

        PyComplex a = sqrt(x.__sub__(one));
        PyComplex b = sqrt(x.__add__(one));
        PyComplex c = sqrt(half);
        r = log(c.__mul__(b.__add__(a)));

        return ((PyComplex) r.__add__(r));
    }
View Full Code Here

        return ((PyComplex) r.__add__(r));
    }

    public static PyComplex asin(PyObject in) {
        PyComplex x = complexFromPyObject(in);
        PyComplex r = null;

        PyComplex squared = (PyComplex) x.__mul__(x);
        PyComplex sq1_minus_xsq = sqrt(one.__sub__(squared));

        r = (PyComplex) c_prodi(log(sq1_minus_xsq.__add__(c_prodi(x))))
                .__neg__();
        return (r);
    }
View Full Code Here

                .__neg__();
        return (r);
    }

    public static PyComplex asinh(PyObject in) {
        PyComplex x = complexFromPyObject(in);
        PyComplex r = null;

        PyComplex a = sqrt(x.__add__(i));
        PyComplex b = sqrt(x.__sub__(i));
        PyComplex z = sqrt(half);
        r = log(z.__mul__(a.__add__(b)));

        return ((PyComplex) r.__add__(r));
    }
View Full Code Here

        return ((PyComplex) r.__add__(r));
    }

    public static PyComplex atan(PyObject in) {
        PyComplex x = complexFromPyObject(in);
        PyComplex r = (PyComplex) half_i.__mul__(log(i.__add__(x).__div__(
                i.__sub__(x))));

        return (r);
    }
View Full Code Here

        return (r);
    }

    public static PyComplex atanh(PyObject in) {
        PyComplex x = complexFromPyObject(in);
        PyComplex r = (PyComplex) half.__mul__(log(one.__add__(x).__div__(
                one.__sub__(x))));
        return (r);
    }
View Full Code Here

                one.__sub__(x))));
        return (r);
    }

    public static PyComplex cos(PyObject in) {
        PyComplex x = complexFromPyObject(in);
        PyComplex r = new PyComplex(Math.cos(x.real) * math.cosh(x.imag), -Math
                .sin(x.real)
                * math.sinh(x.imag));
        return (r);
    }
View Full Code Here

                * math.sinh(x.imag));
        return (r);
    }

    public static PyComplex cosh(PyObject in) {
        PyComplex x = complexFromPyObject(in);
        PyComplex r = new PyComplex(Math.cos(x.imag) * math.cosh(x.real), Math
                .sin(x.imag)
                * math.sinh(x.real));
        return (r);
    }
View Full Code Here

TOP

Related Classes of org.python.core.PyComplex

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.