On 26/08/2008, at 12:42 PM, William Stein wrote:

> 1) Let me clarify -- I *wrapped* the pattern matching already in  
> Pynac.
...
> and you
> can read about Ginac at the Ginac website: http://www.ginac.de/

Thanks for the clarification.  Sorry I missed the post about pynac--- 
I'm fairly quick to delete stuff.

In the spirit of clarification, I should say that I am not  
particularly batting for Lisp, Maxima or Mathematica, nor do I want to  
make sage look like Mathematica.  But this area of pattern matching is  
one where the Mathematica / Lisp way of doing things is extremely  
instructive.  That is the only reason I am rabbitting on about it.

>>           sage: sin(1+sin(x)).subs(sin(w0)==cos(w0))
>>           cos(cos(x) + 1)
>>
>> In Mathematica, the result would be cos(sin(x) + 1), since having  
>> matched
>> the outer expression, the replacement algorithm moves on rather  
>> than in.
>> One would obtain cos(cos(x) + 1) by making the substitution rule  
>> sin==cos.
>> Can you do that?  Can you evaluate code during the matching of your
>> patterns?  Can you nest patterns?  I think these are highly  
>> desirable, even
>> if they are suitably carefully hidden from the casual user.
>
> I didn't implement the pattern matching. I wrapped the pattern  
> matching
> that is provided by GiNaC.  It is certainly not identical to the  
> pattern
> matching in Mathematica, at present.  I'm glad you're pointing out  
> some
> of the differences between what is in Mathematica and what is in  
> Ginac.
> Thanks!

I see.  (Sorry for sounding like I was jumping down your throat.)  I  
was actually asking what capabilities you envisage.  From looking at  
ginac, I think there's a good chance that it does all those things.

>> We already have a pretty good "symbolic engine" in Sage, maxima does
>> quite a good job of solving integrals, limits, etc. The main problem
>> with Maxima is that we cannot extend it.
>>
>> Is "not extending of Maxima" a concrete policy?
>
> Maxima is definitely not the future of symbolic manipulation *in  
> Sage*:

I don't know maxima well enough to have opinions on that, (except that  
it looked like a good idea at the time.)

>   (2) Maxima is written in Lisp.  This is a total show stopper for  
> most
> Sage developers, including me.

In the spirit of "learning a new programming paradigm makes you a  
better programmer" I strongly recommend this page:
http://www.defmacro.org/ramblings/lisp.html

In any case, ginac might just be a good, non-buggy, reimplementation  
of just that part of lisp we need, and one that is more efficient for  
the problem at hand.

>> I understand that maxima
>> sucks in some circumstances, but it seems quite the beast here.
>> I am quite confused about a lot of the pattern matching  
>> discussion.  AFAICT,
>> that is the problem for which lisp rocks, and the best way to do it  
>> is
>> probably to write maxima code for it.  And the best way to make it
>> accessible from python is to provide pretty python methods to call  
>> lisp.
>> Any other suitably general form of pattern mathematical matching will
>> involve the proverbial reimplementation of lisp.
>
> That would be a waste of time for Sage.  No matter how good Maxima
> is or its pattern matching is, Maxima is still working in it's own
> world of objects
> and data types, which have nothing much to do with Python's.  Maxima/ 
> Axiom
> live on a totally different planet than Python/C/C++.   This is just  
> a fact
> we have to deal with.

I actually don't understand this.  For both pynac and the existing  
maxima link, I think you must already have some method of transforming  
a python object to and from lisp-like expressions.  I suppose it might  
be problematically inefficient.  At any rate, I am not after  
implementation details at the moment, sorry for bringing that furphy up.

D

==================================
David J Philp
Postdoctoral Fellow
National Centre for Epidemiology and Population Health
Building 62, cnr Mills Rd & Eggleston Rd
The Australian National University
Canberra ACT 0200 Australia

T: +61 2 6125 8260
F: +61 2 6125 0740
M: 0423 535 397
W: http://nceph.anu.edu.au/

CRICOS Provider #00120C





--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to