[R] limits

Gabor Grothendieck ggrothendieck at gmail.com
Wed May 13 18:30:24 CEST 2009


Try the rSymPy or Ryacas packages.

In the rSymPy code below the var command defines x
as symbolic to sympy and then we perform the
computation:

> library(rSymPy)
Loading required package: rJava
> sympy("var('x')")
[1] "x"
> sympy("limit(x*x + x + 2, x, 2)")
[1] "8"

Or using devel version define x as symbolic first to sympy
and then to R:

> library(rSymPy)
> source("http://rsympy.googlecode.com/svn/trunk/R/Sym.R")
> sympy("var('x')")
[1] "x"
> x <- Sym("x")
> limit(x*x + x + 2, x, 2)
[1] "8"

or using Ryacas:

> library(Ryacas)
Loading required package: XML
> x <- Sym("x")
> Limit(x^2+x+2, x, 2)
[1] "Starting Yacas!"
expression(8)

More info is available here which you should read before
using these packages:

http://rsympy.googlecode.com
http://ryacas.googlecode.com


On Tue, May 5, 2009 at 5:39 AM, Hassan Mohamed
<hassan_hany_fahmy at yahoo.com> wrote:
> Hey,
> what is the R function for the mathematical limit ?
> e.g. to calculate  and return the amount that the expression
> X^2 +X +2
> approach
> as X approach 2
> (X-> 2)
> thanks
> hassan
>
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>




More information about the R-help mailing list