use of org.hipparchus.complex.Complex in project symja_android_library by axkr.
the class EllipticFunctionsJS method weierstrassPPrime.
public static Complex weierstrassPPrime(Complex x, Complex g2, Complex g3) {
// if ( !isComplex(x) ) x = complex(x);
Complex[] sol = weierstrassRoots(g2, g3);
Complex e1 = sol[0];
Complex e2 = sol[1];
Complex e3 = sol[2];
// Whittaker & Watson, Section 22.351
Complex m = e2.subtract(e3).divide(e1.subtract(e3));
Complex argument = x.multiply(e1.subtract(e3).sqrt());
return e1.subtract(e3).pow(1.5).multiply(jacobiCN(argument, m)).multiply(jacobiDN(argument, m)).multiply(jacobiSN(argument, m).pow(-3)).multiply(-2);
}
use of org.hipparchus.complex.Complex in project symja_android_library by axkr.
the class EllipticFunctionsJS method inverseWeierstrassP.
public static Complex inverseWeierstrassP(Complex x, Complex g2, Complex g3) {
Complex[] sol = weierstrassRoots(g2, g3);
Complex e1 = sol[0];
Complex e2 = sol[1];
Complex e3 = sol[2];
return EllipticIntegralsJS.carlsonRF(x.subtract(e1), x.subtract(e2), x.subtract(e3));
}
use of org.hipparchus.complex.Complex in project symja_android_library by axkr.
the class GammaJS method coshIntegral.
public static Complex coshIntegral(Complex x) {
// complex for negative real argument
Complex xNegate = x.negate();
Complex gamma1 = gammaZero(x);
Complex gamma2 = gammaZero(xNegate);
Complex result = gamma1.add(gamma2.add(x.log().negate()).add(xNegate.log())).multiply(-0.5);
return result;
}
use of org.hipparchus.complex.Complex in project symja_android_library by axkr.
the class GammaJS method cosIntegral.
public static Complex cosIntegral(Complex x) {
// complex for negative real argument
Complex ix = Complex.I.multiply(x);
Complex result = x.log().subtract(gammaZero(ix.negate()).add(gammaZero(ix)).add(ix.negate().log()).add(ix.log()).multiply(0.5));
return result;
}
use of org.hipparchus.complex.Complex in project symja_android_library by axkr.
the class GammaJS method logGamma.
public static Complex logGamma(Complex x) {
if (F.isNumIntValue(x.getReal()) && x.getReal() <= 0 && F.isZero(x.getImaginary())) {
throw new ArgumentTypeException("Gamma function pole");
}
// reflection formula with modified Hare correction to imaginary part
if (x.getReal() < 0.0) {
Complex t = new Complex(Math.PI).divide(x.multiply(Math.PI).sin()).log().subtract(logGamma(x.negate().add(1.0)));
double s = x.getImaginary() < 0.0 ? -1.0 : 1.0;
double d = F.isZero(x.getImaginary()) ? 0.25 : 0;
double k = Math.ceil(x.getReal() / 2.0 - 0.75 + d);
return t.add(new Complex(0.0, 2.0 * s * k * Math.PI));
}
Complex t = x.add(5.24218750000000000);
t = x.add(0.5).multiply(t.log()).subtract(t);
Complex s = new Complex(0.999999999999997092);
for (int j = 0; j < 14; j++) {
s = s.add(x.add(j + 1).reciprocal().multiply(c[j]));
}
Complex u = t.add(s.divide(x).multiply(2.5066282746310005).log());
// adjustment to keep imaginary part on same sheet
if (s.getReal() < 0.0) {
if (x.getImaginary() < 0.0 && s.divide(x).getImaginary() < 0) {
u = u.add(new Complex(0.0, Math.PI + Math.PI));
}
if (x.getImaginary() > 0 && s.divide(x).getImaginary() > 0) {
u = u.add(new Complex(0.0, -Math.PI + Math.PI));
}
}
return u;
}
Aggregations