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.jacobi; 18 19 import org.hipparchus.CalculusFieldElement; 20 import org.hipparchus.special.elliptic.legendre.LegendreEllipticIntegral; 21 22 /** Algorithm for computing the principal Jacobi functions for parameter m in [0; 1]. 23 * @param <T> the type of the field elements 24 * @since 2.0 25 */ 26 class FieldBoundedParameter<T extends CalculusFieldElement<T>> extends FieldJacobiElliptic<T> { 27 28 /** Jacobi θ functions. */ 29 private final FieldJacobiTheta<T> jacobiTheta; 30 31 /** Value of Jacobi θ functions at origin. */ 32 private final FieldTheta<T> t0; 33 34 /** Scaling factor. */ 35 private final T scaling; 36 37 /** Simple constructor. 38 * @param m parameter of the Jacobi elliptic function 39 */ 40 FieldBoundedParameter(final T m) { 41 42 super(m); 43 44 // compute nome 45 final T q = LegendreEllipticIntegral.nome(m); 46 47 // prepare underlying Jacobi θ functions 48 this.jacobiTheta = new FieldJacobiTheta<>(q); 49 this.t0 = jacobiTheta.values(m.getField().getZero()); 50 this.scaling = LegendreEllipticIntegral.bigK(m).reciprocal().multiply(m.getPi().multiply(0.5)); 51 52 } 53 54 /** {@inheritDoc} 55 * <p> 56 * The algorithm for evaluating the functions is based on {@link FieldJacobiTheta 57 * Jacobi theta functions}. 58 * </p> 59 */ 60 @Override 61 public FieldCopolarN<T> valuesN(T u) { 62 63 // evaluate Jacobi θ functions at argument 64 final FieldTheta<T> tZ = jacobiTheta.values(u.multiply(scaling)); 65 66 // convert to Jacobi elliptic functions 67 final T sn = t0.theta3().multiply(tZ.theta1()).divide(t0.theta2().multiply(tZ.theta4())); 68 final T cn = t0.theta4().multiply(tZ.theta2()).divide(t0.theta2().multiply(tZ.theta4())); 69 final T dn = t0.theta4().multiply(tZ.theta3()).divide(t0.theta3().multiply(tZ.theta4())); 70 71 return new FieldCopolarN<>(sn, cn, dn); 72 73 } 74 75 }