Java Code Examples for org.apache.commons.math.util.FastMath#cosh()
The following examples show how to use
org.apache.commons.math.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: ArrayRealVector.java From astor with GNU General Public License v2.0 | 5 votes |
/** {@inheritDoc} */ @Override public RealVector mapCoshToSelf() { for (int i = 0; i < data.length; i++) { data[i] = FastMath.cosh(data[i]); } return this; }
Example 2
Source File: Math_37_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 3
Source File: Math_37_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 4
Source File: 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 5
Source File: 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 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: ComposableFunction.java From astor with GNU General Public License v2.0 | 4 votes |
/** {@inheritDoc} */ @Override public double value(double d) { return FastMath.cosh(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: Cosh.java From astor with GNU General Public License v2.0 | 4 votes |
/** {@inheritDoc} */ public double value(double x) { return FastMath.cosh(x); }
Example 10
Source File: Math_37_Complex_s.java From coming with MIT License | 3 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) { return NaN; } 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 11
Source File: Math_37_Complex_s.java From coming with MIT License | 3 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) { return NaN; } 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 12
Source File: Complex_s.java From coming with MIT License | 3 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) { return NaN; } 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 13
Source File: Complex_s.java From coming with MIT License | 3 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) { return NaN; } 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); }