tanh.java

来自「JAVA 数学程序库 提供常规的数值计算程序包」· Java 代码 · 共 49 行

JAVA
49
字号
package jmathlib.toolbox.trigonometric;

import jmathlib.core.functions.ExternalElementWiseFunction;
import jmathlib.core.tokens.numbertokens.DoubleNumberToken;

public class tanh extends ExternalElementWiseFunction
{
    
    public tanh()
    {
        name = "tanh";
    }
    
    /**Calculates the hyperbolic tangent 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)
    {
        sinh sinhF = new sinh();
        cosh coshF = new cosh();
        
        double[] temp1 = sinhF.evaluateValue(arg);
        double[] temp2 = coshF.evaluateValue(arg);
        
        DoubleNumberToken  num = new DoubleNumberToken();
        
        return num.divide(temp1, temp2);
    }
    
}

/*
@GROUP
trigonometric
@SYNTAX
tanh(angle)
@DOC
Returns the hyperbolic tangent of angle.
@EXAMPLES
<programlisting>
tanh(0) = 0
tanh(1) = 0.76159
</programlisting>
@SEE
tan, atanh, cos, sin
*/

⌨️ 快捷键说明

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