[GiNaC-list] pole_error when expanding power into series

Camille Gillot k1000.jlo at wanadoo.fr
Tue Nov 2 16:23:24 CET 2010


You're absolutely right.
The is_a<numeric>(exponent) test should be replaced by just a 
exponent.has(r.lhs()).

Another version may be :

> if(exponent.has(r.lhs())) {
> 	try {
>		// detect exponent singularity
>		exponent.subs(r);
>		
>		// if none, try taylor
> 		return basic::series(r, order, options);
>	
> 	} catch(pole_error &) {
>		// in case of singularity, use this
> 		ex new_e = exponent*log(basis);
> 		new_e = new_e.series(r,order,options);
> 		return exp(new_e).series(r,order,options);
> 	}
> }

I don't know which version is the best, this one will speed up the simple 
series, but will try twice for the singularities.

Thanks for taking time fixing this.

C. Gillot


Le mardi 02 novembre 2010 15:35:00, Alexei Sheplyakov a écrit :
> Hello,
> 
> On Tue, Nov 2, 2010 at 1:34 PM, Camille Gillot <k1000.jlo at wanadoo.fr> wrote:
> > However, ginac 1.5.8 is unable to expand expressions like :
> > 
> > cos(x)^(sin(x)/x), even if it expands well sin(x)/x.
> > 
> > +       if(!is_a<numeric>(exponent)) {
> > +               ex new_exponent =
> > (exponent*log(basis)).series(r,order,options); +               return
> > exp(new_exponent).series(r,order,options); +       }
> 
> I think such transformation is way too aggressive (the exponent might not
> depend on x, there might be no singularity at all, etc). I'll try to
> fix this in a
> more careful way.
> 
> Best regards,
>         Alexei
> _______________________________________________
> GiNaC-list mailing list
> GiNaC-list at ginac.de
> https://www.cebix.net/mailman/listinfo/ginac-list




More information about the GiNaC-list mailing list