简体   繁体   中英

Is there any way to get the integrated equation in R?

The integrate() function returns the integrated value, but what if the user wants to take the integrated equation for an interval?

For example, the normal case of integrate() is like below:

integrate(f = function(x){2 * x}, lower = 1, upper = 2)

>3 with absolute error < 3.3e-14

But I want to write something like this:

integrate(f = function(x){2 * x}, lower = t, upper = t + 1)

to get

2 * t + 1

Thanks

The Ryacas package does symbolic computation:

install.packages("Ryacas")
library(Ryacas)
help(pac=Ryacas)

yacas("Integrate(x,t,t+1)2*x")
# expression((t + 1)^2 - t^2)

Simplify("%")  # apply simplification to last result
# expression(2 * t + 1)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM