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