Pattern matching in GiNaC CVS

Do Hoang Son dhson at thep.physik.uni-mainz.de
Mon Jun 18 15:56:50 CEST 2001


On Mon, 18 Jun 2001, Christian Bauer wrote:

> On Mon, Jun 18, 2001 at 03:36:39PM +0200, Do Hoang Son wrote:
> > > > > c=subs(b,log($1)==Log($1));
> > > > unknown function 'Log'
> > > > ...
> > > > Of course, Log() is undefined one.
> > > 
> > > Correct. So?
> > 
> > It would be nice if such a substitution is accepted in ginsh. 
> 
> But there is no function named "Log" in GiNaC. What is ginsh supposed to do?
> Modify inifcns.h/.cpp and recompile GiNaC?

Hmmm, I don't know.
Just look at Maple 

> c:=ln(x*y)*z;
> subs(ln=foo,c);
foo(x*y)*z

or in Mathematica

In[1]:= c=Log[x*y]*z
 
Out[1]= z Log[x y]
 
In[2]:= c//. Log[a__]-> foo[a]
  
Out[2]= z foo[x y]

There is not any problem there.
One offent uses this trick to get rid of troubles that caused by a
difined/internal functions.
 
Don't tell me if it is stupid or not. 
Just want to know if this well known feature is possible to be implemented
in ginsh?

Son




More information about the GiNaC-devel mailing list