Java Code Examples for org.apache.commons.math.util.MathUtils#sinh()
The following examples show how to use
org.apache.commons.math.util.MathUtils#sinh() .
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: ComplexUtils.java From astor with GNU General Public License v2.0 | 3 votes |
/** * Compute the * <a href="http://mathworld.wolfram.com/Cosine.html" TARGET="_top"> * cosine</a> * for the given complex argument. * <p> * Implements the formula: <pre> * <code> cos(a + bi) = cos(a)cosh(b) - sin(a)sinh(b)i</code></pre> * where the (real) functions on the right-hand side are * {@link java.lang.Math#sin}, {@link java.lang.Math#cos}, * {@link MathUtils#cosh} and {@link MathUtils#sinh}. * <p> * Returns {@link Complex#NaN} if either real or imaginary part of the * input argument is <code>NaN</code>. * <p> * 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> * cos(1 ± INFINITY i) = 1 ∓ INFINITY i * cos(±INFINITY + i) = NaN + NaN i * cos(±INFINITY ± INFINITY i) = NaN + NaN i</code></pre> * * @param z the value whose cosine is to be returned * @return the cosine of <code>z</code> * @throws NullPointerException if <code>z</code> is null */ public static Complex cos(Complex z) { if (z.isNaN()) { return Complex.NaN; } double a = z.getReal(); double b = z.getImaginary(); return new Complex(Math.cos(a) * MathUtils.cosh(b), -Math.sin(a) * MathUtils.sinh(b)); }
Example 2
Source File: ComplexUtils.java From astor with GNU General Public License v2.0 | 3 votes |
/** * Compute the * <a href="http://mathworld.wolfram.com/HyperbolicCosine.html" TARGET="_top"> * hyperbolic cosine</a> for the given complex argument. * <p> * Implements the formula: <pre> * <code> cosh(a + bi) = cosh(a)cos(b) + sinh(a)sin(b)i</code></pre> * where the (real) functions on the right-hand side are * {@link java.lang.Math#sin}, {@link java.lang.Math#cos}, * {@link MathUtils#cosh} and {@link MathUtils#sinh}. * <p> * Returns {@link Complex#NaN} if either real or imaginary part of the * input argument is <code>NaN</code>. * <p> * 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> * cosh(1 ± INFINITY i) = NaN + NaN i * cosh(±INFINITY + i) = INFINITY ± INFINITY i * cosh(±INFINITY ± INFINITY i) = NaN + NaN i</code></pre> * <p> * Throws <code>NullPointerException</code> if z is null. * * @param z the value whose hyperbolic cosine is to be returned. * @return the hyperbolic cosine of <code>z</code>. */ public static Complex cosh(Complex z) { if (z.isNaN()) { return Complex.NaN; } double a = z.getReal(); double b = z.getImaginary(); return new Complex(MathUtils.cosh(a) * Math.cos(b), MathUtils.sinh(a) * Math.sin(b)); }
Example 3
Source File: ComplexUtils.java From astor with GNU General Public License v2.0 | 3 votes |
/** * Compute the * <a href="http://mathworld.wolfram.com/Sine.html" TARGET="_top"> * sine</a> * for the given complex argument. * <p> * Implements the formula: <pre> * <code> sin(a + bi) = sin(a)cosh(b) - cos(a)sinh(b)i</code></pre> * where the (real) functions on the right-hand side are * {@link java.lang.Math#sin}, {@link java.lang.Math#cos}, * {@link MathUtils#cosh} and {@link MathUtils#sinh}. * <p> * Returns {@link Complex#NaN} if either real or imaginary part of the * input argument is <code>NaN</code>. * <p> * 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> * sin(1 ± INFINITY i) = 1 ± INFINITY i * sin(±INFINITY + i) = NaN + NaN i * sin(±INFINITY ± INFINITY i) = NaN + NaN i</code></pre> * * Throws <code>NullPointerException</code> if z is null. * * @param z the value whose sine is to be returned. * @return the sine of <code>z</code>. */ public static Complex sin(Complex z) { if (z.isNaN()) { return Complex.NaN; } double a = z.getReal(); double b = z.getImaginary(); return new Complex(Math.sin(a) * MathUtils.cosh(b), Math.cos(a) * MathUtils.sinh(b)); }
Example 4
Source File: ComplexUtils.java From astor with GNU General Public License v2.0 | 3 votes |
/** * Compute the * <a href="http://mathworld.wolfram.com/HyperbolicSine.html" TARGET="_top"> * hyperbolic sine</a> for the given complex argument. * <p> * Implements the formula: <pre> * <code> sinh(a + bi) = sinh(a)cos(b)) + cosh(a)sin(b)i</code></pre> * where the (real) functions on the right-hand side are * {@link java.lang.Math#sin}, {@link java.lang.Math#cos}, * {@link MathUtils#cosh} and {@link MathUtils#sinh}. * <p> * Returns {@link Complex#NaN} if either real or imaginary part of the * input argument is <code>NaN</code>. * <p> * 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> * sinh(1 ± INFINITY i) = NaN + NaN i * sinh(±INFINITY + i) = ± INFINITY + INFINITY i * sinh(±INFINITY ± INFINITY i) = NaN + NaN i</code></pre * * @param z the value whose hyperbolic sine is to be returned * @return the hyperbolic sine of <code>z</code> * @throws NullPointerException if <code>z</code> is null */ public static Complex sinh(Complex z) { if (z.isNaN()) { return Complex.NaN; } double a = z.getReal(); double b = z.getImaginary(); return new Complex(MathUtils.sinh(a) * Math.cos(b), MathUtils.cosh(a) * Math.sin(b)); }
Example 5
Source File: ComplexUtils.java From astor with GNU General Public License v2.0 | 3 votes |
/** * Compute the * <a href="http://mathworld.wolfram.com/Tangent.html" TARGET="_top"> * tangent</a> for the given complex argument. * <p> * 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 java.lang.Math#sin}, {@link java.lang.Math#cos}, * {@link MathUtils#cosh} and {@link MathUtils#sinh}. * <p> * Returns {@link Complex#NaN} if either real or imaginary part of the * input argument is <code>NaN</code>. * <p> * 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(1 ± INFINITY i) = 0 + NaN i * tan(±INFINITY + i) = NaN + NaN i * tan(±INFINITY ± INFINITY i) = NaN + NaN i * tan(±&pi/2 + 0 i) = ±INFINITY + NaN i</code></pre> * * @param z the value whose tangent is to be returned * @return the tangent of <code>z</code> * @throws NullPointerException if <code>z</code> is null */ public static Complex tan(Complex z) { if (z.isNaN()) { return Complex.NaN; } double a2 = 2.0 * z.getReal(); double b2 = 2.0 * z.getImaginary(); double d = Math.cos(a2) + MathUtils.cosh(b2); return new Complex(Math.sin(a2) / d, MathUtils.sinh(b2) / d); }
Example 6
Source File: ComplexUtils.java From astor with GNU General Public License v2.0 | 3 votes |
/** * Compute the * <a href="http://mathworld.wolfram.com/HyperbolicTangent.html" TARGET="_top"> * hyperbolic tangent</a> for the given complex argument. * <p> * 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 java.lang.Math#sin}, {@link java.lang.Math#cos}, * {@link MathUtils#cosh} and {@link MathUtils#sinh}. * <p> * Returns {@link Complex#NaN} if either real or imaginary part of the * input argument is <code>NaN</code>. * <p> * 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(1 ± INFINITY i) = NaN + NaN i * tanh(±INFINITY + i) = NaN + 0 i * tanh(±INFINITY ± INFINITY i) = NaN + NaN i * tanh(0 + (&pi/2)i) = NaN + INFINITY i</code></pre> * * @param z the value whose hyperbolic tangent is to be returned * @return the hyperbolic tangent of <code>z</code> * @throws NullPointerException if <code>z</code> is null */ public static Complex tanh(Complex z) { if (z.isNaN()) { return Complex.NaN; } double a2 = 2.0 * z.getReal(); double b2 = 2.0 * z.getImaginary(); double d = MathUtils.cosh(a2) + Math.cos(b2); return new Complex(MathUtils.sinh(a2) / d, Math.sin(b2) / d); }