【发布时间】:2020-08-29 13:51:22
【问题描述】:
我知道如何使用积分计算器获得数值,但不知道如何获得代数方程。
例如:
integrand <- function(x) {1/((x+1)*sqrt(x))}
integrate(integrand, lower = 0, upper = Inf)
使用此代码,我可以得到 3.141593 绝对错误 < 2.7e-05
但是,如果我想使用这段代码怎么办:
integrand <- function(x) {2*x}
integrate(integrand, lower = -Inf, upper = Inf)
获取x^2。
显然,它不起作用。
如果有人可以提供帮助,我将不胜感激。非常感谢!
【问题讨论】:
-
R 不做符号数学,但有 R 包可以做。请参阅包装 Ryacas 或 R-bloggers。另请参阅包 rSymPy 或 here
-
实际上,您可以使用
Ryacas包在 R 中进行一些有限的符号计算。见RBloggers
标签: r calculator integral