Examples of PyComplex


Examples of org.python.core.PyComplex

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

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

Examples of org.python.core.PyComplex

        r.imag = l * Math.sin(x.imag);
        return (r);
    }

    public static PyComplex log(PyObject in) {
        PyComplex r = new PyComplex(0.0, 0.0);
        PyComplex x = complexFromPyObject(in);
        r.imag = Math.atan2(x.imag, x.real);
        r.real = Math.log(hypot(x.real, x.imag));
        return (r);
    }
View Full Code Here

Examples of org.python.core.PyComplex

        r.real = Math.log(hypot(x.real, x.imag));
        return (r);
    }

    public static PyComplex log10(PyObject in) {
        PyComplex r = new PyComplex(0.0, 0.0);
        PyComplex x = complexFromPyObject(in);
        double l = hypot(x.real, x.imag);
        r.imag = Math.atan2(x.imag, x.real) / Math.log(10.0);
        r.real = math.log10(new PyFloat(l));
        return (r);
    }
View Full Code Here

Examples of org.python.core.PyComplex

    public static PyComplex log(PyObject in, PyObject base) {
        return log(complexFromPyObject(in), base.asDouble());
    }
   
    public static PyComplex log(PyComplex x, double base) {
        PyComplex r = new PyComplex(0.0, 0.0);
        double l = hypot(x.real, x.imag);
        double log_base = Math.log(base);
        r.imag = Math.atan2(x.imag, x.real) / log_base;
        r.real = math.log(new PyFloat(l)) / log_base;
        return (r);
View Full Code Here

Examples of org.python.core.PyComplex

        r.real = math.log(new PyFloat(l)) / log_base;
        return (r);
    }

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

Examples of org.python.core.PyComplex

        r.imag = Math.cos(x.real) * math.sinh(x.imag);
        return (r);
    }

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

Examples of org.python.core.PyComplex

        r.imag = Math.sin(x.imag) * math.cosh(x.real);
        return (r);
    }

    public static PyComplex sqrt(PyObject in) {
        PyComplex x = complexFromPyObject(in);
        PyComplex r = new PyComplex(0.0, 0.0);

        if ((x.real != 0.0) || (x.imag != 0.0)) {
            double s = Math
                    .sqrt(0.5 * (Math.abs(x.real) + hypot(x.real, x.imag)));
            double d = 0.5 * x.imag / s;
View Full Code Here

Examples of org.python.core.PyComplex

        }
        return (r);
    }

    public static PyComplex tan(PyObject in) {
        PyComplex x = complexFromPyObject(in);
        PyComplex r = new PyComplex(0.0, 0.0);

        double sr = Math.sin(x.real);
        double cr = Math.cos(x.real);
        double shi = math.sinh(x.imag);
        double chi = math.cosh(x.imag);
View Full Code Here

Examples of org.python.core.PyComplex

        return (r);
    }

    public static PyComplex tanh(PyObject in) {
        PyComplex x = complexFromPyObject(in);
        PyComplex r = new PyComplex(0.0, 0.0);

        double si = Math.sin(x.imag);
        double ci = Math.cos(x.imag);
        double shr = math.sinh(x.real);
        double chr = math.cosh(x.real);
View Full Code Here

Examples of org.python.core.PyComplex

                } else {
                    write_byte(TYPE_FLOAT);
                    write_float((PyFloat) v);
                }
            } else if (v instanceof PyComplex) {
                PyComplex x = (PyComplex) v;
                if (version == CURRENT_VERSION) {
                    write_byte(TYPE_BINARY_COMPLEX);
                    write_binary_float(x.getReal());
                    write_binary_float(x.getImag());
                } else {
                    write_byte(TYPE_COMPLEX);
                    write_float(x.getReal());
                    write_float(x.getImag());
                }
            } else if (v instanceof PyUnicode) {
                write_byte(TYPE_UNICODE);
                String buffer = ((PyUnicode) v).encode("utf-8").toString();
                write_int(buffer.length());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.