From ggrothendieck at gmail.com  Tue Jul 25 12:35:04 2006
From: ggrothendieck at gmail.com (Gabor Grothendieck)
Date: Tue, 25 Jul 2006 06:35:04 -0400
Subject: [Rd] pari/gp interface
In-Reply-To: <996C788E-4632-4BB5-A9F4-83AB02C0CE3D@soc.soton.ac.uk>
References: <996C788E-4632-4BB5-A9F4-83AB02C0CE3D@soc.soton.ac.uk>
Message-ID: <971536df0607250335h41e265f5x32fef746c920886e@mail.gmail.com>

On Windows XP either of these work under R.  Here echo and findstr
are builtin Windows commands but you could substitute others:

   system("cmd /c echo abc | findstr a", intern = TRUE)
   shell("echo abc | findstr a", intern = TRUE)

If its necessary to special case it then note that the
R variable .Platform$OS.type equals "windows" on Windows.

On 7/25/06, Robin Hankin <r.hankin at noc.soton.ac.uk> wrote:
> Hi
>
> I'm developing an R package that
> needs to execute some code written in pari/gp.
>
> I've used this before from an R package (elliptic) but the interface
> is very
> basic: the R function creates a string such as the following:
>
> string <- echo ' ellwp ([ 2+0*I , 0+2*I ], 1+0*I )' | gp -q
>
> And then
>
> system(string)
>
> returns the output from gp which then needs to be text processed
> (translating "I"
> to "i", etc).
>
> I don't think this approach would work under Windows.
>
> Does anyone have any experience of calling pari/gp from R?
>
> Or any ideas for a more portable method than the one above?
>
>
>
>
> [
> PARI/GP is a widely used computer algebra system designed for fast
> computations
> in number theory.  It is freely available at
>
>  http://pari.math.u-bordeaux.fr/
> ]
>
>
> --
> Robin Hankin
> Uncertainty Analyst
> National Oceanography Centre, Southampton
> European Way, Southampton SO14 3ZH, UK
>  tel  023-8059-7743
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



[Rd] pari/gp interface
Gabor Grothendieck