Java Code Examples for org.apache.commons.math3.util.FastMath#cosh()
The following examples show how to use
org.apache.commons.math3.util.FastMath#cosh() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DSCompiler.java From astor with GNU General Public License v2.0 | 6 votes |
/** Compute hyperbolic sine of a derivative structure. * @param operand array holding the operand * @param operandOffset offset of the operand in its array * @param result array where result must be stored (for * hyperbolic sine the result array <em>cannot</em> be the input * array) * @param resultOffset offset of the result in its array */ public void sinh(final double[] operand, final int operandOffset, final double[] result, final int resultOffset) { // create the function value and derivatives double[] function = new double[1 + order]; function[0] = FastMath.sinh(operand[operandOffset]); if (order > 0) { function[1] = FastMath.cosh(operand[operandOffset]); for (int i = 2; i <= order; ++i) { function[i] = function[i - 2]; } } // apply function composition compose(operand, operandOffset, function, result, resultOffset); }
Example 2
Source File: Math_10_DSCompiler_t.java From coming with MIT License | 6 votes |
/** Compute hyperbolic sine of a derivative structure. * @param operand array holding the operand * @param operandOffset offset of the operand in its array * @param result array where result must be stored (for * hyperbolic sine the result array <em>cannot</em> be the input * array) * @param resultOffset offset of the result in its array */ public void sinh(final double[] operand, final int operandOffset, final double[] result, final int resultOffset) { // create the function value and derivatives double[] function = new double[1 + order]; function[0] = FastMath.sinh(operand[operandOffset]); if (order > 0) { function[1] = FastMath.cosh(operand[operandOffset]); for (int i = 2; i <= order; ++i) { function[i] = function[i - 2]; } } // apply function composition compose(operand, operandOffset, function, result, resultOffset); }
Example 3
Source File: DSCompiler.java From astor with GNU General Public License v2.0 | 6 votes |
/** Compute hyperbolic sine of a derivative structure. * @param operand array holding the operand * @param operandOffset offset of the operand in its array * @param result array where result must be stored (for * hyperbolic sine the result array <em>cannot</em> be the input * array) * @param resultOffset offset of the result in its array */ public void sinh(final double[] operand, final int operandOffset, final double[] result, final int resultOffset) { // create the function value and derivatives double[] function = new double[1 + order]; function[0] = FastMath.sinh(operand[operandOffset]); if (order > 0) { function[1] = FastMath.cosh(operand[operandOffset]); for (int i = 2; i <= order; ++i) { function[i] = function[i - 2]; } } // apply function composition compose(operand, operandOffset, function, result, resultOffset); }
Example 4
Source File: DSCompiler.java From astor with GNU General Public License v2.0 | 6 votes |
/** Compute hyperbolic cosine of a derivative structure. * @param operand array holding the operand * @param operandOffset offset of the operand in its array * @param result array where result must be stored (for * hyperbolic cosine the result array <em>cannot</em> be the input * array) * @param resultOffset offset of the result in its array */ public void cosh(final double[] operand, final int operandOffset, final double[] result, final int resultOffset) { // create the function value and derivatives double[] function = new double[1 + order]; function[0] = FastMath.cosh(operand[operandOffset]); if (order > 0) { function[1] = FastMath.sinh(operand[operandOffset]); for (int i = 2; i <= order; ++i) { function[i] = function[i - 2]; } } // apply function composition compose(operand, operandOffset, function, result, resultOffset); }
Example 5
Source File: Arja_0033_s.java From coming with MIT License | 4 votes |
/** * Compute the * <a href="http://mathworld.wolfram.com/HyperbolicTangent.html" TARGET="_top"> * hyperbolic tangent</a> of this complex number. * Implements the formula: * <pre> * <code> * tan(a + bi) = sinh(2a)/(cosh(2a)+cos(2b)) + [sin(2b)/(cosh(2a)+cos(2b))]i * </code> * </pre> * where the (real) functions on the right-hand side are * {@link FastMath#sin}, {@link FastMath#cos}, {@link FastMath#cosh} and * {@link FastMath#sinh}. * <br/> * Returns {@link Complex#NaN} if either real or imaginary part of the * input argument is {@code NaN}. * <br/> * Infinite values in real or imaginary parts of the input may result in * infinite or NaN values returned in parts of the result. * <pre> * Examples: * <code> * tanh(a ± INFINITY i) = NaN + NaN i * tanh(±INFINITY + bi) = ±1 + 0 i * tanh(±INFINITY ± INFINITY i) = NaN + NaN i * tanh(0 + (π/2)i) = NaN + INFINITY i * </code> * </pre> * * @return the hyperbolic tangent of {@code this}. * @since 1.2 */ public Complex tanh() { if (isNaN || Double.isInfinite(imaginary)) { return NaN; } if (real > 20.0) { return createComplex(1.0, 0.0); } if (real < -20.0) { return createComplex(-1.0, 0.0); } double real2 = 2.0 * real; double imaginary2 = 2.0 * imaginary; double d = FastMath.cosh(real2) + FastMath.cos(imaginary2); return createComplex(FastMath.sinh(real2) / d, FastMath.sin(imaginary2) / d); }
Example 6
Source File: Cosh.java From astor with GNU General Public License v2.0 | 4 votes |
/** {@inheritDoc} */ public double value(double x) { return FastMath.cosh(x); }
Example 7
Source File: Math_5_Complex_t.java From coming with MIT License | 4 votes |
/** * Compute the * <a href="http://mathworld.wolfram.com/HyperbolicTangent.html" TARGET="_top"> * hyperbolic tangent</a> of this complex number. * Implements the formula: * <pre> * <code> * tan(a + bi) = sinh(2a)/(cosh(2a)+cos(2b)) + [sin(2b)/(cosh(2a)+cos(2b))]i * </code> * </pre> * where the (real) functions on the right-hand side are * {@link FastMath#sin}, {@link FastMath#cos}, {@link FastMath#cosh} and * {@link FastMath#sinh}. * <br/> * Returns {@link Complex#NaN} if either real or imaginary part of the * input argument is {@code NaN}. * <br/> * Infinite values in real or imaginary parts of the input may result in * infinite or NaN values returned in parts of the result. * <pre> * Examples: * <code> * tanh(a ± INFINITY i) = NaN + NaN i * tanh(±INFINITY + bi) = ±1 + 0 i * tanh(±INFINITY ± INFINITY i) = NaN + NaN i * tanh(0 + (π/2)i) = NaN + INFINITY i * </code> * </pre> * * @return the hyperbolic tangent of {@code this}. * @since 1.2 */ public Complex tanh() { if (isNaN || Double.isInfinite(imaginary)) { return NaN; } if (real > 20.0) { return createComplex(1.0, 0.0); } if (real < -20.0) { return createComplex(-1.0, 0.0); } double real2 = 2.0 * real; double imaginary2 = 2.0 * imaginary; double d = FastMath.cosh(real2) + FastMath.cos(imaginary2); return createComplex(FastMath.sinh(real2) / d, FastMath.sin(imaginary2) / d); }
Example 8
Source File: Cosh.java From astor with GNU General Public License v2.0 | 4 votes |
/** {@inheritDoc} */ public double value(double x) { return FastMath.cosh(x); }
Example 9
Source File: Math_5_Complex_t.java From coming with MIT License | 4 votes |
/** * Compute the * <a href="http://mathworld.wolfram.com/Tangent.html" TARGET="_top"> * tangent</a> of this complex number. * Implements the formula: * <pre> * <code> * tan(a + bi) = sin(2a)/(cos(2a)+cosh(2b)) + [sinh(2b)/(cos(2a)+cosh(2b))]i * </code> * </pre> * where the (real) functions on the right-hand side are * {@link FastMath#sin}, {@link FastMath#cos}, {@link FastMath#cosh} and * {@link FastMath#sinh}. * <br/> * Returns {@link Complex#NaN} if either real or imaginary part of the * input argument is {@code NaN}. * <br/> * Infinite (or critical) values in real or imaginary parts of the input may * result in infinite or NaN values returned in parts of the result. * <pre> * Examples: * <code> * tan(a ± INFINITY i) = 0 ± i * tan(±INFINITY + bi) = NaN + NaN i * tan(±INFINITY ± INFINITY i) = NaN + NaN i * tan(±π/2 + 0 i) = ±INFINITY + NaN i * </code> * </pre> * * @return the tangent of {@code this}. * @since 1.2 */ public Complex tan() { if (isNaN || Double.isInfinite(real)) { return NaN; } if (imaginary > 20.0) { return createComplex(0.0, 1.0); } if (imaginary < -20.0) { return createComplex(0.0, -1.0); } double real2 = 2.0 * real; double imaginary2 = 2.0 * imaginary; double d = FastMath.cos(real2) + FastMath.cosh(imaginary2); return createComplex(FastMath.sin(real2) / d, FastMath.sinh(imaginary2) / d); }
Example 10
Source File: Complex.java From astor with GNU General Public License v2.0 | 4 votes |
/** * Compute the * <a href="http://mathworld.wolfram.com/HyperbolicTangent.html" TARGET="_top"> * hyperbolic tangent</a> of this complex number. * Implements the formula: * <pre> * <code> * tan(a + bi) = sinh(2a)/(cosh(2a)+cos(2b)) + [sin(2b)/(cosh(2a)+cos(2b))]i * </code> * </pre> * where the (real) functions on the right-hand side are * {@link FastMath#sin}, {@link FastMath#cos}, {@link FastMath#cosh} and * {@link FastMath#sinh}. * <br/> * Returns {@link Complex#NaN} if either real or imaginary part of the * input argument is {@code NaN}. * <br/> * Infinite values in real or imaginary parts of the input may result in * infinite or NaN values returned in parts of the result. * <pre> * Examples: * <code> * tanh(a ± INFINITY i) = NaN + NaN i * tanh(±INFINITY + bi) = ±1 + 0 i * tanh(±INFINITY ± INFINITY i) = NaN + NaN i * tanh(0 + (π/2)i) = NaN + INFINITY i * </code> * </pre> * * @return the hyperbolic tangent of {@code this}. * @since 1.2 */ public Complex tanh() { if (isNaN || Double.isInfinite(imaginary)) { return NaN; } if (real > 20.0) { return createComplex(1.0, 0.0); } if (real < -20.0) { return createComplex(-1.0, 0.0); } double real2 = 2.0 * real; double imaginary2 = 2.0 * imaginary; double d = FastMath.cosh(real2) + FastMath.cos(imaginary2); return createComplex(FastMath.sinh(real2) / d, FastMath.sin(imaginary2) / d); }
Example 11
Source File: Arja_0033_t.java From coming with MIT License | 4 votes |
/** * Compute the * <a href="http://mathworld.wolfram.com/Tangent.html" TARGET="_top"> * tangent</a> of this complex number. * Implements the formula: * <pre> * <code> * tan(a + bi) = sin(2a)/(cos(2a)+cosh(2b)) + [sinh(2b)/(cos(2a)+cosh(2b))]i * </code> * </pre> * where the (real) functions on the right-hand side are * {@link FastMath#sin}, {@link FastMath#cos}, {@link FastMath#cosh} and * {@link FastMath#sinh}. * <br/> * Returns {@link Complex#NaN} if either real or imaginary part of the * input argument is {@code NaN}. * <br/> * Infinite (or critical) values in real or imaginary parts of the input may * result in infinite or NaN values returned in parts of the result. * <pre> * Examples: * <code> * tan(a ± INFINITY i) = 0 ± i * tan(±INFINITY + bi) = NaN + NaN i * tan(±INFINITY ± INFINITY i) = NaN + NaN i * tan(±π/2 + 0 i) = ±INFINITY + NaN i * </code> * </pre> * * @return the tangent of {@code this}. * @since 1.2 */ public Complex tan() { if (isNaN || Double.isInfinite(real)) { return NaN; } if (imaginary > 20.0) { return createComplex(0.0, 1.0); } if (imaginary < -20.0) { return createComplex(0.0, -1.0); } double real2 = 2.0 * real; double imaginary2 = 2.0 * imaginary; double d = FastMath.cos(real2) + FastMath.cosh(imaginary2); return createComplex(FastMath.sin(real2) / d, FastMath.sinh(imaginary2) / d); }
Example 12
Source File: LibSpoofPrimitives.java From systemds with Apache License 2.0 | 4 votes |
public static double[] vectCoshWrite(double[] a, int ai, int len) { double[] c = allocVector(len, false); for( int j = 0; j < len; j++, ai++) c[j] = FastMath.cosh(a[ai]); return c; }
Example 13
Source File: JGenProg2015_005_t.java From coming with MIT License | 4 votes |
/** * Compute the * <a href="http://mathworld.wolfram.com/HyperbolicTangent.html" TARGET="_top"> * hyperbolic tangent</a> of this complex number. * Implements the formula: * <pre> * <code> * tan(a + bi) = sinh(2a)/(cosh(2a)+cos(2b)) + [sin(2b)/(cosh(2a)+cos(2b))]i * </code> * </pre> * where the (real) functions on the right-hand side are * {@link FastMath#sin}, {@link FastMath#cos}, {@link FastMath#cosh} and * {@link FastMath#sinh}. * <br/> * Returns {@link Complex#NaN} if either real or imaginary part of the * input argument is {@code NaN}. * <br/> * Infinite values in real or imaginary parts of the input may result in * infinite or NaN values returned in parts of the result. * <pre> * Examples: * <code> * tanh(a ± INFINITY i) = NaN + NaN i * tanh(±INFINITY + bi) = ±1 + 0 i * tanh(±INFINITY ± INFINITY i) = NaN + NaN i * tanh(0 + (π/2)i) = NaN + INFINITY i * </code> * </pre> * * @return the hyperbolic tangent of {@code this}. * @since 1.2 */ public Complex tanh() { if (isNaN || Double.isInfinite(imaginary)) { return NaN; } if (real > 20.0) { return createComplex(1.0, 0.0); } if (real < -20.0) { return createComplex(-1.0, 0.0); } double real2 = 2.0 * real; double imaginary2 = 2.0 * imaginary; double d = FastMath.cosh(real2) + FastMath.cos(imaginary2); return createComplex(FastMath.sinh(real2) / d, FastMath.sin(imaginary2) / d); }
Example 14
Source File: Complex.java From astor with GNU General Public License v2.0 | 4 votes |
/** * Compute the * <a href="http://mathworld.wolfram.com/HyperbolicTangent.html" TARGET="_top"> * hyperbolic tangent</a> of this complex number. * Implements the formula: * <pre> * <code> * tan(a + bi) = sinh(2a)/(cosh(2a)+cos(2b)) + [sin(2b)/(cosh(2a)+cos(2b))]i * </code> * </pre> * where the (real) functions on the right-hand side are * {@link FastMath#sin}, {@link FastMath#cos}, {@link FastMath#cosh} and * {@link FastMath#sinh}. * <br/> * Returns {@link Complex#NaN} if either real or imaginary part of the * input argument is {@code NaN}. * <br/> * Infinite values in real or imaginary parts of the input may result in * infinite or NaN values returned in parts of the result. * <pre> * Examples: * <code> * tanh(a ± INFINITY i) = NaN + NaN i * tanh(±INFINITY + bi) = ±1 + 0 i * tanh(±INFINITY ± INFINITY i) = NaN + NaN i * tanh(0 + (π/2)i) = NaN + INFINITY i * </code> * </pre> * * @return the hyperbolic tangent of {@code this}. * @since 1.2 */ public Complex tanh() { if (isNaN || Double.isInfinite(imaginary)) { return NaN; } if (real > 20.0) { return createComplex(1.0, 0.0); } if (real < -20.0) { return createComplex(-1.0, 0.0); } double real2 = 2.0 * real; double imaginary2 = 2.0 * imaginary; double d = FastMath.cosh(real2) + FastMath.cos(imaginary2); return createComplex(FastMath.sinh(real2) / d, FastMath.sin(imaginary2) / d); }
Example 15
Source File: Cosh.java From astor with GNU General Public License v2.0 | 4 votes |
/** {@inheritDoc} */ public double value(double x) { return FastMath.cosh(x); }
Example 16
Source File: 1_Complex.java From SimFix with GNU General Public License v2.0 | 4 votes |
/** * Compute the * <a href="http://mathworld.wolfram.com/HyperbolicTangent.html" TARGET="_top"> * hyperbolic tangent</a> of this complex number. * Implements the formula: * <pre> * <code> * tan(a + bi) = sinh(2a)/(cosh(2a)+cos(2b)) + [sin(2b)/(cosh(2a)+cos(2b))]i * </code> * </pre> * where the (real) functions on the right-hand side are * {@link FastMath#sin}, {@link FastMath#cos}, {@link FastMath#cosh} and * {@link FastMath#sinh}. * <br/> * Returns {@link Complex#NaN} if either real or imaginary part of the * input argument is {@code NaN}. * <br/> * Infinite values in real or imaginary parts of the input may result in * infinite or NaN values returned in parts of the result. * <pre> * Examples: * <code> * tanh(a ± INFINITY i) = NaN + NaN i * tanh(±INFINITY + bi) = ±1 + 0 i * tanh(±INFINITY ± INFINITY i) = NaN + NaN i * tanh(0 + (π/2)i) = NaN + INFINITY i * </code> * </pre> * * @return the hyperbolic tangent of {@code this}. * @since 1.2 */ public Complex tanh() { if (isNaN || Double.isInfinite(imaginary)) { return NaN; } if (real > 20.0) { return createComplex(1.0, 0.0); } if (real < -20.0) { return createComplex(-1.0, 0.0); } double real2 = 2.0 * real; double imaginary2 = 2.0 * imaginary; double d = FastMath.cosh(real2) + FastMath.cos(imaginary2); return createComplex(FastMath.sinh(real2) / d, FastMath.sin(imaginary2) / d); }
Example 17
Source File: Complex.java From astor with GNU General Public License v2.0 | 4 votes |
/** * Compute the * <a href="http://mathworld.wolfram.com/HyperbolicTangent.html" TARGET="_top"> * hyperbolic tangent</a> of this complex number. * Implements the formula: * <pre> * <code> * tan(a + bi) = sinh(2a)/(cosh(2a)+cos(2b)) + [sin(2b)/(cosh(2a)+cos(2b))]i * </code> * </pre> * where the (real) functions on the right-hand side are * {@link FastMath#sin}, {@link FastMath#cos}, {@link FastMath#cosh} and * {@link FastMath#sinh}. * <br/> * Returns {@link Complex#NaN} if either real or imaginary part of the * input argument is {@code NaN}. * <br/> * Infinite values in real or imaginary parts of the input may result in * infinite or NaN values returned in parts of the result. * <pre> * Examples: * <code> * tanh(a ± INFINITY i) = NaN + NaN i * tanh(±INFINITY + bi) = ±1 + 0 i * tanh(±INFINITY ± INFINITY i) = NaN + NaN i * tanh(0 + (π/2)i) = NaN + INFINITY i * </code> * </pre> * * @return the hyperbolic tangent of {@code this}. * @since 1.2 */ public Complex tanh() { if (isNaN || Double.isInfinite(imaginary)) { return NaN; } if (real > 20.0) { return createComplex(1.0, 0.0); } if (real < -20.0) { return createComplex(-1.0, 0.0); } double real2 = 2.0 * real; double imaginary2 = 2.0 * imaginary; double d = FastMath.cosh(real2) + FastMath.cos(imaginary2); return createComplex(FastMath.sinh(real2) / d, FastMath.sin(imaginary2) / d); }
Example 18
Source File: Cosh.java From astor with GNU General Public License v2.0 | 4 votes |
/** {@inheritDoc} */ public double value(double x) { return FastMath.cosh(x); }
Example 19
Source File: Cardumen_00220_s.java From coming with MIT License | 4 votes |
/** * Compute the * <a href="http://mathworld.wolfram.com/Tangent.html" TARGET="_top"> * tangent</a> of this complex number. * Implements the formula: * <pre> * <code> * tan(a + bi) = sin(2a)/(cos(2a)+cosh(2b)) + [sinh(2b)/(cos(2a)+cosh(2b))]i * </code> * </pre> * where the (real) functions on the right-hand side are * {@link FastMath#sin}, {@link FastMath#cos}, {@link FastMath#cosh} and * {@link FastMath#sinh}. * <br/> * Returns {@link Complex#NaN} if either real or imaginary part of the * input argument is {@code NaN}. * <br/> * Infinite (or critical) values in real or imaginary parts of the input may * result in infinite or NaN values returned in parts of the result. * <pre> * Examples: * <code> * tan(a ± INFINITY i) = 0 ± i * tan(±INFINITY + bi) = NaN + NaN i * tan(±INFINITY ± INFINITY i) = NaN + NaN i * tan(±π/2 + 0 i) = ±INFINITY + NaN i * </code> * </pre> * * @return the tangent of {@code this}. * @since 1.2 */ public Complex tan() { if (isNaN || Double.isInfinite(real)) { return NaN; } if (imaginary > 20.0) { return createComplex(0.0, 1.0); } if (imaginary < -20.0) { return createComplex(0.0, -1.0); } double real2 = 2.0 * real; double imaginary2 = 2.0 * imaginary; double d = FastMath.cos(real2) + FastMath.cosh(imaginary2); return createComplex(FastMath.sin(real2) / d, FastMath.sinh(imaginary2) / d); }
Example 20
Source File: LibSpoofPrimitives.java From systemds with Apache License 2.0 | 4 votes |
public static void vectCoshAdd(double[] a, double[] c, int ai, int ci, int len) { for( int j = ai; j < ai+len; j++, ci++) c[ci] += FastMath.cosh(a[j]); }