[R] R in rearranging equations

Gabor Grothendieck ggrothendieck at gmail.com
Mon Jul 13 16:05:59 CEST 2009


rSymPy and Ryacas can do algebraic manipulation.
See
http://rsympy.googlecode.com
http://ryacas.googlecode.com

> library(rSymPy)
Loading required package: rJava
> sympy("var('a b m r y x')")
[1] "(a, b, m, r, y, x)"
> sympy("solve(a*b*m*y*(1-x)-r*x, x)")
[1] "[-a*b*m*y/(-r - a*b*m*y)]"


> library(Ryacas)
> a <- Sym("a"); b <- Sym("b"); m <- Sym("m"); r <- Sym("r")
> x <- Sym("x"); y <- Sym("y")
> Solve(a*b*m*y*(1-x)-r*x, x)
[1] "Starting Yacas!"
expression(list(x == a * b * m * y/(a * b * m * y + r)))


On Mon, Jul 13, 2009 at 9:23 AM,
stenort<stenort at merchantsconnected.org.uk> wrote:
>
> Hi,
> can anyone tell me if R can be used to rearrange very complicated equations
> in terms of one of the variables?
> I have:
>
> dx/dt = a*b*m*y*(1-x)-r*x
>
> and, having set:
>
> dy/dx = 0,
>
> need to rearrange in terms of x. The problem I have is that I don't know how
> to rearrange equations when the variables are not yet defined (I get
> messages warning me that x etc can't be found). I'm not sure if R can
> actually do this (though I know programs like Maxima can) but ideally the
> solution we get should be in R. I am also aware that this isn't difficult to
> solve by hand, but the remaining equations I have to work through have up to
> double the number of variables.
>
> Any help will be appreciated!
> Stenort
> --
> View this message in context: http://www.nabble.com/R-in-rearranging-equations-tp24461619p24461619.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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