[GiNaC-list] problem with function pow

Chris Dams Chris.Dams at mi.infn.it
Wed Feb 8 17:42:43 CET 2006


Dear Saurav,

On Wed, 2006-02-08 at 07:28 -0500, Saurav Pathak wrote:

> In real life, I get such strings from an external parser that converts 
> MathML.  Some functions are complicated and have other functions 
> embedded---for instance exponentials.  I don't want to further parse 
> such a string.

What about defining your own function then. For instance,
DECLARE_FUNCTION_2P(my_pow);
REGISTER_FUNCTION(my_pow,dummy());

In that case you would only need to change the word "pow" in the output
of your parser into "my_pow". After that you could use the constructor
that makes an ex from a string and then you could get a real power
object again by
doing .subs(my_pow(wild(0),wild(1))==power(wild(0),wild(1)).

Best,
Chris



More information about the GiNaC-list mailing list