1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.hipparchus.special.elliptic.jacobi;
18
19 import org.hipparchus.complex.Complex;
20 import org.hipparchus.special.elliptic.legendre.LegendreEllipticIntegral;
21 import org.hipparchus.util.FastMath;
22 import org.hipparchus.util.MathUtils;
23
24
25
26
27 class ComplexParameter extends FieldJacobiElliptic<Complex> {
28
29
30 private final FieldJacobiTheta<Complex> jacobiTheta;
31
32
33 private final Complex bigK;
34
35
36 private final Complex iBigKPrime;
37
38
39 private final double rK;
40
41
42 private final double iK;
43
44
45 private final double rKPrime;
46
47
48 private final double iKPrime;
49
50
51 private final FieldTheta<Complex> t0;
52
53
54 private final Complex scaling;
55
56
57
58
59 ComplexParameter(final Complex m) {
60
61 super(m);
62
63
64 final Complex q = LegendreEllipticIntegral.nome(m);
65
66
67
68 bigK = LegendreEllipticIntegral.bigK(m);
69 iBigKPrime = LegendreEllipticIntegral.bigKPrime(m).multiplyPlusI();
70 final double inverse = 0.25 /
71 (bigK.getRealPart() * iBigKPrime.getImaginaryPart() -
72 bigK.getImaginaryPart() * iBigKPrime.getRealPart());
73 this.rK = iBigKPrime.getImaginaryPart() * inverse;
74 this.iK = iBigKPrime.getRealPart() * -inverse;
75 this.rKPrime = bigK.getImaginaryPart() * -inverse;
76 this.iKPrime = bigK.getRealPart() * inverse;
77
78
79 this.jacobiTheta = new FieldJacobiTheta<>(q);
80 this.t0 = jacobiTheta.values(m.getField().getZero());
81 this.scaling = bigK.reciprocal().multiply(MathUtils.SEMI_PI);
82
83 }
84
85
86
87
88
89
90
91 @Override
92 public FieldCopolarN<Complex> valuesN(Complex u) {
93
94
95 final double cK = rK * u.getRealPart() + iK * u.getImaginaryPart();
96 final double cKPrime = rKPrime * u.getRealPart() + iKPrime * u.getImaginaryPart();
97 final Complex reducedU = u.linearCombination(1.0, u,
98 -4 * FastMath.rint(cK), bigK,
99 -4 * FastMath.rint(cKPrime), iBigKPrime);
100
101
102 final FieldTheta<Complex> tZ = jacobiTheta.values(reducedU.multiply(scaling));
103
104
105 final Complex sn = t0.theta3().multiply(tZ.theta1()).divide(t0.theta2().multiply(tZ.theta4()));
106 final Complex cn = t0.theta4().multiply(tZ.theta2()).divide(t0.theta2().multiply(tZ.theta4()));
107 final Complex dn = t0.theta4().multiply(tZ.theta3()).divide(t0.theta3().multiply(tZ.theta4()));
108
109 return new FieldCopolarN<>(sn, cn, dn);
110
111 }
112
113 }