commons-math3-3.6.1-org.apache.commons.math3.analysis.function-包下的类(三)-中英对照文档及源码赏析

commons-math3-3.6.1-org.apache.commons.math3.analysis.function-包下的类(三)-中英对照文档及源码赏析

摘要:中英对照文档、源码赏析、org.apache.commons.math3.analysis.function、Min、Minus、Multiply、Pow、Power、Rint、Sigmoid、Signum、Sin、Sinc、Sinh、Sqrt、StepFunction、Subtract、Tan、Tanh、Ulp

完整中文文档、中英对照文档下载请移步:commons-math3-中文文档、中英对照文档-CSDN下载

1. 开源组件说明

commonsmath.gif

commonslogo.png

jar包名称:commons-math3-3.6.1.jar

Maven 依赖:

<dependency>
    <groupId>org.apache.commonsgroupId>
    <artifactId>commons-math3artifactId>
    <version>3.6.1version>
dependency>

完整中文文档、中英对照文档下载请移步:commons-math3-中文文档、中英对照文档-CSDN下载

程序包 org.apache.commons.math3.analysis.function

The function package contains function objects that wrap the methods contained in Math, as well as common mathematical functions such as the gaussian and sinc functions.

函数包包含运算对象,该功能将包含在数学中包含的方法,以及诸如高斯和SINC功能的常见数学函数。

See: 说明

  • 类 Summary  
    说明
    Abs
    Absolute value function.

    绝对值函数。

    Acos
    Arc-cosine function.

    arc-canine功能。

    Acosh
    Hyperbolic arc-cosine function.

    双曲线弧余弦功能。

    Add
    Add the two operands.

    添加两个操作数。

    Asin
    Arc-sine function.

    arc-sine函数。

    Asinh
    Hyperbolic arc-sine function.

    双曲线弧形函数。

    Atan
    Arc-tangent function.

    弧形功能。

    Atan2
    Arc-tangent function.

    弧形功能。

    Atanh
    Hyperbolic arc-tangent function.

    双曲线弧形功能。

    Cbrt
    Cube root function.

    立方根函数。

    Ceil
    ceil function.

    CEIL功能。

    Constant
    Constant function.

    常量功能。

    Cos
    Cosine function.

    余弦功能。

    Cosh
    Hyperbolic cosine function.

    双曲余弦功能。

    Divide
    Divide the first operand by the second.

    将第一个操作数划分为第二个操作数。

    Exp
    Exponential function.

    指数函数。

    Expm1
    ex-1 function.

    前1个功能。

    Floor
    floor function.

    地板功能。

    Gaussian
    Gaussian function.

    高斯功能。

    Gaussian.Parametric
    Parametric function where the input array contains the parameters of the Gaussian, ordered as follows: Norm Mean Standard deviation

    参数功能,输入阵列包含高斯的参数,如下所述:标准平均标准偏差

    HarmonicOscillator
    simple harmonic oscillator function.

    简单的谐波振荡器功能。

    HarmonicOscillator.Parametric
    Parametric function where the input array contains the parameters of the harmonic oscillator function, ordered as follows: Amplitude Angular frequency Phase

    参数功能,其中输入阵列包含谐振子功能的参数,如下所述:幅度角频率阶段

    Identity
    Identity function.

    身份函数。

    Inverse
    Inverse function.

    逆功能。

    Log
    Natural logarithm function.

    自然对数函数。

    Log10
    Base 10 logarithm function.

    基数10对数函数。

    Log1p
    log(1 + p) function.

    log(1 + p)函数。

    Logistic
    Generalised logistic function.

    广义物流功能。

    Logistic.Parametric
    Parametric function where the input array contains the parameters of the logistic function, ordered as follows: k m b q a n

    参数功能,输入阵列包含逻辑函数的参数,如下所述:k m b q a n

    Logit
    Logit function.

    Logit函数。

    Logit.Parametric
    Parametric function where the input array contains the parameters of the logit function, ordered as follows: Lower bound Higher bound

    参数函数,其中输入阵列包含Logit函数的参数,如下所述:下限更高界限

    Max
    Maximum function.

    最大功能。

    Min
    Minimum function.

    最小功能。

    Minus
    Minus function.

    减去功能。

    Multiply
    Multiply the two operands.

    乘以两个操作数。

    Pow
    Power function.

    功率函数。

    Power
    Power function.

    功率函数。

    Rint
    rint function.

    rint函数。

    Sigmoid
    Sigmoid function.

    s形函数。

    Sigmoid.Parametric
    Parametric function where the input array contains the parameters of the sigmoid function, ordered as follows: Lower asymptote Higher asymptote

    参数函数,其中输入阵列包含Sigmoid函数的参数,如下所述:较低的渐近较高的渐近渐近渐近

    Signum
    signum function.

    signum函数。

    Sin
    Sine function.

    正弦函数。

    Sinc
    Sinc function, defined by

    SINC功能,由...定义

    Sinh
    Hyperbolic sine function.

    双曲线正弦功能。

    Sqrt
    Square-root function.

    方形功能。

    StepFunction
    Step function.

    步函数。

    Subtract
    Subtract the second operand from the first.

    从第一个减去第二个操作数。

    Tan
    Tangent function.

    切线功能。

    Tanh
    Hyperbolic tangent function.

    双曲线切线功能。

    Ulp
    ulp function.

    ULP功能。

程序包 org.apache.commons.math3.analysis.function 的说明

The function package contains function objects that wrap the methods contained in Math, as well as common mathematical functions such as the gaussian and sinc functions.


函数包包含运算对象,该功能将包含在数学中包含的方法,以及诸如高斯和SINC功能的常见数学函数。

30. 类 org.apache.commons.math3.analysis.function.Min

30.1. Min 中英对照文档

org.apache.commons.math3.analysis.function

类 Min

  • java.lang.Object
    • org.apache.commons.math3.analysis.function.Min
  • All Implemented Interfaces:
    BivariateFunction

    生物驾驶功能



    public class Min
    extends Object
    implements BivariateFunction
    Minimum function.

    最小功能。

    从以下版本开始:
    3.0

    3.0

    • 构造器概要

      构造器  
      构造器和说明
      Min() 
    • 方法概要

      Methods  
      限定符和类型 方法和说明
      double value(double x, double y)
      Compute the value for the function.

      计算函数的值。

      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细说明

      • Min

        public Min()
    • 方法详细说明

      • value

        public double value(double x,
                   double y)
        Compute the value for the function.

        计算函数的值。

        指定者:
        value in interface  BivariateFunction

        界面二手功能中的值

        参数:
        x - Abscissa for which the function value should be computed.

        应计算函数值的X - 横坐标。

        y - Ordinate for which the function value should be computed.

        Y型纵坐标应计算函数值。

        返回:
        the value.

        价值。

30.2. Min 源码赏析

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.commons.math3.analysis.function;

import org.apache.commons.math3.analysis.BivariateFunction;
import org.apache.commons.math3.util.FastMath;

/**
 * Minimum function.
 *
 * @since 3.0
 */
public class Min implements BivariateFunction {
    /** {@inheritDoc} */
    public double value(double x, double y) {
        return FastMath.min(x, y);
    }
}

31. 类 org.apache.commons.math3.analysis.function.Minus

31.1. Minus 中英对照文档

org.apache.commons.math3.analysis.function

类 Minus

  • java.lang.Object
    • org.apache.commons.math3.analysis.function.Minus
  • All Implemented Interfaces:
    DifferentiableUnivariateFunction, UnivariateDifferentiableFunction, UnivariateFunction

    CommanileAindeUnivariatefunction,单变化性功能,单轴电功能



    public class Minus
    extends Object
    implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction
    Minus function.

    减去功能。

    从以下版本开始:
    3.0

    3.0

    • 构造器概要

      构造器  
      构造器和说明
      Minus() 
    • 方法概要

      Methods  
      限定符和类型 方法和说明
      DifferentiableUnivariateFunction derivative()
      Deprecated. 
      as of 3.1, replaced by value(DerivativeStructure)

      截至3.1,取而代之(衍生)


      弃用。截至3.1,取而代之(衍生)

      DerivativeStructure value(DerivativeStructure t)
      Simple mathematical function.

      简单的数学函数。

      double value(double x)
      Compute the value of the function.

      计算函数的值。

      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细说明

      • Minus

        public Minus()
    • 方法详细说明

      • value

        public double value(double x)
        Compute the value of the function.

        计算函数的值。

        指定者:
        value in interface  UnivariateFunction

        界面非凡因子功能中的值

        参数:
        x - Point at which the function value should be computed.

        应计算函数值的X点。

        返回:
        the value of the function.

        函数的值。

      • derivative

        @Deprecated
        public DifferentiableUnivariateFunction derivative()
        Deprecated.  as of 3.1, replaced by value(DerivativeStructure)

        弃用。截至3.1,取而代之(衍生)

        Returns the derivative of the function

        返回函数的衍生物

        指定者:
        derivative in interface  DifferentiableUnivariateFunction

        界面中的衍生物不同的单位功能

        返回:
        the derivative function

        衍生功能

      • value

        public DerivativeStructure value(DerivativeStructure t)
        Simple mathematical function.

        UnivariateDifferentiableFunction classes compute both the value and the first derivative of the function.


        简单的数学函数。单变化的功能功能计算函数的值和第一个导数。

        指定者:
        value in interface  UnivariateDifferentiableFunction

        界面中的值单识别异导功能

        参数:
        t - function input value

        T - 功能输入值

        返回:
        function result

        功能结果

        从以下版本开始:
        3.1

        3.1

31.2. Minus 源码赏析

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.commons.math3.analysis.function;

import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;

/**
 * Minus function.
 *
 * @since 3.0
 */
public class Minus implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
    /** {@inheritDoc} */
    public double value(double x) {
        return -x;
    }

    /** {@inheritDoc}
     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
     */
    @Deprecated
    public DifferentiableUnivariateFunction derivative() {
        return new Constant(-1);
    }

    /** {@inheritDoc}
     * @since 3.1
     */
    public DerivativeStructure value(final DerivativeStructure t) {
        return t.negate();
    }

}

32. 类 org.apache.commons.math3.analysis.function.Multiply

32.1. Multiply 中英对照文档

org.apache.commons.math3.analysis.function

类 Multiply

  • java.lang.Object
    • org.apache.commons.math3.analysis.function.Multiply
  • All Implemented Interfaces:
    BivariateFunction

    生物驾驶功能



    public class Multiply
    extends Object
    implements BivariateFunction
    Multiply the two operands.

    乘以两个操作数。

    从以下版本开始:
    3.0

    3.0

    • 构造器概要

      构造器  
      构造器和说明
      Multiply() 
    • 方法概要

      Methods  
      限定符和类型 方法和说明
      double value(double x, double y)
      Compute the value for the function.

      计算函数的值。

      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细说明

      • Multiply

        public Multiply()
    • 方法详细说明

      • value

        public double value(double x,
                   double y)
        Compute the value for the function.

        计算函数的值。

        指定者:
        value in interface  BivariateFunction

        界面二手功能中的值

        参数:
        x - Abscissa for which the function value should be computed.

        应计算函数值的X - 横坐标。

        y - Ordinate for which the function value should be computed.

        Y型纵坐标应计算函数值。

        返回:
        the value.

        价值。

32.2. Multiply 源码赏析

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.commons.math3.analysis.function;

import org.apache.commons.math3.analysis.BivariateFunction;

/**
 * Multiply the two operands.
 *
 * @since 3.0
 */
public class Multiply implements BivariateFunction {
    /** {@inheritDoc} */
    public double value(double x, double y) {
        return x * y;
    }
}

34. 类 org.apache.commons.math3.analysis.function.Pow

34.1. Pow 中英对照文档

org.apache.commons.math3.analysis.function

类 Pow

  • java.lang.Object
    • org.apache.commons.math3.analysis.function.Pow
  • All Implemented Interfaces:
    BivariateFunction

    生物驾驶功能



    public class Pow
    extends Object
    implements BivariateFunction
    Power function.

    功率函数。

    从以下版本开始:
    3.0

    3.0

    • 构造器概要

      构造器  
      构造器和说明
      Pow() 
    • 方法概要

      Methods  
      限定符和类型 方法和说明
      double value(double x, double y)
      Compute the value for the function.

      计算函数的值。

      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细说明

      • Pow

        public Pow()
    • 方法详细说明

      • value

        public double value(double x,
                   double y)
        Compute the value for the function.

        计算函数的值。

        指定者:
        value in interface  BivariateFunction

        界面二手功能中的值

        参数:
        x - Abscissa for which the function value should be computed.

        应计算函数值的X - 横坐标。

        y - Ordinate for which the function value should be computed.

        Y型纵坐标应计算函数值。

        返回:
        the value.

        价值。

34.2. Pow 源码赏析

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.commons.math3.analysis.function;

import org.apache.commons.math3.analysis.BivariateFunction;
import org.apache.commons.math3.util.FastMath;

/**
 * Power function.
 *
 * @since 3.0
 */
public class Pow implements BivariateFunction {
    /** {@inheritDoc} */
    public double value(double x, double y) {
        return FastMath.pow(x, y);
    }
}

35. 类 org.apache.commons.math3.analysis.function.Power

35.1. Power 中英对照文档

org.apache.commons.math3.analysis.function

类 Power

  • java.lang.Object
    • org.apache.commons.math3.analysis.function.Power
  • All Implemented Interfaces:
    DifferentiableUnivariateFunction, UnivariateDifferentiableFunction, UnivariateFunction

    CommanileAindeUnivariatefunction,单变化性功能,单轴电功能



    public class Power
    extends Object
    implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction
    Power function.

    功率函数。

    从以下版本开始:
    3.0

    3.0

    • 构造器概要

      构造器  
      构造器和说明
      Power(double p) 
    • 方法概要

      Methods  
      限定符和类型 方法和说明
      UnivariateFunction derivative()
      Deprecated. 
      as of 3.1, replaced by value(DerivativeStructure)

      截至3.1,取而代之(衍生)


      弃用。截至3.1,取而代之(衍生)

      DerivativeStructure value(DerivativeStructure t)
      Simple mathematical function.

      简单的数学函数。

      double value(double x)
      Compute the value of the function.

      计算函数的值。

      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细说明

      • Power

        public Power(double p)
        参数:
        p - Power.

        p - 力量。

    • 方法详细说明

      • value

        public double value(double x)
        Compute the value of the function.

        计算函数的值。

        指定者:
        value in interface  UnivariateFunction

        界面非凡因子功能中的值

        参数:
        x - Point at which the function value should be computed.

        应计算函数值的X点。

        返回:
        the value of the function.

        函数的值。

      • derivative

        @Deprecated
        public UnivariateFunction derivative()
        Deprecated.  as of 3.1, replaced by value(DerivativeStructure)

        弃用。截至3.1,取而代之(衍生)

        Returns the derivative of the function

        返回函数的衍生物

        指定者:
        derivative in interface  DifferentiableUnivariateFunction

        界面中的衍生物不同的单位功能

        返回:
        the derivative function

        衍生功能

      • value

        public DerivativeStructure value(DerivativeStructure t)
        Simple mathematical function.

        UnivariateDifferentiableFunction classes compute both the value and the first derivative of the function.


        简单的数学函数。单变化的功能功能计算函数的值和第一个导数。

        指定者:
        value in interface  UnivariateDifferentiableFunction

        界面中的值单识别异导功能

        参数:
        t - function input value

        T - 功能输入值

        返回:
        function result

        功能结果

        从以下版本开始:
        3.1

        3.1

35.2. Power 源码赏析

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.commons.math3.analysis.function;

import org.apache.commons.math3.analysis.FunctionUtils;
import org.apache.commons.math3.analysis.UnivariateFunction;
import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math3.util.FastMath;

/**
 * Power function.
 *
 * @since 3.0
 */
public class Power implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
    /** Power. */
    private final double p;

    /**
     * @param p Power.
     */
    public Power(double p) {
        this.p = p;
    }

    /** {@inheritDoc} */
    public double value(double x) {
        return FastMath.pow(x, p);
    }

    /** {@inheritDoc}
     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
     */
    @Deprecated
    public UnivariateFunction derivative() {
        return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
    }

    /** {@inheritDoc}
     * @since 3.1
     */
    public DerivativeStructure value(final DerivativeStructure t) {
        return t.pow(p);
    }

}

36. 类 org.apache.commons.math3.analysis.function.Rint

36.1. Rint 中英对照文档

org.apache.commons.math3.analysis.function

类 Rint

  • java.lang.Object
    • org.apache.commons.math3.analysis.function.Rint
  • All Implemented Interfaces:
    UnivariateFunction

    非凡透明



    public class Rint
    extends Object
    implements UnivariateFunction
    rint function.

    rint函数。

    从以下版本开始:
    3.0

    3.0

    • 构造器概要

      构造器  
      构造器和说明
      Rint() 
    • 方法概要

      Methods  
      限定符和类型 方法和说明
      double value(double x)
      Compute the value of the function.

      计算函数的值。

      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细说明

      • Rint

        public Rint()
    • 方法详细说明

      • value

        public double value(double x)
        Compute the value of the function.

        计算函数的值。

        指定者:
        value in interface  UnivariateFunction

        界面非凡因子功能中的值

        参数:
        x - Point at which the function value should be computed.

        应计算函数值的X点。

        返回:
        the value of the function.

        函数的值。

36.2. Rint 源码赏析

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.commons.math3.analysis.function;

import org.apache.commons.math3.analysis.UnivariateFunction;
import org.apache.commons.math3.util.FastMath;

/**
 * {@code rint} function.
 *
 * @since 3.0
 */
public class Rint implements UnivariateFunction {
    /** {@inheritDoc} */
    public double value(double x) {
        return FastMath.rint(x);
    }
}

37. 类 org.apache.commons.math3.analysis.function.Sigmoid

37.1. Sigmoid 中英对照文档

org.apache.commons.math3.analysis.function

类 Sigmoid

  • java.lang.Object
    • org.apache.commons.math3.analysis.function.Sigmoid
  • All Implemented Interfaces:
    DifferentiableUnivariateFunction, UnivariateDifferentiableFunction, UnivariateFunction

    CommanileAindeUnivariatefunction,单变化性功能,单轴电功能



    public class Sigmoid
    extends Object
    implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction
    Sigmoid function. It is the inverse of the logit function. A more flexible version, the generalised logistic, is implemented by the Logistic class.

    s形函数。它是Logit函数的倒数。更灵活的版本,概述逻辑,由Logistic类实现。

    从以下版本开始:
    3.0

    3.0

    • Nested Class Summary

      Nested Classes  
      限定符和类型 类 and 的说明
      static class  Sigmoid.Parametric
      Parametric function where the input array contains the parameters of the sigmoid function, ordered as follows: Lower asymptote Higher asymptote

      参数函数,其中输入阵列包含Sigmoid函数的参数,如下所述:较低的渐近较高的渐近渐近渐近

    • 构造器概要

      构造器  
      构造器和说明
      Sigmoid()
      Usual sigmoid function, where the lower asymptote is 0 and the higher asymptote is 1.

      常规互联网函数,较低的渐近是0,较高的渐近是1。

      Sigmoid(double lo, double hi)
      Sigmoid function.

      s形函数。

    • 方法概要

      Methods  
      限定符和类型 方法和说明
      UnivariateFunction derivative()
      Deprecated. 
      as of 3.1, replaced by value(DerivativeStructure)

      截至3.1,取而代之(衍生)


      弃用。截至3.1,取而代之(衍生)

      DerivativeStructure value(DerivativeStructure t)
      Simple mathematical function.

      简单的数学函数。

      double value(double x)
      Compute the value of the function.

      计算函数的值。

      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细说明

      • Sigmoid

        public Sigmoid()
        Usual sigmoid function, where the lower asymptote is 0 and the higher asymptote is 1.

        常规互联网函数,较低的渐近是0,较高的渐近是1。

      • Sigmoid

        public Sigmoid(double lo,
               double hi)
        Sigmoid function.

        s形函数。

        参数:
        lo - Lower asymptote.

        LO - 较低的渐近。

        hi - Higher asymptote.

        嗨 - 更高的渐近。

    • 方法详细说明

      • derivative

        @Deprecated
        public UnivariateFunction derivative()
        Deprecated.  as of 3.1, replaced by value(DerivativeStructure)

        弃用。截至3.1,取而代之(衍生)

        Returns the derivative of the function

        返回函数的衍生物

        指定者:
        derivative in interface  DifferentiableUnivariateFunction

        界面中的衍生物不同的单位功能

        返回:
        the derivative function

        衍生功能

      • value

        public double value(double x)
        Compute the value of the function.

        计算函数的值。

        指定者:
        value in interface  UnivariateFunction

        界面非凡因子功能中的值

        参数:
        x - Point at which the function value should be computed.

        应计算函数值的X点。

        返回:
        the value of the function.

        函数的值。

      • value

        public DerivativeStructure value(DerivativeStructure t)
                                  throws DimensionMismatchException
        Simple mathematical function.

        UnivariateDifferentiableFunction classes compute both the value and the first derivative of the function.


        简单的数学函数。单变化的功能功能计算函数的值和第一个导数。

        指定者:
        value in interface  UnivariateDifferentiableFunction

        界面中的值单识别异导功能

        参数:
        t - function input value

        T - 功能输入值

        返回:
        function result

        功能结果

        抛出:
        DimensionMismatchException - if t is inconsistent with the function's free parameters or order

        DimensionMismatchException - 如果T与函数的免费参数或订单不一致

        从以下版本开始:
        3.1

        3.1

37.2. Sigmoid 源码赏析

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.commons.math3.analysis.function;

import java.util.Arrays;

import org.apache.commons.math3.analysis.FunctionUtils;
import org.apache.commons.math3.analysis.UnivariateFunction;
import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
import org.apache.commons.math3.analysis.ParametricUnivariateFunction;
import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math3.exception.NullArgumentException;
import org.apache.commons.math3.exception.DimensionMismatchException;
import org.apache.commons.math3.util.FastMath;

/**
 * 
 *  Sigmoid function.
 * It is the inverse of the {@link Logit logit} function.
 * A more flexible version, the generalised logistic, is implemented
 * by the {@link Logistic} class.
 *
 * @since 3.0
 */
public class Sigmoid implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
    /** Lower asymptote. */
    private final double lo;
    /** Higher asymptote. */
    private final double hi;

    /**
     * Usual sigmoid function, where the lower asymptote is 0 and the higher
     * asymptote is 1.
     */
    public Sigmoid() {
        this(0, 1);
    }

    /**
     * Sigmoid function.
     *
     * @param lo Lower asymptote.
     * @param hi Higher asymptote.
     */
    public Sigmoid(double lo,
                   double hi) {
        this.lo = lo;
        this.hi = hi;
    }

    /** {@inheritDoc}
     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
     */
    @Deprecated
    public UnivariateFunction derivative() {
        return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
    }

    /** {@inheritDoc} */
    public double value(double x) {
        return value(x, lo, hi);
    }

    /**
     * Parametric function where the input array contains the parameters of
     * the {@link Sigmoid#Sigmoid(double,double) sigmoid function}, ordered
     * as follows:
     * 
    *
  • Lower asymptote
  • *
  • Higher asymptote
  • *
*/
public static class Parametric implements ParametricUnivariateFunction { /** * Computes the value of the sigmoid at {@code x}. * * @param x Value for which the function must be computed. * @param param Values of lower asymptote and higher asymptote. * @return the value of the function. * @throws NullArgumentException if {@code param} is {@code null}. * @throws DimensionMismatchException if the size of {@code param} is * not 2. */ public double value(double x, double ... param) throws NullArgumentException, DimensionMismatchException { validateParameters(param); return Sigmoid.value(x, param[0], param[1]); } /** * Computes the value of the gradient at {@code x}. * The components of the gradient vector are the partial * derivatives of the function with respect to each of the * parameters (lower asymptote and higher asymptote). * * @param x Value at which the gradient must be computed. * @param param Values for lower asymptote and higher asymptote. * @return the gradient vector at {@code x}. * @throws NullArgumentException if {@code param} is {@code null}. * @throws DimensionMismatchException if the size of {@code param} is * not 2. */ public double[] gradient(double x, double ... param) throws NullArgumentException, DimensionMismatchException { validateParameters(param); final double invExp1 = 1 / (1 + FastMath.exp(-x)); return new double[] { 1 - invExp1, invExp1 }; } /** * Validates parameters to ensure they are appropriate for the evaluation of * the {@link #value(double,double[])} and {@link #gradient(double,double[])} * methods. * * @param param Values for lower and higher asymptotes. * @throws NullArgumentException if {@code param} is {@code null}. * @throws DimensionMismatchException if the size of {@code param} is * not 2. */ private void validateParameters(double[] param) throws NullArgumentException, DimensionMismatchException { if (param == null) { throw new NullArgumentException(); } if (param.length != 2) { throw new DimensionMismatchException(param.length, 2); } } } /** * @param x Value at which to compute the sigmoid. * @param lo Lower asymptote. * @param hi Higher asymptote. * @return the value of the sigmoid function at {@code x}. */ private static double value(double x, double lo, double hi) { return lo + (hi - lo) / (1 + FastMath.exp(-x)); } /** {@inheritDoc} * @since 3.1 */ public DerivativeStructure value(final DerivativeStructure t) throws DimensionMismatchException { double[] f = new double[t.getOrder() + 1]; final double exp = FastMath.exp(-t.getValue()); if (Double.isInfinite(exp)) { // special handling near lower boundary, to avoid NaN f[0] = lo; Arrays.fill(f, 1, f.length, 0.0); } else { // the nth order derivative of sigmoid has the form: // dn(sigmoid(x)/dxn = P_n(exp(-x)) / (1+exp(-x))^(n+1) // where P_n(t) is a degree n polynomial with normalized higher term // P_0(t) = 1, P_1(t) = t, P_2(t) = t^2 - t, P_3(t) = t^3 - 4 t^2 + t... // the general recurrence relation for P_n is: // P_n(x) = n t P_(n-1)(t) - t (1 + t) P_(n-1)'(t) final double[] p = new double[f.length]; final double inv = 1 / (1 + exp); double coeff = hi - lo; for (int n = 0; n < f.length; ++n) { // update and evaluate polynomial P_n(t) double v = 0; p[n] = 1; for (int k = n; k >= 0; --k) { v = v * exp + p[k]; if (k > 1) { p[k - 1] = (n - k + 2) * p[k - 2] - (k - 1) * p[k - 1]; } else { p[0] = 0; } } coeff *= inv; f[n] = coeff * v; } // fix function value f[0] += lo; } return t.compose(f); } }

38. 类 org.apache.commons.math3.analysis.function.Signum

38.1. Signum 中英对照文档

org.apache.commons.math3.analysis.function

类 Signum

  • java.lang.Object
    • org.apache.commons.math3.analysis.function.Signum
  • All Implemented Interfaces:
    UnivariateFunction

    非凡透明



    public class Signum
    extends Object
    implements UnivariateFunction
    signum function.

    signum函数。

    从以下版本开始:
    3.0

    3.0

    • 构造器概要

      构造器  
      构造器和说明
      Signum() 
    • 方法概要

      Methods  
      限定符和类型 方法和说明
      double value(double x)
      Compute the value of the function.

      计算函数的值。

      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细说明

      • Signum

        public Signum()
    • 方法详细说明

      • value

        public double value(double x)
        Compute the value of the function.

        计算函数的值。

        指定者:
        value in interface  UnivariateFunction

        界面非凡因子功能中的值

        参数:
        x - Point at which the function value should be computed.

        应计算函数值的X点。

        返回:
        the value of the function.

        函数的值。

38.2. Signum 源码赏析

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.commons.math3.analysis.function;

import org.apache.commons.math3.analysis.UnivariateFunction;
import org.apache.commons.math3.util.FastMath;

/**
 * {@code signum} function.
 *
 * @since 3.0
 */
public class Signum implements UnivariateFunction {
    /** {@inheritDoc} */
    public double value(double x) {
        return FastMath.signum(x);
    }
}

39. 类 org.apache.commons.math3.analysis.function.Sin

39.1. Sin 中英对照文档

org.apache.commons.math3.analysis.function

类 Sin

  • java.lang.Object
    • org.apache.commons.math3.analysis.function.Sin
  • All Implemented Interfaces:
    DifferentiableUnivariateFunction, UnivariateDifferentiableFunction, UnivariateFunction

    CommanileAindeUnivariatefunction,单变化性功能,单轴电功能



    public class Sin
    extends Object
    implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction
    Sine function.

    正弦函数。

    从以下版本开始:
    3.0

    3.0

    • 构造器概要

      构造器  
      构造器和说明
      Sin() 
    • 方法概要

      Methods  
      限定符和类型 方法和说明
      DifferentiableUnivariateFunction derivative()
      Deprecated. 
      as of 3.1, replaced by value(DerivativeStructure)

      截至3.1,取而代之(衍生)


      弃用。截至3.1,取而代之(衍生)

      DerivativeStructure value(DerivativeStructure t)
      Simple mathematical function.

      简单的数学函数。

      double value(double x)
      Compute the value of the function.

      计算函数的值。

      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细说明

      • Sin

        public Sin()
    • 方法详细说明

      • value

        public double value(double x)
        Compute the value of the function.

        计算函数的值。

        指定者:
        value in interface  UnivariateFunction

        界面非凡因子功能中的值

        参数:
        x - Point at which the function value should be computed.

        应计算函数值的X点。

        返回:
        the value of the function.

        函数的值。

      • derivative

        @Deprecated
        public DifferentiableUnivariateFunction derivative()
        Deprecated.  as of 3.1, replaced by value(DerivativeStructure)

        弃用。截至3.1,取而代之(衍生)

        Returns the derivative of the function

        返回函数的衍生物

        指定者:
        derivative in interface  DifferentiableUnivariateFunction

        界面中的衍生物不同的单位功能

        返回:
        the derivative function

        衍生功能

      • value

        public DerivativeStructure value(DerivativeStructure t)
        Simple mathematical function.

        UnivariateDifferentiableFunction classes compute both the value and the first derivative of the function.


        简单的数学函数。单变化的功能功能计算函数的值和第一个导数。

        指定者:
        value in interface  UnivariateDifferentiableFunction

        界面中的值单识别异导功能

        参数:
        t - function input value

        T - 功能输入值

        返回:
        function result

        功能结果

        从以下版本开始:
        3.1

        3.1

39.2. Sin 源码赏析

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.commons.math3.analysis.function;

import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math3.util.FastMath;

/**
 * Sine function.
 *
 * @since 3.0
 */
public class Sin implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
    /** {@inheritDoc} */
    public double value(double x) {
        return FastMath.sin(x);
    }

    /** {@inheritDoc}
     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
     */
    @Deprecated
    public DifferentiableUnivariateFunction derivative() {
        return new Cos();
    }

    /** {@inheritDoc}
     * @since 3.1
     */
    public DerivativeStructure value(final DerivativeStructure t) {
        return t.sin();
    }

}

40. 类 org.apache.commons.math3.analysis.function.Sinc

40.1. Sinc 中英对照文档

org.apache.commons.math3.analysis.function

类 Sinc

  • java.lang.Object
    • org.apache.commons.math3.analysis.function.Sinc
  • All Implemented Interfaces:
    DifferentiableUnivariateFunction, UnivariateDifferentiableFunction, UnivariateFunction

    CommanileAindeUnivariatefunction,单变化性功能,单轴电功能



    public class Sinc
    extends Object
    implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction
    Sinc function, defined by
    
       sinc(x) = 1            if x = 0,
                 sin(x) / x   otherwise.
     

    SINC功能,由...定义 sinc(x)= 1如果x = 0, SIN(x)/ x否则。

    从以下版本开始:
    3.0

    3.0

    • 构造器概要

      构造器  
      构造器和说明
      Sinc()
      The sinc function, sin(x) / x.

      真函数,罪(x)/ x。

      Sinc(boolean normalized)
      Instantiates the sinc function.

      实例化了真函数。

    • 方法概要

      Methods  
      限定符和类型 方法和说明
      UnivariateFunction derivative()
      Deprecated. 
      as of 3.1, replaced by value(DerivativeStructure)

      截至3.1,取而代之(衍生)


      弃用。截至3.1,取而代之(衍生)

      DerivativeStructure value(DerivativeStructure t)
      Simple mathematical function.

      简单的数学函数。

      double value(double x)
      Compute the value of the function.

      计算函数的值。

      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细说明

      • Sinc

        public Sinc()
        The sinc function, sin(x) / x.

        真函数,罪(x)/ x。

      • Sinc

        public Sinc(boolean normalized)
        Instantiates the sinc function.

        实例化了真函数。

        参数:
        normalized - If true, the function is sin(πx) / πx, otherwise sin(x) / x.

        归一化 - 如果为true,则该功能是SIN(πx)/πx,否则SIN(x)/ x。

    • 方法详细说明

      • value

        public double value(double x)
        Compute the value of the function.

        计算函数的值。

        指定者:
        value in interface  UnivariateFunction

        界面非凡因子功能中的值

        参数:
        x - Point at which the function value should be computed.

        应计算函数值的X点。

        返回:
        the value of the function.

        函数的值。

      • derivative

        @Deprecated
        public UnivariateFunction derivative()
        Deprecated.  as of 3.1, replaced by value(DerivativeStructure)

        弃用。截至3.1,取而代之(衍生)

        Returns the derivative of the function

        返回函数的衍生物

        指定者:
        derivative in interface  DifferentiableUnivariateFunction

        界面中的衍生物不同的单位功能

        返回:
        the derivative function

        衍生功能

      • value

        public DerivativeStructure value(DerivativeStructure t)
                                  throws DimensionMismatchException
        Simple mathematical function.

        UnivariateDifferentiableFunction classes compute both the value and the first derivative of the function.


        简单的数学函数。单变化的功能功能计算函数的值和第一个导数。

        指定者:
        value in interface  UnivariateDifferentiableFunction

        界面中的值单识别异导功能

        参数:
        t - function input value

        T - 功能输入值

        返回:
        function result

        功能结果

        抛出:
        DimensionMismatchException - if t is inconsistent with the function's free parameters or order

        DimensionMismatchException - 如果T与函数的免费参数或订单不一致

        从以下版本开始:
        3.1

        3.1

40.2. Sinc 源码赏析

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.commons.math3.analysis.function;

import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
import org.apache.commons.math3.analysis.FunctionUtils;
import org.apache.commons.math3.analysis.UnivariateFunction;
import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math3.exception.DimensionMismatchException;
import org.apache.commons.math3.util.FastMath;

/**
 * Sinc function,
 * defined by
 * 

 *   sinc(x) = 1            if x = 0,
 *             sin(x) / x   otherwise.
 * 
* * @since 3.0 */
public class Sinc implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction { /** * Value below which the computations are done using Taylor series. *

* The Taylor series for sinc even order derivatives are: *

     * d^(2n)sinc/dx^(2n)     = Sum_(k>=0) (-1)^(n+k) / ((2k)!(2n+2k+1)) x^(2k)
     *                        = (-1)^n     [ 1/(2n+1) - x^2/(4n+6) + x^4/(48n+120) - x^6/(1440n+5040) + O(x^8) ]
     * 
*

*

* The Taylor series for sinc odd order derivatives are: *

     * d^(2n+1)sinc/dx^(2n+1) = Sum_(k>=0) (-1)^(n+k+1) / ((2k+1)!(2n+2k+3)) x^(2k+1)
     *                        = (-1)^(n+1) [ x/(2n+3) - x^3/(12n+30) + x^5/(240n+840) - x^7/(10080n+45360) + O(x^9) ]
     * 
*

*

* So the ratio of the fourth term with respect to the first term * is always smaller than x^6/720, for all derivative orders. * This implies that neglecting this term and using only the first three terms induces * a relative error bounded by x^6/720. The SHORTCUT value is chosen such that this * relative error is below double precision accuracy when |x| <= SHORTCUT. *

*/
private static final double SHORTCUT = 6.0e-3; /** For normalized sinc function. */ private final boolean normalized; /** * The sinc function, {@code sin(x) / x}. */ public Sinc() { this(false); } /** * Instantiates the sinc function. * * @param normalized If {@code true}, the function is * sin(πx) / πx, otherwise {@code sin(x) / x}. */ public Sinc(boolean normalized) { this.normalized = normalized; } /** {@inheritDoc} */ public double value(final double x) { final double scaledX = normalized ? FastMath.PI * x : x; if (FastMath.abs(scaledX) <= SHORTCUT) { // use Taylor series final double scaledX2 = scaledX * scaledX; return ((scaledX2 - 20) * scaledX2 + 120) / 120; } else { // use definition expression return FastMath.sin(scaledX) / scaledX; } } /** {@inheritDoc} * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)} */ @Deprecated public UnivariateFunction derivative() { return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative(); } /** {@inheritDoc} * @since 3.1 */ public DerivativeStructure value(final DerivativeStructure t) throws DimensionMismatchException { final double scaledX = (normalized ? FastMath.PI : 1) * t.getValue(); final double scaledX2 = scaledX * scaledX; double[] f = new double[t.getOrder() + 1]; if (FastMath.abs(scaledX) <= SHORTCUT) { for (int i = 0; i < f.length; ++i) { final int k = i / 2; if ((i & 0x1) == 0) { // even derivation order f[i] = (((k & 0x1) == 0) ? 1 : -1) * (1.0 / (i + 1) - scaledX2 * (1.0 / (2 * i + 6) - scaledX2 / (24 * i + 120))); } else { // odd derivation order f[i] = (((k & 0x1) == 0) ? -scaledX : scaledX) * (1.0 / (i + 2) - scaledX2 * (1.0 / (6 * i + 24) - scaledX2 / (120 * i + 720))); } } } else { final double inv = 1 / scaledX; final double cos = FastMath.cos(scaledX); final double sin = FastMath.sin(scaledX); f[0] = inv * sin; // the nth order derivative of sinc has the form: // dn(sinc(x)/dxn = [S_n(x) sin(x) + C_n(x) cos(x)] / x^(n+1) // where S_n(x) is an even polynomial with degree n-1 or n (depending on parity) // and C_n(x) is an odd polynomial with degree n-1 or n (depending on parity) // S_0(x) = 1, S_1(x) = -1, S_2(x) = -x^2 + 2, S_3(x) = 3x^2 - 6... // C_0(x) = 0, C_1(x) = x, C_2(x) = -2x, C_3(x) = -x^3 + 6x... // the general recurrence relations for S_n and C_n are: // S_n(x) = x S_(n-1)'(x) - n S_(n-1)(x) - x C_(n-1)(x) // C_n(x) = x C_(n-1)'(x) - n C_(n-1)(x) + x S_(n-1)(x) // as per polynomials parity, we can store both S_n and C_n in the same array final double[] sc = new double[f.length]; sc[0] = 1; double coeff = inv; for (int n = 1; n < f.length; ++n) { double s = 0; double c = 0; // update and evaluate polynomials S_n(x) and C_n(x) final int kStart; if ((n & 0x1) == 0) { // even derivation order, S_n is degree n and C_n is degree n-1 sc[n] = 0; kStart = n; } else { // odd derivation order, S_n is degree n-1 and C_n is degree n sc[n] = sc[n - 1]; c = sc[n]; kStart = n - 1; } // in this loop, k is always even for (int k = kStart; k > 1; k -= 2) { // sine part sc[k] = (k - n) * sc[k] - sc[k - 1]; s = s * scaledX2 + sc[k]; // cosine part sc[k - 1] = (k - 1 - n) * sc[k - 1] + sc[k -2]; c = c * scaledX2 + sc[k - 1]; } sc[0] *= -n; s = s * scaledX2 + sc[0]; coeff *= inv; f[n] = coeff * (s * sin + c * scaledX * cos); } } if (normalized) { double scale = FastMath.PI; for (int i = 1; i < f.length; ++i) { f[i] *= scale; scale *= FastMath.PI; } } return t.compose(f); } }

41. 类 org.apache.commons.math3.analysis.function.Sinh

41.1. Sinh 中英对照文档

org.apache.commons.math3.analysis.function

类 Sinh

  • java.lang.Object
    • org.apache.commons.math3.analysis.function.Sinh
  • All Implemented Interfaces:
    DifferentiableUnivariateFunction, UnivariateDifferentiableFunction, UnivariateFunction

    CommanileAindeUnivariatefunction,单变化性功能,单轴电功能



    public class Sinh
    extends Object
    implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction
    Hyperbolic sine function.

    双曲线正弦功能。

    从以下版本开始:
    3.0

    3.0

    • 构造器概要

      构造器  
      构造器和说明
      Sinh() 
    • 方法概要

      Methods  
      限定符和类型 方法和说明
      DifferentiableUnivariateFunction derivative()
      Deprecated. 
      as of 3.1, replaced by value(DerivativeStructure)

      截至3.1,取而代之(衍生)


      弃用。截至3.1,取而代之(衍生)

      DerivativeStructure value(DerivativeStructure t)
      Simple mathematical function.

      简单的数学函数。

      double value(double x)
      Compute the value of the function.

      计算函数的值。

      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细说明

      • Sinh

        public Sinh()
    • 方法详细说明

      • value

        public double value(double x)
        Compute the value of the function.

        计算函数的值。

        指定者:
        value in interface  UnivariateFunction

        界面非凡因子功能中的值

        参数:
        x - Point at which the function value should be computed.

        应计算函数值的X点。

        返回:
        the value of the function.

        函数的值。

      • derivative

        @Deprecated
        public DifferentiableUnivariateFunction derivative()
        Deprecated.  as of 3.1, replaced by value(DerivativeStructure)

        弃用。截至3.1,取而代之(衍生)

        Returns the derivative of the function

        返回函数的衍生物

        指定者:
        derivative in interface  DifferentiableUnivariateFunction

        界面中的衍生物不同的单位功能

        返回:
        the derivative function

        衍生功能

      • value

        public DerivativeStructure value(DerivativeStructure t)
        Simple mathematical function.

        UnivariateDifferentiableFunction classes compute both the value and the first derivative of the function.


        简单的数学函数。单变化的功能功能计算函数的值和第一个导数。

        指定者:
        value in interface  UnivariateDifferentiableFunction

        界面中的值单识别异导功能

        参数:
        t - function input value

        T - 功能输入值

        返回:
        function result

        功能结果

        从以下版本开始:
        3.1

        3.1

41.2. Sinh 源码赏析

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.commons.math3.analysis.function;

import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math3.util.FastMath;

/**
 * Hyperbolic sine function.
 *
 * @since 3.0
 */
public class Sinh implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
    /** {@inheritDoc} */
    public double value(double x) {
        return FastMath.sinh(x);
    }

    /** {@inheritDoc}
     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
     */
    @Deprecated
    public DifferentiableUnivariateFunction derivative() {
        return new Cosh();
    }

    /** {@inheritDoc}
     * @since 3.1
     */
    public DerivativeStructure value(final DerivativeStructure t) {
        return t.sinh();
    }

}

42. 类 org.apache.commons.math3.analysis.function.Sqrt

42.1. Sqrt 中英对照文档

org.apache.commons.math3.analysis.function

类 Sqrt

  • java.lang.Object
    • org.apache.commons.math3.analysis.function.Sqrt
  • All Implemented Interfaces:
    DifferentiableUnivariateFunction, UnivariateDifferentiableFunction, UnivariateFunction

    CommanileAindeUnivariatefunction,单变化性功能,单轴电功能



    public class Sqrt
    extends Object
    implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction
    Square-root function.

    方形功能。

    从以下版本开始:
    3.0

    3.0

    • 构造器概要

      构造器  
      构造器和说明
      Sqrt() 
    • 方法概要

      Methods  
      限定符和类型 方法和说明
      UnivariateFunction derivative()
      Deprecated. 
      as of 3.1, replaced by value(DerivativeStructure)

      截至3.1,取而代之(衍生)


      弃用。截至3.1,取而代之(衍生)

      DerivativeStructure value(DerivativeStructure t)
      Simple mathematical function.

      简单的数学函数。

      double value(double x)
      Compute the value of the function.

      计算函数的值。

      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细说明

      • Sqrt

        public Sqrt()
    • 方法详细说明

      • value

        public double value(double x)
        Compute the value of the function.

        计算函数的值。

        指定者:
        value in interface  UnivariateFunction

        界面非凡因子功能中的值

        参数:
        x - Point at which the function value should be computed.

        应计算函数值的X点。

        返回:
        the value of the function.

        函数的值。

      • derivative

        @Deprecated
        public UnivariateFunction derivative()
        Deprecated.  as of 3.1, replaced by value(DerivativeStructure)

        弃用。截至3.1,取而代之(衍生)

        Returns the derivative of the function

        返回函数的衍生物

        指定者:
        derivative in interface  DifferentiableUnivariateFunction

        界面中的衍生物不同的单位功能

        返回:
        the derivative function

        衍生功能

      • value

        public DerivativeStructure value(DerivativeStructure t)
        Simple mathematical function.

        UnivariateDifferentiableFunction classes compute both the value and the first derivative of the function.


        简单的数学函数。单变化的功能功能计算函数的值和第一个导数。

        指定者:
        value in interface  UnivariateDifferentiableFunction

        界面中的值单识别异导功能

        参数:
        t - function input value

        T - 功能输入值

        返回:
        function result

        功能结果

        从以下版本开始:
        3.1

        3.1

42.2. Sqrt 源码赏析

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.commons.math3.analysis.function;

import org.apache.commons.math3.analysis.FunctionUtils;
import org.apache.commons.math3.analysis.UnivariateFunction;
import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math3.util.FastMath;

/**
 * Square-root function.
 *
 * @since 3.0
 */
public class Sqrt implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
    /** {@inheritDoc} */
    public double value(double x) {
        return FastMath.sqrt(x);
    }

    /** {@inheritDoc}
     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
     */
    @Deprecated
    public UnivariateFunction derivative() {
        return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
    }

    /** {@inheritDoc}
     * @since 3.1
     */
    public DerivativeStructure value(final DerivativeStructure t) {
        return t.sqrt();
    }

}

43. 类 org.apache.commons.math3.analysis.function.StepFunction

43.1. StepFunction 中英对照文档

org.apache.commons.math3.analysis.function

类 StepFunction

  • java.lang.Object
    • org.apache.commons.math3.analysis.function.StepFunction
  • All Implemented Interfaces:
    UnivariateFunction

    非凡透明



    public class StepFunction
    extends Object
    implements UnivariateFunction
    Step function.

    步函数。

    从以下版本开始:
    3.0

    3.0

    • 构造器概要

      构造器  
      构造器和说明
      StepFunction(double[] x, double[] y)
      Builds a step function from a list of arguments and the corresponding values.

      从参数列表和相应值中构建逐步函数。

    • 方法概要

      Methods  
      限定符和类型 方法和说明
      double value(double x)
      Compute the value of the function.

      计算函数的值。

      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细说明

      • StepFunction

        public StepFunction(double[] x,
                    double[] y)
                     throws NullArgumentException,
                            NoDataException,
                            DimensionMismatchException,
                            NonMonotonicSequenceException
        Builds a step function from a list of arguments and the corresponding values. Specifically, returns the function h(x) defined by
        
         h(x) = y[0] for all x < x[1]
                y[1] for x[1] ≤ x < x[2]
                ...
                y[y.length - 1] for x ≥ x[x.length - 1]
         
        The value of x[0] is ignored, but it must be strictly less than x[1].

        从参数列表和相应值中构建逐步函数。具体来说,返回所定义的函数h(x) h(x)= y [0]对于所有x

43.2. StepFunction 源码赏析

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.commons.math3.analysis.function;

import java.util.Arrays;

import org.apache.commons.math3.analysis.UnivariateFunction;
import org.apache.commons.math3.exception.DimensionMismatchException;
import org.apache.commons.math3.exception.NoDataException;
import org.apache.commons.math3.exception.NonMonotonicSequenceException;
import org.apache.commons.math3.exception.NullArgumentException;
import org.apache.commons.math3.util.MathArrays;

/**
 * 
 *  Step function.
 *
 * @since 3.0
 */
public class StepFunction implements UnivariateFunction {
    /** Abscissae. */
    private final double[] abscissa;
    /** Ordinates. */
    private final double[] ordinate;

    /**
     * Builds a step function from a list of arguments and the corresponding
     * values. Specifically, returns the function h(x) defined by 

     * h(x) = y[0] for all x < x[1]
     *        y[1] for x[1] ≤ x < x[2]
     *        ...
     *        y[y.length - 1] for x ≥ x[x.length - 1]
     * 
* The value of {@code x[0]} is ignored, but it must be strictly less than * {@code x[1]}. * * @param x Domain values where the function changes value. * @param y Values of the function. * @throws NonMonotonicSequenceException * if the {@code x} array is not sorted in strictly increasing order. * @throws NullArgumentException if {@code x} or {@code y} are {@code null}. * @throws NoDataException if {@code x} or {@code y} are zero-length. * @throws DimensionMismatchException if {@code x} and {@code y} do not * have the same length. */
public StepFunction(double[] x, double[] y) throws NullArgumentException, NoDataException, DimensionMismatchException, NonMonotonicSequenceException { if (x == null || y == null) { throw new NullArgumentException(); } if (x.length == 0 || y.length == 0) { throw new NoDataException(); } if (y.length != x.length) { throw new DimensionMismatchException(y.length, x.length); } MathArrays.checkOrder(x); abscissa = MathArrays.copyOf(x); ordinate = MathArrays.copyOf(y); } /** {@inheritDoc} */ public double value(double x) { int index = Arrays.binarySearch(abscissa, x); double fx = 0; if (index < -1) { // "x" is between "abscissa[-index-2]" and "abscissa[-index-1]". fx = ordinate[-index-2]; } else if (index >= 0) { // "x" is exactly "abscissa[index]". fx = ordinate[index]; } else { // Otherwise, "x" is smaller than the first value in "abscissa" // (hence the returned value should be "ordinate[0]"). fx = ordinate[0]; } return fx; } }

44. 类 org.apache.commons.math3.analysis.function.Subtract

44.1. Subtract 中英对照文档

org.apache.commons.math3.analysis.function

类 Subtract

  • java.lang.Object
    • org.apache.commons.math3.analysis.function.Subtract
  • All Implemented Interfaces:
    BivariateFunction

    生物驾驶功能



    public class Subtract
    extends Object
    implements BivariateFunction
    Subtract the second operand from the first.

    从第一个减去第二个操作数。

    从以下版本开始:
    3.0

    3.0

    • 构造器概要

      构造器  
      构造器和说明
      Subtract() 
    • 方法概要

      Methods  
      限定符和类型 方法和说明
      double value(double x, double y)
      Compute the value for the function.

      计算函数的值。

      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细说明

      • Subtract

        public Subtract()
    • 方法详细说明

      • value

        public double value(double x,
                   double y)
        Compute the value for the function.

        计算函数的值。

        指定者:
        value in interface  BivariateFunction

        界面二手功能中的值

        参数:
        x - Abscissa for which the function value should be computed.

        应计算函数值的X - 横坐标。

        y - Ordinate for which the function value should be computed.

        Y型纵坐标应计算函数值。

        返回:
        the value.

        价值。

44.2. Subtract 源码赏析

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.commons.math3.analysis.function;

import org.apache.commons.math3.analysis.BivariateFunction;

/**
 * Subtract the second operand from the first.
 *
 * @since 3.0
 */
public class Subtract implements BivariateFunction {
    /** {@inheritDoc} */
    public double value(double x, double y) {
        return x - y;
    }
}

45. 类 org.apache.commons.math3.analysis.function.Tan

45.1. Tan 中英对照文档

org.apache.commons.math3.analysis.function

类 Tan

  • java.lang.Object
    • org.apache.commons.math3.analysis.function.Tan
  • All Implemented Interfaces:
    DifferentiableUnivariateFunction, UnivariateDifferentiableFunction, UnivariateFunction

    CommanileAindeUnivariatefunction,单变化性功能,单轴电功能



    public class Tan
    extends Object
    implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction
    Tangent function.

    切线功能。

    从以下版本开始:
    3.0

    3.0

    • 构造器概要

      构造器  
      构造器和说明
      Tan() 
    • 方法概要

      Methods  
      限定符和类型 方法和说明
      UnivariateFunction derivative()
      Deprecated. 
      as of 3.1, replaced by value(DerivativeStructure)

      截至3.1,取而代之(衍生)


      弃用。截至3.1,取而代之(衍生)

      DerivativeStructure value(DerivativeStructure t)
      Simple mathematical function.

      简单的数学函数。

      double value(double x)
      Compute the value of the function.

      计算函数的值。

      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细说明

      • Tan

        public Tan()
    • 方法详细说明

      • value

        public double value(double x)
        Compute the value of the function.

        计算函数的值。

        指定者:
        value in interface  UnivariateFunction

        界面非凡因子功能中的值

        参数:
        x - Point at which the function value should be computed.

        应计算函数值的X点。

        返回:
        the value of the function.

        函数的值。

      • derivative

        @Deprecated
        public UnivariateFunction derivative()
        Deprecated.  as of 3.1, replaced by value(DerivativeStructure)

        弃用。截至3.1,取而代之(衍生)

        Returns the derivative of the function

        返回函数的衍生物

        指定者:
        derivative in interface  DifferentiableUnivariateFunction

        界面中的衍生物不同的单位功能

        返回:
        the derivative function

        衍生功能

      • value

        public DerivativeStructure value(DerivativeStructure t)
        Simple mathematical function.

        UnivariateDifferentiableFunction classes compute both the value and the first derivative of the function.


        简单的数学函数。单变化的功能功能计算函数的值和第一个导数。

        指定者:
        value in interface  UnivariateDifferentiableFunction

        界面中的值单识别异导功能

        参数:
        t - function input value

        T - 功能输入值

        返回:
        function result

        功能结果

        从以下版本开始:
        3.1

        3.1

45.2. Tan 源码赏析

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.commons.math3.analysis.function;

import org.apache.commons.math3.analysis.FunctionUtils;
import org.apache.commons.math3.analysis.UnivariateFunction;
import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math3.util.FastMath;

/**
 * Tangent function.
 *
 * @since 3.0
 */
public class Tan implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
    /** {@inheritDoc} */
    public double value(double x) {
        return FastMath.tan(x);
    }

    /** {@inheritDoc}
     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
     */
    @Deprecated
    public UnivariateFunction derivative() {
        return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
    }

    /** {@inheritDoc}
     * @since 3.1
     */
    public DerivativeStructure value(final DerivativeStructure t) {
        return t.tan();
    }

}

46. 类 org.apache.commons.math3.analysis.function.Tanh

46.1. Tanh 中英对照文档

org.apache.commons.math3.analysis.function

类 Tanh

  • java.lang.Object
    • org.apache.commons.math3.analysis.function.Tanh
  • All Implemented Interfaces:
    DifferentiableUnivariateFunction, UnivariateDifferentiableFunction, UnivariateFunction

    CommanileAindeUnivariatefunction,单变化性功能,单轴电功能



    public class Tanh
    extends Object
    implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction
    Hyperbolic tangent function.

    双曲线切线功能。

    从以下版本开始:
    3.0

    3.0

    • 构造器概要

      构造器  
      构造器和说明
      Tanh() 
    • 方法概要

      Methods  
      限定符和类型 方法和说明
      UnivariateFunction derivative()
      Deprecated. 
      as of 3.1, replaced by value(DerivativeStructure)

      截至3.1,取而代之(衍生)


      弃用。截至3.1,取而代之(衍生)

      DerivativeStructure value(DerivativeStructure t)
      Simple mathematical function.

      简单的数学函数。

      double value(double x)
      Compute the value of the function.

      计算函数的值。

      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细说明

      • Tanh

        public Tanh()
    • 方法详细说明

      • value

        public double value(double x)
        Compute the value of the function.

        计算函数的值。

        指定者:
        value in interface  UnivariateFunction

        界面非凡因子功能中的值

        参数:
        x - Point at which the function value should be computed.

        应计算函数值的X点。

        返回:
        the value of the function.

        函数的值。

      • derivative

        @Deprecated
        public UnivariateFunction derivative()
        Deprecated.  as of 3.1, replaced by value(DerivativeStructure)

        弃用。截至3.1,取而代之(衍生)

        Returns the derivative of the function

        返回函数的衍生物

        指定者:
        derivative in interface  DifferentiableUnivariateFunction

        界面中的衍生物不同的单位功能

        返回:
        the derivative function

        衍生功能

      • value

        public DerivativeStructure value(DerivativeStructure t)
        Simple mathematical function.

        UnivariateDifferentiableFunction classes compute both the value and the first derivative of the function.


        简单的数学函数。单变化的功能功能计算函数的值和第一个导数。

        指定者:
        value in interface  UnivariateDifferentiableFunction

        界面中的值单识别异导功能

        参数:
        t - function input value

        T - 功能输入值

        返回:
        function result

        功能结果

        从以下版本开始:
        3.1

        3.1

46.2. Tanh 源码赏析

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.commons.math3.analysis.function;

import org.apache.commons.math3.analysis.FunctionUtils;
import org.apache.commons.math3.analysis.UnivariateFunction;
import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math3.util.FastMath;

/**
 * Hyperbolic tangent function.
 *
 * @since 3.0
 */
public class Tanh implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
    /** {@inheritDoc} */
    public double value(double x) {
        return FastMath.tanh(x);
    }

    /** {@inheritDoc}
     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
     */
    @Deprecated
    public UnivariateFunction derivative() {
        return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
    }

    /** {@inheritDoc}
     * @since 3.1
     */
    public DerivativeStructure value(final DerivativeStructure t) {
        return t.tanh();
    }

}

47. 类 org.apache.commons.math3.analysis.function.Ulp

47.1. Ulp 中英对照文档

org.apache.commons.math3.analysis.function

类 Ulp

  • java.lang.Object
    • org.apache.commons.math3.analysis.function.Ulp
  • All Implemented Interfaces:
    UnivariateFunction

    非凡透明



    public class Ulp
    extends Object
    implements UnivariateFunction
    ulp function.

    ULP功能。

    从以下版本开始:
    3.0

    3.0

    • 构造器概要

      构造器  
      构造器和说明
      Ulp() 
    • 方法概要

      Methods  
      限定符和类型 方法和说明
      double value(double x)
      Compute the value of the function.

      计算函数的值。

      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细说明

      • Ulp

        public Ulp()
    • 方法详细说明

      • value

        public double value(double x)
        Compute the value of the function.

        计算函数的值。

        指定者:
        value in interface  UnivariateFunction

        界面非凡因子功能中的值

        参数:
        x - Point at which the function value should be computed.

        应计算函数值的X点。

        返回:
        the value of the function.

        函数的值。

47.2. Ulp 源码赏析

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.commons.math3.analysis.function;

import org.apache.commons.math3.analysis.UnivariateFunction;
import org.apache.commons.math3.util.FastMath;

/**
 * {@code ulp} function.
 *
 * @since 3.0
 */
public class Ulp implements UnivariateFunction {
    /** {@inheritDoc} */
    public double value(double x) {
        return FastMath.ulp(x);
    }
}

你可能感兴趣的:(#,源码,java,apache,开发语言)