Re: [R] New package Ryacas

From: Cleber N.Borges <klebyn_at_yahoo.com.br>
Date: Tue 17 Oct 2006 - 02:46:25 GMT


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@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@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
>>>
>>>



R-help@stat.math.ethz.ch 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. Received on Tue Oct 17 13:24:01 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 17 Oct 2006 - 03:30:10 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.