[R] evaluation of equations from Ryacas
Søren Højsgaard
sorenh at math.aau.dk
Wed Jun 19 09:06:06 CEST 2013
Dear Erin,
Not exactly elegant, but
> e<-expression(list(R == 100 * (1 - 2 * y/10000)))
> ee <- e[[1]][2]
> ee
(R == 100 * (1 - 2 * y/10000))()
> eval(parse(text=(substring(paste(ee), 5))), list(y=5))
[1] 99.9
Regards
Søren
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Erin Hodgess
Sent: 19. juni 2013 07:03
To: R help
Subject: [R] evaluation of equations from Ryacas
Hello again.
Now I have the following:
> xx
[1] "Solve(1 - R/100==(2*y)/10000,R)"
> yacas(xx)
expression(list(R == 100 * (1 - 2 * y/10000)))
>
I would like to put in a value for y and obtain R.
I've tried more stuff with eval and Eval, but no luck yet.
Any suggestions would be much appreciated.
Thanks,
Erin
--
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences University of Houston - Downtown
mailto: erinm.hodgess at gmail.com
[[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