[R] some questions about sympy (that is, rSymPy)

Gabor Grothendieck ggrothendieck at gmail.com
Tue Apr 17 22:32:48 CEST 2012


On Tue, Apr 17, 2012 at 4:00 PM, Kjetil Halvorsen
<kjetilbrinchmannhalvorsen at gmail.com> wrote:
> see below!
>
> On Sat, Apr 14, 2012 at 4:05 PM, Gabor Grothendieck
> <ggrothendieck at gmail.com> wrote:
>> On Fri, Apr 13, 2012 at 9:50 PM, Kjetil Halvorsen
>> <kjetilbrinchmannhalvorsen at gmail.com> wrote:
>>> I am experimenting with rSymPy, and it seems to work nice.
>>>
>>>
>>> However, I dislike the need to wrap all sympy expressions within
>>> quotes, it leads to ugly calls like
>>> library(rSymPy)
>>> Var("x,y,z")
>>> sympy("(x+y)**2")
>>> and so on.
>>
>> Suggest you review the rSymPy home page which illustrates how to use
>> the Sym interface, e.g.
>>
>>> library(rSymPy)
>>> x <- Var("x")
>>> y <- Var("y")
>>> (x+y)*(x+y)
>> [1] "(x + y)**2"
>
> Thanks!
>
> But there seems to be errors in that interface. First:
>

That's just a missing feature -- there are many -- rSymPy is only
partly developed but its developed enough that its trivial to add your
own:

> Exp <- function(x) Sym("exp(", x, ")")
> Exp(-x) * Exp(x)
[1] "1"

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-help mailing list