View Javadoc
1   /*
2    * Licensed to the Hipparchus project under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The Hipparchus project licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      https://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.hipparchus.special.elliptic.legendre;
18  
19  import org.hipparchus.analysis.CalculusFieldUnivariateFunction;
20  import org.hipparchus.analysis.integration.IterativeLegendreFieldGaussIntegrator;
21  import org.hipparchus.complex.FieldComplex;
22  import org.hipparchus.complex.FieldComplexUnivariateIntegrator;
23  import org.hipparchus.util.Binary64;
24  import org.hipparchus.util.Binary64Field;
25  
26  public class LegendreEllipticIntegralFieldComplexTest extends LegendreEllipticIntegralAbstractComplexTest<FieldComplex<Binary64>> {
27  
28      private FieldComplexUnivariateIntegrator<Binary64> integrator() {
29          return new FieldComplexUnivariateIntegrator<>(new IterativeLegendreFieldGaussIntegrator<>(Binary64Field.getInstance(),
30                                                                                                    24,
31                                                                                                    1.0e-6,
32                                                                                                    1.0e-6));
33      }
34  
35      protected FieldComplex<Binary64> buildComplex(double realPart) {
36          return new FieldComplex<>(new Binary64(realPart));
37      }
38  
39      protected FieldComplex<Binary64> buildComplex(double realPart, double imaginaryPart) {
40          return new FieldComplex<>(new Binary64(realPart), new Binary64(imaginaryPart));
41      }
42  
43      protected FieldComplex<Binary64> K(FieldComplex<Binary64> m) {
44          return LegendreEllipticIntegral.bigK(m);
45      }
46  
47      protected FieldComplex<Binary64> Kprime(FieldComplex<Binary64> m) {
48          return LegendreEllipticIntegral.bigKPrime(m);
49      }
50  
51      protected FieldComplex<Binary64> F(FieldComplex<Binary64> phi, FieldComplex<Binary64> m) {
52          return LegendreEllipticIntegral.bigF(phi, m);
53      }
54  
55      protected FieldComplex<Binary64> integratedF(FieldComplex<Binary64> phi, FieldComplex<Binary64> m) {
56          return LegendreEllipticIntegral.bigF(phi, m, integrator(), 100000);
57      }
58  
59      protected FieldComplex<Binary64> E(FieldComplex<Binary64> m) {
60          return LegendreEllipticIntegral.bigE(m);
61      }
62  
63      protected FieldComplex<Binary64> E(FieldComplex<Binary64> phi, FieldComplex<Binary64> m) {
64          return LegendreEllipticIntegral.bigE(phi, m);
65      }
66  
67      protected FieldComplex<Binary64> integratedE(FieldComplex<Binary64> phi, FieldComplex<Binary64> m) {
68          return LegendreEllipticIntegral.bigE(phi, m, integrator(), 100000);
69      }
70  
71      protected FieldComplex<Binary64> D(FieldComplex<Binary64> m) {
72          return LegendreEllipticIntegral.bigD(m);
73      }
74  
75      protected FieldComplex<Binary64> D(FieldComplex<Binary64> phi, FieldComplex<Binary64> m) {
76          return LegendreEllipticIntegral.bigD(phi, m);
77      }
78  
79      protected FieldComplex<Binary64> Pi(FieldComplex<Binary64> n, FieldComplex<Binary64> m) {
80          return LegendreEllipticIntegral.bigPi(n, m);
81      }
82  
83      protected FieldComplex<Binary64> Pi(FieldComplex<Binary64> n, FieldComplex<Binary64> phi, FieldComplex<Binary64> m) {
84          return LegendreEllipticIntegral.bigPi(n, phi, m);
85      }
86  
87      protected FieldComplex<Binary64> integratedPi(FieldComplex<Binary64> n, FieldComplex<Binary64> phi, FieldComplex<Binary64> m) {
88          return LegendreEllipticIntegral.bigPi(n, phi, m, integrator(), 100000);
89      }
90  
91      protected FieldComplex<Binary64> integrate(int maxEval, CalculusFieldUnivariateFunction<FieldComplex<Binary64>> f,
92                                                  FieldComplex<Binary64> start, FieldComplex<Binary64> end) {
93          return integrator().integrate(maxEval, f, start, end);
94      }
95  
96      @SuppressWarnings("unchecked")
97      protected FieldComplex<Binary64> integrate(int maxEval, CalculusFieldUnivariateFunction<FieldComplex<Binary64>> f,
98                                                  FieldComplex<Binary64> start, FieldComplex<Binary64> middle, FieldComplex<Binary64> end) {
99          return integrator().integrate(maxEval, f, start, middle, end);
100     }
101 
102 }