Søren Højsgaard
2005-Jul-12 11:19 UTC
[Rd] Computer algebra in R - would that be an idea??
>From time to time people request symbolic computations beyond what D() and deriv() etc can provide. A brief look at the internet shows that there are many more or less developed computer algebra packages freely available. Therefore, I wondered if it would be an idea to try to 'integrate' one of these packages in R, which I guess can be done in more or less elegant ways... I do not know any of the computer algebra people around the World, but perhaps some other people from the R-community do and would be able to/interested in establishing such a connection...Just and idea; comments appreciated :-) S?ren ============================================================================================= S?ren H?jsgaard, MSc, PhD (Statistics), Phone: +45 8999 1703 Head of Statistics and Decision Theory Research Group, Fax: +45 8999 1300 Danish Institute of Agricultural Sciences sorenh at agrsci.dk Research Centre Foulum, DK-8830 Tjele, Denmark http://genetics.agrsci.dk/~sorenh .... Time flies like an arrow, fruit flies like a banana ....
Gabor Grothendieck
2005-Jul-12 14:57 UTC
[Rd] Computer algebra in R - would that be an idea??
On 7/12/05, S?ren H?jsgaard <Soren.Hojsgaard at agrsci.dk> wrote:> >From time to time people request symbolic computations beyond what D() and deriv() etc can provide. A brief look at the internet shows that there are many more or less developed computer algebra packages freely available. Therefore, I wondered if it would be an idea to try to 'integrate' one of these packages in R, which I guess can be done in more or less elegant ways... I do not know any of the computer algebra people around the World, but perhaps some other people from the R-community do and would be able to/interested in establishing such a connection...Coincidentally I asked the yacas developer about this just yesterday: http://sourceforge.net/mailarchive/forum.php?thread_id=7711431&forum_id=2216
Søren Højsgaard
2005-Jul-13 00:45 UTC
[Rd] Computer algebra in R - would that be an idea??
Personally, I like Maxima better than Yacas, but in both cases the solution (at least a minimal one) should be doable: A small program which pipes R commands into a terminal running Maxima/Yacas and taking the output back into R. I am not much into the technical details, but isn't that what can be done with the COM automatation server on Windows?? (I don't know what the equivalent would be on unix?). Best regards S?ren ________________________________ Fra: Simon Blomberg [mailto:Simon.Blomberg at anu.edu.au] Sendt: on 13-07-2005 01:52 Til: Duncan Murdoch; Gabor Grothendieck Cc: S?ren H?jsgaard; r-devel at stat.math.ethz.ch Emne: Re: [Rd] Computer algebra in R - would that be an idea?? I would use such a symbolic math package for R. I have dreamt of an open-source solution with functionality similar to mathStatica. http://www.mathstatica.com/ Is yacas the best system to consider? What about Maxima http://maxima.sourceforge.net/, which is also GPL, or maybe Axiom http://savannah.nongnu.org/projects/axiom, which has a modified BSD license? Cheers, Simon. At 01:25 AM 13/07/2005, Duncan Murdoch wrote:>On 7/12/2005 10:57 AM, Gabor Grothendieck wrote: > > On 7/12/05, S?ren H?jsgaard <Soren.Hojsgaard at agrsci.dk> wrote: > >> >From time to time people request symbolic computations beyond what > D() and deriv() etc can provide. A brief look at the internet shows that > there are many more or less developed computer algebra packages freely > available. Therefore, I wondered if it would be an idea to try to > 'integrate' one of these packages in R, which I guess can be done in more > or less elegant ways... I do not know any of the computer algebra people > around the World, but perhaps some other people from the R-community do > and would be able to/interested in establishing such a connection... > > > > > > Coincidentally I asked the yacas developer about this just yesterday: > > > http://sourceforge.net/mailarchive/forum.php?thread_id=7711431&forum_id=2216 > >It sounds like developing an R package to act as a wrapper would be the >best approach. I didn't see documentation for their API (the exports of >their DLL), but I didn't spend long looking. > >Duncan Murdoch > >______________________________________________ >R-devel at r-project.org mailing list >https://stat.ethz.ch/mailman/listinfo/r-develSimon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat. Centre for Resource and Environmental Studies The Australian National University Canberra ACT 0200 Australia T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au F: +61 2 6125 0757 CRICOS Provider # 00120C
Søren Højsgaard
2005-Jul-13 10:04 UTC
[Rd] Computer algebra in R - would that be an idea??
I think it is essential that the program which 'we' are trying to interface from R is under active development. I guess that it would also be 'politically wise' (and potentially useful) to ensure that the people behind Maxima and/or Yacas and/or ... find that it would be a good idea to interface their program from R (I don't see why they should not, though...) Some time ago, I developed the mimR package which is essentially a wrapper to a statistical program called mim. The interfacing was made possible by that the creator of mim (David Edwards) made some small changes to his program such that it could be accessed programatically. I am not sure what the details were, but as I understood it at that time, it was not at whole lot of things that needed to be done. (And that was for Windows platforms only). Perhaps Yacas/Maxima/... - people could be talked into such changes of their packages??? Yet, it would require that R-people who know some details about such communications contact them.. Best regards S?ren ________________________________ Fra: Robin Hankin [mailto:r.hankin at noc.soton.ac.uk] Sendt: on 13-07-2005 09:04 Til: Gabor Grothendieck Cc: S?ren H?jsgaard; Duncan Murdoch; r-devel at stat.math.ethz.ch Emne: Re: [Rd] Computer algebra in R - would that be an idea?? Hi guys another option would be David Gillespie's "calc", which is written in emacs lisp. This is a stable system with (AFAICS) as large user base. Unfortunately, it doesn't seem to be actively developed, as the last stable version (2.02f) appears to be 1996. I don't know if this would be a contraindication. Robin On 13 Jul 2005, at 02:36, Gabor Grothendieck wrote:> I don't know which free system is best. I have mainly used Yacas > but my needs to date have been pretty minimal so I suspect > any of them would have worked. > > Eric's COM solution, once I have it figured out, will likely get me > to the next step on Windows. I did some googling around and > found this: > > http://www.koders.com/python/ > fidDCC1B0FBFABC770277A28835D5FFADC9D25FF54E.aspx > > which is a python interface to Yacas which may give some ideas > on how to interface it to R. > > > On 7/12/05, S?ren H?jsgaard <Soren.Hojsgaard at agrsci.dk> wrote: > >> Personally, I like Maxima better than Yacas, but in both cases the >> solution (at least a minimal one) should be doable: A small >> program which pipes R commands into a terminal running Maxima/ >> Yacas and taking the output back into R. I am not much into the >> technical details, but isn't that what can be done with the COM >> automatation server on Windows?? (I don't know what the equivalent >> would be on unix?). >> Best regards >> S?ren >> >> ________________________________ >> >> Fra: Simon Blomberg [mailto:Simon.Blomberg at anu.edu.au] >> Sendt: on 13-07-2005 01:52 >> Til: Duncan Murdoch; Gabor Grothendieck >> Cc: S?ren H?jsgaard; r-devel at stat.math.ethz.ch >> Emne: Re: [Rd] Computer algebra in R - would that be an idea?? >> >> >> >> I would use such a symbolic math package for R. I have dreamt of an >> open-source solution with functionality similar to mathStatica. >> http://www.mathstatica.com/ Is yacas the best system to consider? >> What >> about Maxima http://maxima.sourceforge.net/, which is also GPL, >> or maybe >> Axiom http://savannah.nongnu.org/projects/axiom, which has a >> modified BSD >> license? >> >> Cheers, >> >> Simon. >> >> At 01:25 AM 13/07/2005, Duncan Murdoch wrote: >> >>> On 7/12/2005 10:57 AM, Gabor Grothendieck wrote: >>> >>>> On 7/12/05, S?ren H?jsgaard <Soren.Hojsgaard at agrsci.dk> wrote: >>>> >>>>>> From time to time people request symbolic computations beyond >>>>>> what >>>>>> >>> D() and deriv() etc can provide. A brief look at the internet >>> shows that >>> there are many more or less developed computer algebra packages >>> freely >>> available. Therefore, I wondered if it would be an idea to try to >>> 'integrate' one of these packages in R, which I guess can be done >>> in more >>> or less elegant ways... I do not know any of the computer algebra >>> people >>> around the World, but perhaps some other people from the R- >>> community do >>> and would be able to/interested in establishing such a connection... >>> >>>> >>>> >>>> Coincidentally I asked the yacas developer about this just >>>> yesterday: >>>> >>>> >>> http://sourceforge.net/mailarchive/forum.php? >>> thread_id=7711431&forum_id=2216 >>> >>> It sounds like developing an R package to act as a wrapper would >>> be the >>> best approach. I didn't see documentation for their API (the >>> exports of >>> their DLL), but I didn't spend long looking. >>> >>> Duncan Murdoch >>> >>> ______________________________________________ >>> R-devel at r-project.org mailing list >>> https://stat.ethz.ch/mailman/listinfo/r-devel >>> >> >> Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat. >> Centre for Resource and Environmental Studies >> The Australian National University >> Canberra ACT 0200 >> Australia >> T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au >> F: +61 2 6125 0757 >> CRICOS Provider # 00120C >> >> >> >> >> >> > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >-- Robin Hankin Uncertainty Analyst National Oceanography Centre, Southampton European Way, Southampton SO14 3ZH, UK tel 023-8059-7743
Søren Højsgaard
2005-Jul-15 00:21 UTC
[Rd] Computer algebra in R - would that be an idea??
Perhaps, this is the wrong mailing list, but I've been thinking about calling e.g. maxima from R through some kind of wrapper. On windows, maxima can be invoked through a file called maxima.bat which opens a simple 'dos terminal' in which maxima is running. A simple way of interfacing R and maxima would be through a function which 'copies' a text string into such a dos terminal with maxima running and copies the output back into R. That particular task is something which one might want to be able to do with several other programs too... A way of doing this would be through the system() and/or shell() functions where input and output can be redirected to/from the program called, e.g. maxima. The problem is, that system()/shell() will start maxima, execute the submitted code and terminate maxima. As I understand it, RDCOMClient provides a way of getting a 'handle' on such a program provided that the program is written in a specific way - something to do with COM. However, I wonder if it would be possible to write a general R function, (e.g. called dynamicshell()) which would provide a handle on such an application and to which one could send commands and retrieve output without shutting the application down. That is, essentially, a programatic form of 'copy and paste' in two directions... Is there anything in the way R is constructed that prevents that such a function could be written, and if so can anyone explain to me why and/or point me to a reference explaining why. Best regards S?ren ________________________________ Fra: Simon Blomberg [mailto:Simon.Blomberg at anu.edu.au] Sendt: on 13-07-2005 04:42 Til: Gabor Grothendieck; S?ren H?jsgaard Cc: Duncan Murdoch; r-devel at stat.math.ethz.ch Emne: Re: [Rd] Computer algebra in R - would that be an idea?? Another approach might be to construct a wrapper for Aldor code, along the lines of .Fortran and .C. Aldor is the extension language for AXIOM http://www.aldor.org/, and there is a symbolic algebra library available for Aldor http://www-sop.inria.fr/cafe/Manuel.Bronstein/algebra, which ships with the Aldor compiler. Of course, I am much better at thinking up these ideas than implementing them myself. :-) Simon. At 11:36 AM 13/07/2005, Gabor Grothendieck wrote:>I don't know which free system is best. I have mainly used Yacas >but my needs to date have been pretty minimal so I suspect >any of them would have worked. > >Eric's COM solution, once I have it figured out, will likely get me >to the next step on Windows. I did some googling around and >found this: > >http://www.koders.com/python/fidDCC1B0FBFABC770277A28835D5FFADC9D25FF54E.aspx > >which is a python interface to Yacas which may give some ideas >on how to interface it to R. > > >On 7/12/05, S?ren H?jsgaard <Soren.Hojsgaard at agrsci.dk> wrote: > > Personally, I like Maxima better than Yacas, but in both cases the > solution (at least a minimal one) should be doable: A small program which > pipes R commands into a terminal running Maxima/Yacas and taking the > output back into R. I am not much into the technical details, but isn't > that what can be done with the COM automatation server on Windows?? (I > don't know what the equivalent would be on unix?). > > Best regards > > S?ren > > > > ________________________________ > > > > Fra: Simon Blomberg [mailto:Simon.Blomberg at anu.edu.au] > > Sendt: on 13-07-2005 01:52 > > Til: Duncan Murdoch; Gabor Grothendieck > > Cc: S?ren H?jsgaard; r-devel at stat.math.ethz.ch > > Emne: Re: [Rd] Computer algebra in R - would that be an idea?? > > > > > > > > I would use such a symbolic math package for R. I have dreamt of an > > open-source solution with functionality similar to mathStatica. > > http://www.mathstatica.com/ Is yacas the best system to consider? What > > about Maxima http://maxima.sourceforge.net/, which is also GPL, or maybe > > Axiom http://savannah.nongnu.org/projects/axiom, which has a modified BSD > > license? > > > > Cheers, > > > > Simon. > > > > At 01:25 AM 13/07/2005, Duncan Murdoch wrote: > > >On 7/12/2005 10:57 AM, Gabor Grothendieck wrote: > > > > On 7/12/05, S?ren H?jsgaard <Soren.Hojsgaard at agrsci.dk> wrote: > > > >> >From time to time people request symbolic computations beyond what > > > D() and deriv() etc can provide. A brief look at the internet shows that > > > there are many more or less developed computer algebra packages freely > > > available. Therefore, I wondered if it would be an idea to try to > > > 'integrate' one of these packages in R, which I guess can be done in more > > > or less elegant ways... I do not know any of the computer algebra people > > > around the World, but perhaps some other people from the R-community do > > > and would be able to/interested in establishing such a connection... > > > > > > > > > > > > Coincidentally I asked the yacas developer about this just yesterday: > > > > > > > > http://sourceforge.net/mailarchive/forum.php?thread_id=7711431&forum_id=2216 > > > > > >It sounds like developing an R package to act as a wrapper would be the > > >best approach. I didn't see documentation for their API (the exports of > > >their DLL), but I didn't spend long looking. > > > > > >Duncan Murdoch > > > > > >______________________________________________ > > >R-devel at r-project.org mailing list > > >https://stat.ethz.ch/mailman/listinfo/r-devel > > > > Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat. > > Centre for Resource and Environmental Studies > > The Australian National University > > Canberra ACT 0200 > > Australia > > T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au > > F: +61 2 6125 0757 > > CRICOS Provider # 00120C > > > > > > > > > >
About a year ago there was a discussion about interfacing R with J on the J forum, the best method seemed to be that outlined in this vector article http://www.vector.org.uk/archive/v194/finn194.htm and use J instead of APL http://www.jsoftware.com
Gabor Grothendieck
2005-Jul-16 10:37 UTC
[Rd] Computer algebra in R - would that be an idea??
On 7/15/05, simon blomberg <blomsp at ozemail.com.au> wrote:> > > >>>>> "bry" == bry <bry at xdocs.dk> > > >>>>>> on Fri, 15 Jul 2005 14:16:46 +0200 writes: > > > > > > bry> About a year ago there was a discussion about interfacing R > > >with J on the J > > > bry> forum, the best method seemed to be that outlined in this > > >vector article > > > bry> http://www.vector.org.uk/archive/v194/finn194.htm > > > > > >(which is interesting to see for me, > > > if I had known that my posted functions would make it to an APL > > > workshop... > > > BTW: Does one need special plugins / fonts to properly view > > > the APL symbols ? ) > > > > > > > > > bry> and use J instead of APL > > > > > > bry> http://www.jsoftware.com > > > > > >well, I've learned about J as the ASCII-variant of APL, and APL > > >used to be my first `beloved' computer language (in high school!) > > >-- but does J really provide computer algebra in the sense of > > >Maxima , Maple or yacas... ?? > > > > I wonder if at this point it would be useful to think about how a > > symbolic algebra system might be used by R users, and whether that > > would affect the choice of system. For example, Maxima and yacas seem > > to be mostly concerned with "getting the job done", which might be > > all that the data analyst or occasional user needs. However, > > mathematical statisticians might be more concerned with developing > > new mathematics. For example, commutative algebra has been found to > > be very useful in the theory of experimental design (e.g. Pistone, > > Riccomagno, Wynn (2000) Algebraic Statistics: Computational > > Commutative Algebra in Statistics. Chapman & Hall). Now, Maxima can > > already do the necessary calculations (ie Groebner bases of > > polynomials), but as far as I know, yacas cannot. But who knows where >yacas does have the Groebner function, e.g. In> Groebner({x*(y-1),y*(x-1)}) Out> {x*y-x,x*y-y,y-x,y^2-y};
> > >yacas does have the Groebner function, e.g. > >In> Groebner({x*(y-1),y*(x-1)}) >Out> {x*y-x,x*y-y,y-x,y^2-y};I stand corrected. Simon. -- Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat. Centre for Resource and Environmental Studies The Australian National University Canberra ACT 0200 Australia T: +61 2 6125 7800 F: +61 2 6125 0757 CRICOS Provider # 00120C
Søren Højsgaard
2005-Jul-17 17:13 UTC
[Rd] Computer algebra in R - would that be an idea??
Sounds really nice... Due to a not-so-particularly-nice summer weather in Denmark, I have started writing a little package called 'yacasR' which communicates with Yacas through a socketConnection (on windows, I don't know how general this communication method is??). I'll try to 'polish' the package a bit more within the next few days and afterwards post it somewhere (not on CRAN, though). If the yacasR idea can fly, I hope more people will contribute to the package... However, it would be really good if some of you who know more about the technical stuff, could find a way of making Yacas communicate with R more smoothly... Best regards S?ren ________________________________ Fra: r-devel-bounces at r-project.org p? vegne af Ayal Pinkus Sendt: s? 17-07-2005 12:06 Til: R-devel at r-project.org Emne: Re: [Rd] Computer algebra in R - would that be an idea?? Hi, I am the maintainer of Yacas. I decided to join this mailing list after having heard that the option of linking R to Yacas was being discussed. Please don't hesitate to ask if you have questions, I will try to find the time to help. Ayal On Jul 17, 2005, at 8:11 AM, simon blomberg wrote:>> >> >> yacas does have the Groebner function, e.g. >> >> In> Groebner({x*(y-1),y*(x-1)}) >> Out> {x*y-x,x*y-y,y-x,y^2-y}; >> > > I stand corrected. > > Simon. > > -- > Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat. > Centre for Resource and Environmental Studies > The Australian National University > Canberra ACT 0200 > Australia > > T: +61 2 6125 7800 > F: +61 2 6125 0757 > > CRICOS Provider # 00120C > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > >______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Hi,> > This looks promising. Thanks for starting it off > and being so enthusiastic. >It does sound like a fun thing, and I think this will be very little work for me.> Taking a look at the APIs for Perl, Python, R, Tcl, Java, etc. > would also be good. One thing that all of these provide is > a specific typedef for an object. I imagine Yacas does also, > so rather than returning void *, it would be nicer to > return that type. >Good point to have type safety. But Yacas uses classes. A number will actually be a different object from a string, but derived from the same base class. The void* would simply mean a pointer to something derived from the base class. We can perhaps typedef a YacasObject, to be a pointer to void. Would that already provide enough safety? The other option indeed is to allow full access to the internals. For this I would probably need to expose the entire set of header files, not just the file cyacas.h. To me it feels more elegant to expose just what one wants to expose, hence the clear API definition. We can export certain methods of certain classes, so you could actually just call LispAtom::New or LispSubList::New, literally the classes that are already available. The disadvantage with exposing the full internals is that I would basically be promising that the internals will never change in the future. The API abstracts away the internals. There are discussions currently going on on changing the representation of the trees internally, to experiment with different algorithms. It is a matter of design. I am ok with exposing all the internals, but I would rather not promise that I will not overhaul the internals. Ayal
Søren Højsgaard
2005-Jul-17 21:09 UTC
[Rd] Computer algebra in R - would that be an idea??
On my homepage, http://genetics.agrsci.dk/~sorenh/misc/ there is now a small yacasR package (runs on windows only). Feel free to comment - or laugh! S?ren ________________________________ Fra: r-devel-bounces at r-project.org p? vegne af Gabor Grothendieck Sendt: s? 17-07-2005 21:15 Til: Ayal Pinkus Cc: R-devel at r-project.org Emne: Re: [Rd] Computer algebra in R - would that be an idea?? On 7/17/05, Ayal Pinkus <apinkus at xs4all.nl> wrote:> > > Hi, > > > > > R builds fine under Windows (though you need to pay attention to > > the details > > which are in the (binary) distribution in the pdf files, in > > particular: `R > > Installation and Administration Manual', a html copy is also on the > > website; > > and the README* and INSTALL files in src/gnuwin32/ ). These > > details look > > tedious at first, and you may have to install a few things, but it > > keeps the > > sources closely tied between Windoze and the Unixish operating > > systems on > > which many of us prefer to develop. > > > > Ok. Unfortunately I work on a Mac OS X at home (I have access to > Windows, MS DevStudio > at work but want to keep work and hobby separate). I do work with > Xcode (have to > delve deeper in to Cocoa still though). Can integration also be done > on Mac OS X? > If I understood correctly you go the COM route for integration on > Windows? > > CrystalSpace is a 3d engine that has a COM simulation layer for Unix- > style platforms > I think (last time I looked was a few years back). It would > essentially be a thin layer > to implementations of abstract classes. > > I did download R for Mac OS X. It is quite a nice package! I wish I > had looked at it earlier. > You did a very good job on the user interface.Note that there are also quite a few addon GUIs that various people have created for R, as well. See http://www.sciviews.org/_rgui/ where they are listed down the left hand side of the page. JGR, and possibly several others on the list, are written in Java. R can also be accessed directly online at: http://www.math.montana.edu/Rweb/ and other sites. ______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel