[R] Ryacas behaving weird

Rob Goedman goedman at mac.com
Fri Jan 25 03:11:42 CET 2008


Don't think your settings are wrong. I guess yacas is not (yet?)  
Mathematica.

Yacas (in a terminal) gives:

In> Simplify(a*((1/(b + E) - b/(b + E)^2)/(b/(b + E))) - N * ((1/(b +  
E) - b/(b + E)^2)/(1 - (b/(b + E)))))
Out> (a*b^5*E^2+5*a*b^4*E^3+10*a*b^3*E^4+10*a*b^2*E^5+5*a*b*E^6+a*E^7+ 
(-5)*b^5*E^2*N-b^6*E*N-10*b^4*E^3*N-10*b^3*E^4*N-5*b^2*E^5*N-b*E^6*N)/ 
(b^7*E+6*b^6*E^2+15*b^5*E^3+20*b^4*E^4+15*b^3*E^5+6*b^2*E^6+b*E^7)

Mathematica:

In[60]:= Simplify[a*((1/(b + E) - b/(b + E)^2)/(b/(b + E))) - N * ((1/ 
(b + E) - b/(b + E)^2)/(1 - (b/(b + E))))]

Out[60]= (a e - b N)/(b^2 + b e)

Which is probably what you expected/hoped for.

It is correct :-) :

In[62]:= Simplify[(a*b^5*E^2 + 5*(a*b^4*E^3) + 10*(a*b^3*E^4) +
     10*(a*b^2*E^5) + 5*(a*b*E^6) +
     a*E^7 + (-5*(b^5*E^2*N) - b^6*E*N - 10*(b^4*E^3*N) -
       10*(b^3*E^4*N) - 5*(b^2*E^5*N) - b*E^6*N))/(b^7*E +
     6*(b^6*E^2) + 15*(b^5*E^3) + 20*(b^4*E^4) + 15*(b^3*E^5) +
     6*(b^2*E^6) + b*E^7)]

Out[62]= (a e - b N)/(b^2 + b e)

Rob

On Jan 24, 2008, at 7:18 AM, francogrex wrote:

> There is either something wrong with either me or is Yacas/Ryacas  
> doing odd
> things. See below I ask to simpify an expression and the there's  
> output! If
> this is a simplification.. well.. Do you think there is something  
> set wrong
> somewhere. Thanks.
>
>> library(Ryacas)
> Loading required package: XML
>> a=Sym("a")
>> N=Sym("N")
>> b=Sym("b")
>> E=Sym("E")
>>
>> Simplify(
> + a * ((1/(b + E) - b/(b + E)^2)/(b/(b + E))) - N * ((1/(b + E) -
> +     b/(b + E)^2)/(1 - (b/(b + E))))
> + )
> [1] "Starting Yacas!"
> expression((a * b^5 * E^2 + 5 * (a * b^4 * E^3) + 10 * (a * b^3 *
>    E^4) + 10 * (a * b^2 * E^5) + 5 * (a * b * E^6) + a * E^7 +
>    (-5 * (b^5 * E^2 * N) - b^6 * E * N - 10 * (b^4 * E^3 * N) -
>        10 * (b^3 * E^4 * N) - 5 * (b^2 * E^5 * N) - b * E^6 *
>        N))/(b^7 * E + 6 * (b^6 * E^2) + 15 * (b^5 * E^3) + 20 *
>    (b^4 * E^4) + 15 * (b^3 * E^5) + 6 * (b^2 * E^6) + b * E^7))
>
> -- 
> View this message in context: http://www.nabble.com/Ryacas-behaving-weird-tp15065744p15065744.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