【问题标题】:can you use variable limits of integration with the Cubature library您可以使用与Cubature Library的变量集成限制
【发布时间】:2018-10-07 18:54:47
【问题描述】:

我正在尝试通过 Cubature 库使用可变的积分限制。

例如:

adaptIntegrate(function(x) {x[1]*x[2]},
    lowerLimit = c(0,0),
    upperLimit = c(x[2],1))$integral

这行不通

谢谢

【问题讨论】:

    标签: r numerical-integration


    【解决方案1】:

    Cubature 是一个用于超立方体上的自适应多维集成的包。我也在寻找在任何特定区域进行多维集成的包(即使用变量作为限制),有人知道吗?

    另外,函数的定义不合适。我猜你想要的是

    function(x1,x2) x1*x2
    

    【讨论】:

    • 谢谢,现在我知道为什么可变限制不适用于 Cubature。
    【解决方案2】:

    积分的形式为\int_O^1 \int_0^{x[2]} f dx[1] dx[2]

    积分域是一个三角形(画个图!),顶点为 (0,0), (0,1), (1,1)。对于这样的域,请使用 SimplicialCubature 包。

    > f <- function(x) x[1]*x[2]
    > S <- cbind(c(0,0),c(0,1),c(1,1)) # the triangle (simplex)
    > library(SimplicialCubature)
    > adaptIntegrateSimplex(f, S)
    $integral
    [1] 0.125
    
    $estAbsError
    [1] 1.25e-13
    
    $functionEvaluations
    [1] 32
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-02-28
      • 2019-12-26
      • 1970-01-01
      • 2020-12-25
      • 2020-06-22
      • 2012-03-19
      • 2010-11-10
      相关资源
      最近更新 更多