[R] New package Ryacas

Cleber N.Borges klebyn at yahoo.com.br
Tue Oct 17 04:46:25 CEST 2006


Hello Gabor

I try these example, but I obtain some errors.


*First example*

> yacas("a * Identity(3)")
expression(list(list(a, 0, 0), list(0, a, 0), list(0,
0, a)))

 it's ok , but the next command:

> PrettyForm("%")
Error in PrettyForm("%") : no applicable method for
"PrettyForm"
>

If I make a little modification ( set a variable in
YACAS), I obtain right behavior.

> yacas("TEST := a * Identity(3)")
expression(list(list(a, 0, 0), list(0, a, 0), list(0,
0, a)))
>
> yacas("PrettyForm(TEST)")
/                    \
| ( a ) ( 0 ) ( 0 )  |
|                    |
| ( 0 ) ( a ) ( 0 )  |
|                    |
| ( 0 ) ( 0 ) ( a )  |
\                    /
>

I make a test for all example in "Ryacas.pdf" and all
works for me! :-)


*Second example*

> d <- List(List(1, 0, 0), List(0, 1, 0), List(0, 0,
1))
Error in List(1, 0, 0) : no applicable method for
"List"
>

> d <- yacas( "List(List(1, 0, 0), List(0, 1, 0),
List(0, 0, 1))" )
> d
expression(list(list(1, 0, 0), list(0, 1, 0), list(0,
0, 1)))
>

GUESS:
When I use the commands whitout yackas() statement,
the error raise up.

> a <- Sym("a")
> a * d
a * list( list( 1 , 0 , 0 ) , list( 0 , 1 , 0 ) ,
list( 0 ,
0 , 1 ) )
> PrettyForm("%")
Error in PrettyForm("%") : no applicable method for
"PrettyForm"
>

> yacas("PrettyForm(%)")
a * list( list( 1 , 0 , 0 ) , list( 0 , 1 , 0 ) ,
list( 0 ,
0 , 1 ) )



Thanks for your attention!


Cleber Borges




>Here is a slightly shorter way to do it although it
involves passing
>a yacas string directly:
>
>>yacas("a * Identity(3)")
>
>expression(list(list(a, 0, 0), list(0, a, 0), list(0,
0, a)))
>
>>PrettyForm("%")
>
>/                    \
>| ( a ) ( 0 ) ( 0 )  |
>|                    |
>| ( 0 ) ( a ) ( 0 )  |
>|                    |
>| ( 0 ) ( 0 ) ( a )  |
>\                    /
>
>
>On 10/16/06, Gabor Grothendieck
<ggrothendieck em gmail.com> wrote:
>
>>Its pretty limited right now but you can do this:
>>
>>>library(Ryacas)
>>>d <- List(List(1, 0, 0), List(0, 1, 0), List(0, 0,
1))
>>>a <- Sym("a")
>>>a * d
>>
>>expression(list(list(a, 0, 0), list(0, a, 0),
list(0, 0, a)))
>>
>>>PrettyForm("%")
>>
>>/                    \
>>| ( a ) ( 0 ) ( 0 )  |
>>|                    |
>>| ( 0 ) ( a ) ( 0 )  |
>>|                    |
>>| ( 0 ) ( 0 ) ( a )  |
>>\                    /
>>
>>The ASCII representation of the matrix will look
correct in R although its
>>possible that the email process munges it up so it
may not look right
>>when you receive this.
>>
>>Also there are also matrix examples on the home
page, in the Ryacas vignette
>>and in the Ryacas-Sym vignette.
>>
>>Note that by mistake the vignette labelled
Ryacas-Sym in the package
>>itself is actually a copy of the Ryacas vignette so
to see the actual
>>Ryacas-Sym vignette currently one must look at the
one in the source repository:
>>http://ryacas.googlecode.com/svn/trunk/inst/doc/Ryacas-Sym.pdf
>>
>>
>>
>>On 10/16/06, Cleber N. Borges
<cborges em iqm.unicamp.br> wrote:
>>
>>>Hello,
>>>
>>>First,
>>>I would like to congratulations for very cool
package! It's very
>>>nice
>>>idea!...
>>>Secondly,
>>>Is there a way to send R'objects (variables) to
yacas and make
>>>symbolic
>>>operations??
>>>for example:
>>>
>>>d <- diag(3)
>>>a <- "A"
>>>
>>>yacas(   d * a )
>>>
>>>Thanks,
>>>Cleber Borges
>>>
>>>



More information about the R-help mailing list