⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cosh.java

📁 JAVA 数学程序库 提供常规的数值计算程序包
💻 JAVA
字号:
package jmathlib.toolbox.trigonometric;

import jmathlib.core.functions.ExternalElementWiseFunction;;

public class cosh extends ExternalElementWiseFunction
{
    
    public cosh()
    {
        name = "cosh";
    }
    
    /**Calculates the hyperbolic cosine of a complex number
     * @param arg = the angle as an array of double
     * @return the result as an array of double
     */ 
    public double[] evaluateValue(double[] arg)
    {
        double result[] = new double[2];
        double scalar;
        double _re1, _im1;
        double _re2, _im2;

        // _1:      z.exp() ...
        scalar =  Math.exp(arg[REAL]);
        _re1 =  scalar * Math.cos(arg[IMAG]);
        _im1 =  scalar * Math.sin(arg[IMAG]);

        // _2:      z.neg().exp() ...
        scalar =  Math.exp(-arg[REAL]);
        _re2 =  scalar * Math.cos(-arg[IMAG]);
        _im2 =  scalar * Math.sin(-arg[IMAG]);

        // _1:  _1.Plus(_2) ...
        _re1 = _re1 + _re2;                    // !!!
        _im1 = _im1 + _im2;                    // !!!

        // result:  _1.scale(0.5) ...
        result[REAL] = 0.5 * _re1;
        result[IMAG] = 0.5 * _im1;
         
        return result;
    }

}

/*
@GROUP
trigonometric
@SYNTAX
cosh(angle)
@DOC
Returns the hyperbolic cosine of angle.
@EXAMPLES
<programlisting>
cosh(0) = 1
cosh(1.5707963267948966)  = 2.5091784786580567
</programlisting>
@SEE
cos, acosh, acos, sin, asin, asinh
*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -