commons-math3-3.6.1-org.apache.commons.math3.analysis包-中英对照文档及源码赏析

  • Post author:
  • Post category:其他




commons-math3-3.6.1-org.apache.commons.math3.analysis包-中英对照文档及源码赏析

摘要:中英对照文档、源码赏析、org.apache.commons.math3.analysis、BivariateFunction、DifferentiableMultivariateFunction、DifferentiableMultivariateVectorFunction、DifferentiableUnivariateFunction、DifferentiableUnivariateMatrixFunction、DifferentiableUnivariateVectorFunction、FunctionUtils、MultivariateFunction、MultivariateMatrixFunction、MultivariateVectorFunction、package-info、ParametricUnivariateFunction、RealFieldUnivariateFunction、TrivariateFunction、UnivariateFunction、UnivariateMatrixFunction、UnivariateVectorFunction




完整中文文档、中英对照文档下载请移步:

commons-math3-中文文档、中英对照文档-CSDN下载




1. 开源组件说明

commonsmath.gif

commonslogo.png

jar包名称:

commons-math3-3.6.1.jar

Maven 依赖:

<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-math3</artifactId>
    <version>3.6.1</version>
</dependency>




完整中文文档、中英对照文档下载请移步:

commons-math3-中文文档、中英对照文档-CSDN下载


本文介绍的接口和类:


org.apache.commons.math3.analysis.BivariateFunction


org.apache.commons.math3.analysis.DifferentiableMultivariateFunction


org.apache.commons.math3.analysis.DifferentiableMultivariateVectorFunction


org.apache.commons.math3.analysis.DifferentiableUnivariateFunction


org.apache.commons.math3.analysis.DifferentiableUnivariateMatrixFunction


org.apache.commons.math3.analysis.DifferentiableUnivariateVectorFunction


org.apache.commons.math3.analysis.MultivariateFunction


org.apache.commons.math3.analysis.MultivariateMatrixFunction


org.apache.commons.math3.analysis.MultivariateVectorFunction


org.apache.commons.math3.analysis.ParametricUnivariateFunction


org.apache.commons.math3.analysis.RealFieldUnivariateFunction


org.apache.commons.math3.analysis.TrivariateFunction


org.apache.commons.math3.analysis.UnivariateFunction


org.apache.commons.math3.analysis.UnivariateMatrixFunction


org.apache.commons.math3.analysis.UnivariateVectorFunction


org.apache.commons.math3.analysis.FunctionUtils

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

Parent package for common numerical analysis procedures, including root finding, function interpolation and integration.

父包用于常见的数值分析过程,包括根查找,功能插补和集成。

See:

说明

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

Parent package for common numerical analysis procedures, including root finding, function interpolation and integration. Note that optimization (i.e. minimization and maximization) is a separate top-level package.

Function interfaces are intended to be implemented by user code to represent domain problems. The algorithms provided by the library operate on these functions to find their roots, or integrate them, or … Functions can be multivariate or univariate, real vectorial or matrix-valued, and they can be differentiable or not.

父包用于常见的数值分析过程,包括根查找,功能插补和集成。请注意,优化(即最小化和最大化)是单独的顶级包。功能接口旨在通过用户代码来实现以表示域问题。由图书馆提供的算法在这些功能上操作以查找它们的根,或者集成它们,或……功能可以是多变量或单变量,真正的矢量或矩阵值,它们可以是可差的。



2.

org.apache.commons.math3.analysis.BivariateFunction



2.1.

BivariateFunction

中文-英语对照文档

org.apache.commons.math3.analysis

接口 BivariateFunction

    • 方法概要

      Methods


      限定符和类型 方法和说明

      double


      value

      (double x, double y)

      Compute the value for the function.

      计算函数的值。

    • 方法详细说明

      • value

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

        计算函数的值。


        参数:


        x

        – Abscissa for which the function value should be computed.

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


        y

        – Ordinate for which the function value should be computed.

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


        返回:

        the value.

        价值。



2.2.

BivariateFunction

源码赏析

/*
 * 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;

/**
 * An interface representing a bivariate real function.
 *
 * @since 2.1
 */
public interface BivariateFunction {
    /**
     * Compute the value for the function.
     *
     * @param x Abscissa for which the function value should be computed.
     * @param y Ordinate for which the function value should be computed.
     * @return the value.
     */
    double value(double x, double y);

}



3.

org.apache.commons.math3.analysis.DifferentiableMultivariateFunction



3.1.

DifferentiableMultivariateFunction

中文-英语对照文档

org.apache.commons.math3.analysis

接口 DifferentiableMultivariateFunction

    • 方法概要

      Methods


      限定符和类型 方法和说明


      MultivariateVectorFunction



      gradient

      ()


      Deprecated.

      弃用。

      Returns the gradient function.

      返回渐变函数。



      MultivariateFunction



      partialDerivative

      (int k)


      Deprecated.

      弃用。

      Returns the partial derivative of the function with respect to a point coordinate.

      返回相对于点坐标的函数的部分导数。

    • 方法详细说明

      • partialDerivative

        MultivariateFunction partialDerivative(int k)

        Deprecated.

        弃用。

        Returns the partial derivative of the function with respect to a point coordinate.

        The partial derivative is defined with respect to point coordinate x

        k

        . If the partial derivatives with respect to all coordinates are needed, it may be more efficient to use the

        gradient()

        method which will compute them all at once.

        返回相对于点坐标的函数的部分导数。局部导数是关于点坐标XK限定的。如果需要相对于所有坐标的部分导数,则使用将一体地计算它们的渐变()方法可能更有效。


        参数:


        k

        – index of the coordinate with respect to which the partial derivative is computed

        K – 计算部分导数的坐标索引


        返回:

        the partial derivative function with respect to k

        th

        point coordinate

        关于kth点坐标的部分导数函数

      • gradient

        MultivariateVectorFunction gradient()

        Deprecated.

        弃用。

        Returns the gradient function.

        If only one partial derivative with respect to a specific coordinate is needed, it may be more efficient to use the

        partialDerivative(int)

        method which will compute only the specified component.

        返回渐变函数。如果仅需要一个关于特定坐标的一个部分导数,则使用将仅计算指定组件的PartialDerivative(int)方法可以更有效。


        返回:

        the gradient function

        梯度函数



3.2.

DifferentiableMultivariateFunction

源码赏析

/*
 * 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;

/**
 * Extension of {@link MultivariateFunction} representing a differentiable
 * multivariate real function.
 * @since 2.0
 * @deprecated as of 3.1 replaced by {@link org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableFunction}
 */
@Deprecated
public interface DifferentiableMultivariateFunction extends MultivariateFunction {

    /**
     * Returns the partial derivative of the function with respect to a point coordinate.
     * <p>
     * The partial derivative is defined with respect to point coordinate
     * x<sub>k</sub>. If the partial derivatives with respect to all coordinates are
     * needed, it may be more efficient to use the {@link #gradient()} method which will
     * compute them all at once.
     * </p>
     * @param k index of the coordinate with respect to which the partial
     * derivative is computed
     * @return the partial derivative function with respect to k<sup>th</sup> point coordinate
     */
    MultivariateFunction partialDerivative(int k);

    /**
     * Returns the gradient function.
     * <p>If only one partial derivative with respect to a specific coordinate is
     * needed, it may be more efficient to use the {@link #partialDerivative(int)} method
     * which will compute only the specified component.</p>
     * @return the gradient function
     */
    MultivariateVectorFunction gradient();

}



4.

org.apache.commons.math3.analysis.DifferentiableMultivariateVectorFunction



4.1.

DifferentiableMultivariateVectorFunction

中文-英语对照文档

org.apache.commons.math3.analysis

接口 DifferentiableMultivariateVectorFunction

    • 方法详细说明

      • jacobian

        MultivariateMatrixFunction jacobian()

        Deprecated.

        弃用。

        Returns the jacobian function.

        返回Jacobian函数。


        返回:

        the jacobian function

        雅各碧眼的功能



4.2.

DifferentiableMultivariateVectorFunction

源码赏析

/*
 * 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;

/**
 * Extension of {@link MultivariateVectorFunction} representing a differentiable
 * multivariate vectorial function.
 * @since 2.0
 * @deprecated as of 3.1 replaced by {@link org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableVectorFunction}
 */
@Deprecated
public interface DifferentiableMultivariateVectorFunction
    extends MultivariateVectorFunction {

    /**
     * Returns the jacobian function.
     * @return the jacobian function
     */
    MultivariateMatrixFunction jacobian();

}



5.

org.apache.commons.math3.analysis.DifferentiableUnivariateFunction



5.1.

DifferentiableUnivariateFunction

中文-英语对照文档

org.apache.commons.math3.analysis

接口 DifferentiableUnivariateFunction

    • 方法概要

      Methods


      限定符和类型 方法和说明


      UnivariateFunction



      derivative

      ()


      Deprecated.

      弃用。

      Returns the derivative of the function

      返回函数的衍生物

    • 方法详细说明

      • derivative

        UnivariateFunction derivative()

        Deprecated.

        弃用。

        Returns the derivative of the function

        返回函数的衍生物


        返回:

        the derivative function

        衍生功能



5.2.

DifferentiableUnivariateFunction

源码赏析

/*
 * 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;

/**
 * Extension of {@link UnivariateFunction} representing a differentiable univariate real function.
 *
 * @deprecated as of 3.1 replaced by {@link org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction}
 */
@Deprecated
public interface DifferentiableUnivariateFunction
    extends UnivariateFunction {

    /**
     * Returns the derivative of the function
     *
     * @return  the derivative function
     */
    UnivariateFunction derivative();

}



6.

org.apache.commons.math3.analysis.DifferentiableUnivariateMatrixFunction



6.1.

DifferentiableUnivariateMatrixFunction

中文-英语对照文档

org.apache.commons.math3.analysis

接口 DifferentiableUnivariateMatrixFunction

    • 方法概要

      Methods


      限定符和类型 方法和说明


      UnivariateMatrixFunction



      derivative

      ()


      Deprecated.

      弃用。

      Returns the derivative of the function

      返回函数的衍生物

    • 方法详细说明

      • derivative

        UnivariateMatrixFunction derivative()

        Deprecated.

        弃用。

        Returns the derivative of the function

        返回函数的衍生物


        返回:

        the derivative function

        衍生功能



6.2.

DifferentiableUnivariateMatrixFunction

源码赏析

/*
 * 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;

/**
 * Extension of {@link UnivariateMatrixFunction} representing a differentiable univariate matrix function.
 *
 * @since 2.0
 * @deprecated as of 3.1 replaced by  {@link org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableMatrixFunction}
 */
@Deprecated
public interface DifferentiableUnivariateMatrixFunction
    extends UnivariateMatrixFunction {

    /**
     * Returns the derivative of the function
     *
     * @return  the derivative function
     */
    UnivariateMatrixFunction derivative();

}



7.

org.apache.commons.math3.analysis.DifferentiableUnivariateVectorFunction



7.1.

DifferentiableUnivariateVectorFunction

中文-英语对照文档

org.apache.commons.math3.analysis

接口 DifferentiableUnivariateVectorFunction

    • 方法概要

      Methods


      限定符和类型 方法和说明


      UnivariateVectorFunction



      derivative

      ()


      Deprecated.

      弃用。

      Returns the derivative of the function

      返回函数的衍生物

    • 方法详细说明

      • derivative

        UnivariateVectorFunction derivative()

        Deprecated.

        弃用。

        Returns the derivative of the function

        返回函数的衍生物


        返回:

        the derivative function

        衍生功能



7.2.

DifferentiableUnivariateVectorFunction

源码赏析

/*
 * 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;

/**
 * Extension of {@link UnivariateVectorFunction} representing a differentiable univariate vectorial function.
 *
 * @since 2.0
 * @deprecated as of 3.1 replaced by {@link org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableVectorFunction}
 */
@Deprecated
public interface DifferentiableUnivariateVectorFunction
    extends UnivariateVectorFunction {

    /**
     * Returns the derivative of the function
     *
     * @return  the derivative function
     */
    UnivariateVectorFunction derivative();

}



8.

org.apache.commons.math3.analysis.MultivariateFunction



8.1.

MultivariateFunction

中文-英语对照文档

org.apache.commons.math3.analysis

接口 MultivariateFunction

    • 方法概要

      Methods


      限定符和类型 方法和说明

      double


      value

      (double[] point)

      Compute the value for the function at the given point.

      计算给定点的函数的值。

    • 方法详细说明

      • value

        double value(double[] point)
        Compute the value for the function at the given point.

        计算给定点的函数的值。


        参数:


        point

        – Point at which the function must be evaluated.

        点 – 必须评估功能的点。


        返回:

        the function value for the given point.

        给定点的函数值。


        抛出:



        DimensionMismatchException


        – if the parameter’s dimension is wrong for the function being evaluated.

        DimensionMismatchException – 如果参数的尺寸是错误的正在评估的功能。



        MathIllegalArgumentException


        – when the activated method itself can ascertain that preconditions, specified in the API expressed at the level of the activated method, have been violated. In the vast majority of cases where Commons Math throws this exception, it is the result of argument checking of actual parameters immediately passed to a method.

        MathilleGalargumentException – 当激活的方法本身可以确定在激活方法级别的API中指定的前提条件时,已经违反了。在广泛的大部分情况下,Commons Math抛出这个例外,它是立即传递给方法的实际参数的参数检查结果。



8.2.

MultivariateFunction

源码赏析

/*
 * 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;

/**
 * An interface representing a multivariate real function.
 *
 * @since 2.0
 */
public interface MultivariateFunction {

    /**
     * Compute the value for the function at the given point.
     *
     * @param point Point at which the function must be evaluated.
     * @return the function value for the given point.
     * @throws org.apache.commons.math3.exception.DimensionMismatchException
     * if the parameter's dimension is wrong for the function being evaluated.
     * @throws  org.apache.commons.math3.exception.MathIllegalArgumentException
     * when the activated method itself can ascertain that preconditions,
     * specified in the API expressed at the level of the activated method,
     * have been violated.  In the vast majority of cases where Commons Math
     * throws this exception, it is the result of argument checking of actual
     * parameters immediately passed to a method.
     */
    double value(double[] point);
}



9.

org.apache.commons.math3.analysis.MultivariateMatrixFunction



9.1.

MultivariateMatrixFunction

中文-英语对照文档

org.apache.commons.math3.analysis

接口 MultivariateMatrixFunction

  • All Known Implementing Classes:


    JacobianFunction

    雅各比奥功能


    public interface MultivariateMatrixFunction
    An interface representing a multivariate matrix function.

    表示多变量矩阵函数的接口。


    从以下版本开始:

    2.0

    2.0

    • 方法概要

      Methods


      限定符和类型 方法和说明

      double[][]


      value

      (double[] point)

      Compute the value for the function at the given point.

      计算给定点的函数的值。

    • 方法详细说明

      • value

        double[][] value(double[] point)
                         throws IllegalArgumentException
        Compute the value for the function at the given point.

        计算给定点的函数的值。


        参数:


        point

        – point at which the function must be evaluated

        点 – 必须评估功能的点


        返回:

        function value for the given point

        给定点的函数值


        抛出:



        IllegalArgumentException


        – if point’s dimension is wrong

        IllegalArgumentException – 如果点的维度是错误的



9.2.

MultivariateMatrixFunction

源码赏析

/*
 * 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;

/**
 * An interface representing a multivariate matrix function.
 * @since 2.0
 */
public interface MultivariateMatrixFunction {

    /**
     * Compute the value for the function at the given point.
     * @param point point at which the function must be evaluated
     * @return function value for the given point
     * @exception IllegalArgumentException if point's dimension is wrong
     */
    double[][] value(double[] point)
        throws IllegalArgumentException;

}



10.

org.apache.commons.math3.analysis.MultivariateVectorFunction



10.1.

MultivariateVectorFunction

中文-英语对照文档

org.apache.commons.math3.analysis

接口 MultivariateVectorFunction

    • 方法概要

      Methods


      限定符和类型 方法和说明

      double[]


      value

      (double[] point)

      Compute the value for the function at the given point.

      计算给定点的函数的值。

    • 方法详细说明

      • value

        double[] value(double[] point)
                       throws IllegalArgumentException
        Compute the value for the function at the given point.

        计算给定点的函数的值。


        参数:


        point

        – point at which the function must be evaluated

        点 – 必须评估功能的点


        返回:

        function value for the given point

        给定点的函数值


        抛出:



        IllegalArgumentException


        – if point’s dimension is wrong

        IllegalArgumentException – 如果点的维度是错误的



10.2.

MultivariateVectorFunction

源码赏析

/*
 * 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;

/**
 * An interface representing a multivariate vectorial function.
 * @since 2.0
 */
public interface MultivariateVectorFunction {

    /**
     * Compute the value for the function at the given point.
     * @param point point at which the function must be evaluated
     * @return function value for the given point
     * @exception IllegalArgumentException if point's dimension is wrong
     */
    double[] value(double[] point)
        throws IllegalArgumentException;

}



11.

org.apache.commons.math3.analysis.ParametricUnivariateFunction



11.1.

ParametricUnivariateFunction

中文-英语对照文档

org.apache.commons.math3.analysis

接口 ParametricUnivariateFunction

    • 方法概要

      Methods


      限定符和类型 方法和说明

      double[]


      gradient

      (double x, double... parameters)

      Compute the gradient of the function with respect to its parameters.

      计算函数的渐变相对于其参数。


      double


      value

      (double x, double... parameters)

      Compute the value of the function.

      计算函数的值。

    • 方法详细说明

      • value

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

        计算函数的值。


        参数:


        x

        – Point for which the function value should be computed.

        应计算函数值的X点。


        parameters

        – Function parameters.

        参数 – 功能参数。


        返回:

        the value.

        价值。

      • gradient

        double[] gradient(double x,
                        double... parameters)
        Compute the gradient of the function with respect to its parameters.

        计算函数的渐变相对于其参数。


        参数:


        x

        – Point for which the function value should be computed.

        应计算函数值的X点。


        parameters

        – Function parameters.

        参数 – 功能参数。


        返回:

        the value.

        价值。



11.2.

ParametricUnivariateFunction

源码赏析

/*
 * 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;

/**
 * An interface representing a real function that depends on one independent
 * variable plus some extra parameters.
 *
 * @since 3.0
 */
public interface ParametricUnivariateFunction {
    /**
     * Compute the value of the function.
     *
     * @param x Point for which the function value should be computed.
     * @param parameters Function parameters.
     * @return the value.
     */
    double value(double x, double ... parameters);

    /**
     * Compute the gradient of the function with respect to its parameters.
     *
     * @param x Point for which the function value should be computed.
     * @param parameters Function parameters.
     * @return the value.
     */
    double[] gradient(double x, double ... parameters);
}



12.

org.apache.commons.math3.analysis.RealFieldUnivariateFunction



12.1.

RealFieldUnivariateFunction

中文-英语对照文档

org.apache.commons.math3.analysis

接口 RealFieldUnivariateFunction<T extends

RealFieldElement

<T>>


  • Type Parameters:


    T

    – the type of the field elements

    t – 现场元素的类型


    public interface RealFieldUnivariateFunction<T extends RealFieldElement<T>>
    An interface representing a univariate real function.

    When a

    user-defined

    function encounters an error during evaluation, the

    value

    method should throw a

    user-defined

    unchecked exception.

    The following code excerpt shows the recommended way to do that using a root solver as an example, but the same construct is applicable to ODE integrators or optimizers.

     private static class LocalException extends RuntimeException {
         // The x value that caused the problem.
         private final SomeFieldType x;
    public LocalException(SomeFieldType x) {
             this.x = x;
         }
    public double getX() {
             return x;
         }
     }
    private static class MyFunction implements FieldUnivariateFunction<SomeFieldType> {
         public SomeFieldType value(SomeFieldType x) {
             SomeFieldType y = hugeFormula(x);
             if (somethingBadHappens) {
               throw new LocalException(x);
             }
             return y;
         }
     }
    public void compute() {
         try {
             solver.solve(maxEval, new MyFunction(a, b, c), min, max);
         } catch (LocalException le) {
             // Retrieve the x value.
         }
     }
     

    As shown, the exception is local to the user’s code and it is guaranteed that Apache Commons Math will not catch it.

    表示单变量真实功能的接口。当用户定义的函数在评估期间遇到错误时,value方法应该抛出用户定义的未经检查的异常。以下代码摘录显示了使用根求解器作为示例的推荐方式,但相同的构造适用于ode集成商或优化器。私有静态类LocalException扩展了Runtimeexception { //导致问题的x值。 私人最终FineFieldType X; 公共LocalException(某人菲尔德蒂x){ this.x = x; } public double getx(){ 返回x; } } 私有静态类MyFunction实现FieldUnivariatefunction { public somefieldype值(somefieldtype x){ Somefieldtype y =巨大形式(x); if(somethingbadhappens){ 抛出新的LocalException(x); } 返回y; } } 公共void compute(){ 尝试 { solver.solve(maxeval,新myfunction(a,b,c),min,max); catch(localException Le){ //检索x值。 } } 如图所示,异常是用户代码的本地,并且保证Apache Commons Math不会捕获它。


    从以下版本开始:

    3.6

    3.6


    另请参阅:



    UnivariateFunction


    非凡透明

    • 方法概要

      Methods


      限定符和类型 方法和说明


      T



      value

      (

      T

      x)

      Compute the value of the function.

      计算函数的值。

    • 方法详细说明

      • value

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

        计算函数的值。


        参数:


        x

        – Point at which the function value should be computed.

        应计算函数值的X点。


        返回:

        the value of the function.

        函数的值。


        抛出:



        IllegalArgumentException


        – when the activated method itself can ascertain that a precondition, specified in the API expressed at the level of the activated method, has been violated. When Commons Math throws an

        IllegalArgumentException

        , it is usually the consequence of checking the actual parameters passed to the method.

        IllegalArgumentException – 当激活的方法本身可以确定在激活方法的API中指定的API中指定的前提条件时,已被侵犯。当Commons Math抛出IllegalArgumentException时,通常是检查传递给该方法的实际参数的结果。



12.2.

RealFieldUnivariateFunction

源码赏析

/*
 * 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;

import org.apache.commons.math3.RealFieldElement;

/**
 * An interface representing a univariate real function.
 * <p>
 * When a <em>user-defined</em> function encounters an error during
 * evaluation, the {@link #value(RealFieldElement) value} method should throw a
 * <em>user-defined</em> unchecked exception.</p>
 * <p>
 * The following code excerpt shows the recommended way to do that using
 * a root solver as an example, but the same construct is applicable to
 * ODE integrators or optimizers.</p>
 *
 * <pre>
 * private static class LocalException extends RuntimeException {
 *     // The x value that caused the problem.
 *     private final SomeFieldType x;
 *
 *     public LocalException(SomeFieldType x) {
 *         this.x = x;
 *     }
 *
 *     public double getX() {
 *         return x;
 *     }
 * }
 *
 * private static class MyFunction implements FieldUnivariateFunction&lt;SomeFieldType&gt; {
 *     public SomeFieldType value(SomeFieldType x) {
 *         SomeFieldType y = hugeFormula(x);
 *         if (somethingBadHappens) {
 *           throw new LocalException(x);
 *         }
 *         return y;
 *     }
 * }
 *
 * public void compute() {
 *     try {
 *         solver.solve(maxEval, new MyFunction(a, b, c), min, max);
 *     } catch (LocalException le) {
 *         // Retrieve the x value.
 *     }
 * }
 * </pre>
 *
 * As shown, the exception is local to the user's code and it is guaranteed
 * that Apache Commons Math will not catch it.
 *
 * @param <T> the type of the field elements
 * @since 3.6
 * @see UnivariateFunction
 */
public interface RealFieldUnivariateFunction<T extends RealFieldElement<T>> {
    /**
     * Compute the value of the function.
     *
     * @param x Point at which the function value should be computed.
     * @return the value of the function.
     * @throws IllegalArgumentException when the activated method itself can
     * ascertain that a precondition, specified in the API expressed at the
     * level of the activated method, has been violated.
     * When Commons Math throws an {@code IllegalArgumentException}, it is
     * usually the consequence of checking the actual parameters passed to
     * the method.
     */
    T value(T x);
}



13.

org.apache.commons.math3.analysis.TrivariateFunction



13.1.

TrivariateFunction

中文-英语对照文档

org.apache.commons.math3.analysis

接口 TrivariateFunction

    • 方法概要

      Methods


      限定符和类型 方法和说明

      double


      value

      (double x, double y, double z)

      Compute the value for the function.

      计算函数的值。

    • 方法详细说明

      • value

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

        计算函数的值。


        参数:


        x

        – x-coordinate for which the function value should be computed.

        x – x坐标应该计算函数值的x坐标。


        y

        – y-coordinate for which the function value should be computed.

        y – y坐标应该计算函数值。


        z

        – z-coordinate for which the function value should be computed.

        z – z坐标应该计算函数值。


        返回:

        the value.

        价值。



13.2.

TrivariateFunction

源码赏析

/*
 * 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;

/**
 * An interface representing a trivariate real function.
 *
 * @since 2.2
 */
public interface TrivariateFunction {
    /**
     * Compute the value for the function.
     *
     * @param x x-coordinate for which the function value should be computed.
     * @param y y-coordinate for which the function value should be computed.
     * @param z z-coordinate for which the function value should be computed.
     * @return the value.
     */
    double value(double x, double y, double z);
}



14.

org.apache.commons.math3.analysis.UnivariateFunction



14.1.

UnivariateFunction

中文-英语对照文档

org.apache.commons.math3.analysis

接口 UnivariateFunction

  • All Known Subinterfaces:


    DifferentiableUnivariateFunction

    ,

    UnivariateDifferentiableFunction

    CommanyAindeUnivariatefunction,单变化性功能

    All Known Implementing Classes:


    Abs

    ,

    Acos

    ,

    Acosh

    ,

    Asin

    ,

    Asinh

    ,

    Atan

    ,

    Atanh

    ,

    BesselJ

    ,

    Cbrt

    ,

    Ceil

    ,

    Constant

    ,

    Cos

    ,

    Cosh

    ,

    Exp

    ,

    Expm1

    ,

    Floor

    ,

    Gaussian

    ,

    HarmonicOscillator

    ,

    Identity

    ,

    Inverse

    ,

    Log

    ,

    Log10

    ,

    Log1p

    ,

    Logistic

    ,

    Logit

    ,

    Minus

    ,

    PolynomialFunction

    ,

    PolynomialFunctionLagrangeForm

    ,

    PolynomialFunctionNewtonForm

    ,

    PolynomialSplineFunction

    ,

    Power

    ,

    Rint

    ,

    Sigmoid

    ,

    Signum

    ,

    Sin

    ,

    Sinc

    ,

    Sinh

    ,

    Sqrt

    ,

    StepFunction

    ,

    Tan

    ,

    Tanh

    ,

    Ulp

    ABS,ACOS,Acosh,Asin,Asinh,atan,atanh,贝塞尔j,cbrt,ceil,常数,cos,cosh,exp,expm1,楼层,高斯,Hymoniccillator,身份,逆,日志,log10,log1p,logistic,logit,减号,多项式功能,多项式功能,PolyNomialFunctionnewtonFunce,PolynomialSpineFunction,PowernomalsplineFunction,Power,Rint,Sigmoid,Signum,Sin,Sinc,Sinh,SQRT,Spefcunction,Tan,Tanh,ULP


    public interface UnivariateFunction
    An interface representing a univariate real function.

    When a

    user-defined

    function encounters an error during evaluation, the

    value

    method should throw a

    user-defined

    unchecked exception.

    The following code excerpt shows the recommended way to do that using a root solver as an example, but the same construct is applicable to ODE integrators or optimizers.

     private static class LocalException extends RuntimeException {
         // The x value that caused the problem.
         private final double x;
    public LocalException(double x) {
             this.x = x;
         }
    public double getX() {
             return x;
         }
     }
    private static class MyFunction implements UnivariateFunction {
         public double value(double x) {
             double y = hugeFormula(x);
             if (somethingBadHappens) {
               throw new LocalException(x);
             }
             return y;
         }
     }
    public void compute() {
         try {
             solver.solve(maxEval, new MyFunction(a, b, c), min, max);
         } catch (LocalException le) {
             // Retrieve the x value.
         }
     }
     

    As shown, the exception is local to the user’s code and it is guaranteed that Apache Commons Math will not catch it.

    表示单变量真实功能的接口。当用户定义的函数在评估期间遇到错误时,value方法应该抛出用户定义的未经检查的异常。以下代码摘录显示了使用根求解器作为示例的推荐方式,但相同的构造适用于ode集成商或优化器。私有静态类LocalException扩展了Runtimeexception { //导致问题的x值。 私人最终双x; 公共LocalException(双X){ this.x = x; } public double getx(){ 返回x; } } 私有静态类MyFunction实现单轴电功能{ 公共双值(双x){ 双y =巨大形式(x); if(somethingbadhappens){ 抛出新的LocalException(x); } 返回y; } } 公共void compute(){ 尝试 { solver.solve(maxeval,新myfunction(a,b,c),min,max); catch(localException Le){ //检索x值。 } } 如图所示,异常是用户代码的本地,并且保证Apache Commons Math不会捕获它。

    • 方法概要

      Methods


      限定符和类型 方法和说明

      double


      value

      (double x)

      Compute the value of the function.

      计算函数的值。

    • 方法详细说明

      • value

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

        计算函数的值。


        参数:


        x

        – Point at which the function value should be computed.

        应计算函数值的X点。


        返回:

        the value of the function.

        函数的值。


        抛出:



        IllegalArgumentException


        – when the activated method itself can ascertain that a precondition, specified in the API expressed at the level of the activated method, has been violated. When Commons Math throws an

        IllegalArgumentException

        , it is usually the consequence of checking the actual parameters passed to the method.

        IllegalArgumentException – 当激活的方法本身可以确定在激活方法的API中指定的API中指定的前提条件时,已被侵犯。当Commons Math抛出IllegalArgumentException时,通常是检查传递给该方法的实际参数的结果。



14.2.

UnivariateFunction

源码赏析

/*
 * 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;

/**
 * An interface representing a univariate real function.
 * <p>
 * When a <em>user-defined</em> function encounters an error during
 * evaluation, the {@link #value(double) value} method should throw a
 * <em>user-defined</em> unchecked exception.</p>
 * <p>
 * The following code excerpt shows the recommended way to do that using
 * a root solver as an example, but the same construct is applicable to
 * ODE integrators or optimizers.</p>
 *
 * <pre>
 * private static class LocalException extends RuntimeException {
 *     // The x value that caused the problem.
 *     private final double x;
 *
 *     public LocalException(double x) {
 *         this.x = x;
 *     }
 *
 *     public double getX() {
 *         return x;
 *     }
 * }
 *
 * private static class MyFunction implements UnivariateFunction {
 *     public double value(double x) {
 *         double y = hugeFormula(x);
 *         if (somethingBadHappens) {
 *           throw new LocalException(x);
 *         }
 *         return y;
 *     }
 * }
 *
 * public void compute() {
 *     try {
 *         solver.solve(maxEval, new MyFunction(a, b, c), min, max);
 *     } catch (LocalException le) {
 *         // Retrieve the x value.
 *     }
 * }
 * </pre>
 *
 * As shown, the exception is local to the user's code and it is guaranteed
 * that Apache Commons Math will not catch it.
 *
 */
public interface UnivariateFunction {
    /**
     * Compute the value of the function.
     *
     * @param x Point at which the function value should be computed.
     * @return the value of the function.
     * @throws IllegalArgumentException when the activated method itself can
     * ascertain that a precondition, specified in the API expressed at the
     * level of the activated method, has been violated.
     * When Commons Math throws an {@code IllegalArgumentException}, it is
     * usually the consequence of checking the actual parameters passed to
     * the method.
     */
    double value(double x);
}



15.

org.apache.commons.math3.analysis.UnivariateMatrixFunction



15.1.

UnivariateMatrixFunction

中文-英语对照文档

org.apache.commons.math3.analysis

接口 UnivariateMatrixFunction

    • 方法概要

      Methods


      限定符和类型 方法和说明

      double[][]


      value

      (double x)

      Compute the value for the function.

      计算函数的值。

    • 方法详细说明

      • value

        double[][] value(double x)
        Compute the value for the function.

        计算函数的值。


        参数:


        x

        – the point for which the function value should be computed

        X – 应计算函数值的点


        返回:

        the value

        价值



15.2.

UnivariateMatrixFunction

源码赏析

/*
 * 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;

/**
 * An interface representing a univariate matrix function.
 *
 * @since 2.0
 */
public interface UnivariateMatrixFunction {

    /**
     * Compute the value for the function.
     * @param x the point for which the function value should be computed
     * @return the value
     */
    double[][] value(double x);

}



16.

org.apache.commons.math3.analysis.UnivariateVectorFunction



16.1.

UnivariateVectorFunction

中文-英语对照文档

org.apache.commons.math3.analysis

接口 UnivariateVectorFunction

    • 方法概要

      Methods


      限定符和类型 方法和说明

      double[]


      value

      (double x)

      Compute the value for the function.

      计算函数的值。

    • 方法详细说明

      • value

        double[] value(double x)
        Compute the value for the function.

        计算函数的值。


        参数:


        x

        – the point for which the function value should be computed

        X – 应计算函数值的点


        返回:

        the value

        价值



16.2.

UnivariateVectorFunction

源码赏析

/*
 * 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;

/**
 * An interface representing a univariate vectorial function.
 *
 * @since 2.0
 */
public interface UnivariateVectorFunction {

    /**
     * Compute the value for the function.
     * @param x the point for which the function value should be computed
     * @return the value
     */
    double[] value(double x);

}



17.

org.apache.commons.math3.analysis.FunctionUtils



17.1.

FunctionUtils

中文-英语对照文档

org.apache.commons.math3.analysis

类 FunctionUtils


  • public class FunctionUtils
    extends Object
    Utilities for manipulating function objects.

    用于操纵函数对象的实用程序。


    从以下版本开始:

    3.0

    3.0

    • 方法详细说明

      • compose

        public static UnivariateFunction compose(UnivariateFunction... f)
        Composes functions.

        The functions in the argument list are composed sequentially, in the given order. For example, compose(f1,f2,f3) acts like f1(f2(f3(x))).

        撰写功能。参数列表中的函数按照给定的顺序顺序组成。例如,撰写(F1,F2,F3),如F1(F2(F3(x)))。


        参数:


        f

        – List of functions.

        F – 功能列表。


        返回:

        the composite function.

        复合功能。

      • compose

        public static UnivariateDifferentiableFunction compose(UnivariateDifferentiableFunction... f)
        Composes functions.

        The functions in the argument list are composed sequentially, in the given order. For example, compose(f1,f2,f3) acts like f1(f2(f3(x))).

        撰写功能。参数列表中的函数按照给定的顺序顺序组成。例如,撰写(F1,F2,F3),如F1(F2(F3(x)))。


        参数:


        f

        – List of functions.

        F – 功能列表。


        返回:

        the composite function.

        复合功能。


        从以下版本开始:

        3.1

        3.1

      • compose

        @Deprecated
        public static DifferentiableUnivariateFunction compose(DifferentiableUnivariateFunction... f)

        Deprecated.


        as of 3.1 replaced by

        compose(UnivariateDifferentiableFunction...)


        弃用。截至3.1由Compose替换(单偏见异常的功能……)

        Composes functions.

        The functions in the argument list are composed sequentially, in the given order. For example, compose(f1,f2,f3) acts like f1(f2(f3(x))).

        撰写功能。参数列表中的函数按照给定的顺序顺序组成。例如,撰写(F1,F2,F3),如F1(F2(F3(x)))。


        参数:


        f

        – List of functions.

        F – 功能列表。


        返回:

        the composite function.

        复合功能。

      • add

        public static UnivariateFunction add(UnivariateFunction... f)
        Adds functions.

        添加函数。


        参数:


        f

        – List of functions.

        F – 功能列表。


        返回:

        a function that computes the sum of the functions.

        一个计算功能总和的函数。

      • add

        @Deprecated
        public static DifferentiableUnivariateFunction add(DifferentiableUnivariateFunction... f)

        Deprecated.


        as of 3.1 replaced by

        add(UnivariateDifferentiableFunction...)


        弃用。截至3.1替换(UnivariedifferiudeFunction …)

        Adds functions.

        添加函数。


        参数:


        f

        – List of functions.

        F – 功能列表。


        返回:

        a function that computes the sum of the functions.

        一个计算功能总和的函数。

      • multiply

        public static UnivariateFunction multiply(UnivariateFunction... f)
        Multiplies functions.

        乘法功能。


        参数:


        f

        – List of functions.

        F – 功能列表。


        返回:

        a function that computes the product of the functions.

        计算功能乘积的函数。

      • multiply

        public static UnivariateDifferentiableFunction multiply(UnivariateDifferentiableFunction... f)
        Multiplies functions.

        乘法功能。


        参数:


        f

        – List of functions.

        F – 功能列表。


        返回:

        a function that computes the product of the functions.

        计算功能乘积的函数。


        从以下版本开始:

        3.1

        3.1

      • multiply

        @Deprecated
        public static DifferentiableUnivariateFunction multiply(DifferentiableUnivariateFunction... f)

        Deprecated.


        as of 3.1 replaced by

        multiply(UnivariateDifferentiableFunction...)


        弃用。截至3.1替换为乘法(单识别异导功能……)

        Multiplies functions.

        乘法功能。


        参数:


        f

        – List of functions.

        F – 功能列表。


        返回:

        a function that computes the product of the functions.

        计算功能乘积的函数。

      • combine

        public static UnivariateFunction combine(BivariateFunction combiner,
                                 UnivariateFunction f,
                                 UnivariateFunction g)
        Returns the univariate function

        h(x) = combiner(f(x), g(x)).

        返回单变量函数h(x)=组合器(f(x),g(x))。


        参数:


        combiner

        – Combiner function.

        Combiner – Combiner功能。


        f

        – Function.

        F – 功能。


        g

        – Function.

        G – 功能。


        返回:

        the composite function.

        复合功能。

      • collector

        public static MultivariateFunction collector(BivariateFunction combiner,
                                     UnivariateFunction f,
                                     double initialValue)
        Returns a MultivariateFunction h(x[]) defined by

         
         h(x[]) = combiner(...combiner(combiner(initialValue,f(x[0])),f(x[1]))...),f(x[x.length-1]))
         

        返回由 h(x [])= Combiner(… Combiner(Combiner(InitalValue,F(x [0])),f(x [1]))…),f(x [x.length-1]))


        参数:


        combiner

        – Combiner function.

        Combiner – Combiner功能。


        f

        – Function.

        F – 功能。


        initialValue

        – Initial value.

        initialValue – 初始值。


        返回:

        a collector function.

        收集器功能。

      • collector

        public static MultivariateFunction collector(BivariateFunction combiner,
                                     double initialValue)
        Returns a MultivariateFunction h(x[]) defined by

         
         h(x[]) = combiner(...combiner(combiner(initialValue,x[0]),x[1])...),x[x.length-1])
         

        返回由 h(x [])= Combiner(… Combiner(Combiner(InitalValue,X 0]),X [1])……),X [X.Length-1])


        参数:


        combiner

        – Combiner function.

        Combiner – Combiner功能。


        initialValue

        – Initial value.

        initialValue – 初始值。


        返回:

        a collector function.

        收集器功能。

      • fix1stArgument

        public static UnivariateFunction fix1stArgument(BivariateFunction f,
                                        double fixed)
        Creates a unary function by fixing the first argument of a binary function.

        通过修复二进制函数的第一个参数创建一项功能。


        参数:


        f

        – Binary function.

        F – 二进制功能。


        fixed

        – value to which the first argument of

        f

        is set.

        固定值设置F的第一个参数的值。


        返回:

        the unary function h(x) = f(fixed, x)

        一元函数h(x)= f(固定,x)

      • fix2ndArgument

        public static UnivariateFunction fix2ndArgument(BivariateFunction f,
                                        double fixed)
        Creates a unary function by fixing the second argument of a binary function.

        通过修复二进制函数的第二个参数来创建一定的功能。


        参数:


        f

        – Binary function.

        F – 二进制功能。


        fixed

        – value to which the second argument of

        f

        is set.

        固定值设置F的第二个参数的固定值。


        返回:

        the unary function h(x) = f(x, fixed)

        一元函数h(x)= f(x,固定)

      • sample

        public static double[] sample(UnivariateFunction f,
                      double min,
                      double max,
                      int n)
                               throws NumberIsTooLargeException,
                                      NotStrictlyPositiveException
        Samples the specified univariate real function on the specified interval.

        The interval is divided equally into

        n

        sections and sample points are taken from

        min

        to

        max - (max - min) / n

        ; therefore

        f

        is not sampled at the upper bound

        max

        .

        在指定的时间间隔上示例指定的单变量实际功能。间隔同样地划分为n个部分,并从min到max – (max-min)/ n;因此,F未在上限最多上采样。


        参数:


        f

        – Function to be sampled

        f – 要采样的功能


        min

        – Lower bound of the interval (included).

        间隔的最小限制(包括)。


        max

        – Upper bound of the interval (excluded).

        间隔(不包括)的最大 – 上限。


        n

        – Number of sample points.

        n – 样品点数。


        返回:

        the array of samples.

        样本数组。


        抛出:



        NumberIsTooLargeException


        – if the lower bound

        min

        is greater than, or equal to the upper bound

        max

        .

        NumberStoolarGeexception – 如果下限最小值大于或等于上限最多。



        NotStrictlyPositiveException


        – if the number of sample points

        n

        is negative.

        NOTSTRICLYPositiveException – 如果样本点N的数量是否定的。



17.2.

FunctionUtils

源码赏析

/*
 * 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;

import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableFunction;
import org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableVectorFunction;
import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math3.analysis.function.Identity;
import org.apache.commons.math3.exception.DimensionMismatchException;
import org.apache.commons.math3.exception.NotStrictlyPositiveException;
import org.apache.commons.math3.exception.NumberIsTooLargeException;
import org.apache.commons.math3.exception.util.LocalizedFormats;

/**
 * Utilities for manipulating function objects.
 *
 * @since 3.0
 */
public class FunctionUtils {
    /**
     * Class only contains static methods.
     */
    private FunctionUtils() {}

    /**
     * Composes functions.
     * <p>
     * The functions in the argument list are composed sequentially, in the
     * given order.  For example, compose(f1,f2,f3) acts like f1(f2(f3(x))).</p>
     *
     * @param f List of functions.
     * @return the composite function.
     */
    public static UnivariateFunction compose(final UnivariateFunction ... f) {
        return new UnivariateFunction() {
            /** {@inheritDoc} */
            public double value(double x) {
                double r = x;
                for (int i = f.length - 1; i >= 0; i--) {
                    r = f[i].value(r);
                }
                return r;
            }
        };
    }

    /**
     * Composes functions.
     * <p>
     * The functions in the argument list are composed sequentially, in the
     * given order.  For example, compose(f1,f2,f3) acts like f1(f2(f3(x))).</p>
     *
     * @param f List of functions.
     * @return the composite function.
     * @since 3.1
     */
    public static UnivariateDifferentiableFunction compose(final UnivariateDifferentiableFunction ... f) {
        return new UnivariateDifferentiableFunction() {

            /** {@inheritDoc} */
            public double value(final double t) {
                double r = t;
                for (int i = f.length - 1; i >= 0; i--) {
                    r = f[i].value(r);
                }
                return r;
            }

            /** {@inheritDoc} */
            public DerivativeStructure value(final DerivativeStructure t) {
                DerivativeStructure r = t;
                for (int i = f.length - 1; i >= 0; i--) {
                    r = f[i].value(r);
                }
                return r;
            }

        };
    }

    /**
     * Composes functions.
     * <p>
     * The functions in the argument list are composed sequentially, in the
     * given order.  For example, compose(f1,f2,f3) acts like f1(f2(f3(x))).</p>
     *
     * @param f List of functions.
     * @return the composite function.
     * @deprecated as of 3.1 replaced by {@link #compose(UnivariateDifferentiableFunction...)}
     */
    @Deprecated
    public static DifferentiableUnivariateFunction compose(final DifferentiableUnivariateFunction ... f) {
        return new DifferentiableUnivariateFunction() {
            /** {@inheritDoc} */
            public double value(double x) {
                double r = x;
                for (int i = f.length - 1; i >= 0; i--) {
                    r = f[i].value(r);
                }
                return r;
            }

            /** {@inheritDoc} */
            public UnivariateFunction derivative() {
                return new UnivariateFunction() {
                    /** {@inheritDoc} */
                    public double value(double x) {
                        double p = 1;
                        double r = x;
                        for (int i = f.length - 1; i >= 0; i--) {
                            p *= f[i].derivative().value(r);
                            r = f[i].value(r);
                        }
                        return p;
                    }
                };
            }
        };
    }

    /**
     * Adds functions.
     *
     * @param f List of functions.
     * @return a function that computes the sum of the functions.
     */
    public static UnivariateFunction add(final UnivariateFunction ... f) {
        return n



版权声明:本文为qq_36462452原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。