Roots of unity
Bob McElrath
mcelrath at draal.physics.wisc.edu
Fri Jan 18 21:04:03 CET 2002
Hans Peter Würmli [wurmli at freesurf.ch] wrote:
>
>
> Why don't you define a simple function like:
>
> numeric qrt(numeric n){
> if (n>=0) return pow(n,numeric(1)/numeric(3));
> else return -pow(-n,numeric(1)/numeric(3));
> }
>
> and use that in your particular problem.
Because it's the symbolic expression I'm interested in, and I can't test if
n >= 0.
I suppose I could make a:
class nthroot : public function {
public:
nthroot(numeric n, ex arg);
// ...
and override the evalf function for it (I'm not sure how to do this). But I
was hoping this could be incorporated into pow() since the problem crops up for
any pow() with a fractional exponent.
Cheers,
-- Bob
Bob McElrath (rsmcelrath at students.wisc.edu)
Univ. of Wisconsin at Madison, Department of Physics
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 240 bytes
Desc: not available
Url : http://www.cebix.net/pipermail/ginac-list/attachments/20020118/cb17772f/attachment.pgp
More information about the GiNaC-list
mailing list