[GiNaC-list] pyginac: numeric vs. ex and a failing test case

Jonathan Brandmeyer jbrandmeyer at earthlink.net
Sun Jan 16 23:44:04 CET 2005


On Sun, 2005-01-16 at 23:19 +0200, Matti Peltomäki wrote:

> This does not cause the same failure in the GiNaC test case since sparse_tree 
> returns an ex. However, in PyGiNaC the return value is unwrapped from ex
> to whatever type it is, and with a numeric, the problem above occurs. 
> 
> So, in the end, I'm left with the situation that I don't know how to 
> symbolically present something like cos(1) in PyGiNaC. Is it possible 
> in some way not obvious to me?

I think that the best solution is to not export the form of cos (and
friends) that takes a numeric argument.  That way, you always create a
ginac.function object rather than call a true free function.

This change requires you to use evalf() if you really want to evaluate
it numerically.

-Jonathan





More information about the GiNaC-list mailing list