# Bug in printing symbolic derivative (PR#1697)

**Peter Dalgaard BSA
**
p.dalgaard@biostat.ku.dk

*20 Jun 2002 22:52:41 +0200*

murdoch@stats.uwo.ca writes:
>* > eval(Dxy)
*>* [1] 0.1098938 # this is right
*>* > eval(Dyx)
*>* [1] 0.1098938 # this is right
*>* > -exp(-2 * x * y) * (-2 * x) * (2 * y) + exp(-2 * x * y) * 2 # this is how Dxy prints
*>* [1] 0.1831564 # this is wrong!!
*>* > -(exp(-2 * x * y) * (-2 * x) * (2 * y) + exp(-2 * x * y) * 2) # this is how it should print
*>* [1] 0.1098938 # this is right
*>*
*>* Looks like that's it...
*
Yep. This is another long-standing item on the parse/deparse TODO
list. A more minimalistic version is
>* "*"(5,2+3)
*[1] 25
>* quote("*"(5,2+3))
*5 * 2 + 3
>* eval(quote("*"(5,2+3)))
*[1] 25
There are really two issues: we don't strip parentheses when parsing
and we don't insert them where needed on deparsing.
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._