[GiNaC-list] Any way to get the leading order of a series expansion?

Richard B. Kreckel kreckel at in.terlu.de
Tue May 16 00:36:59 CEST 2023


Hi Vitaly,

On 5/15/23 18:47, Vitaly Magerya wrote:
> Hi, all. We have some code needs to have the first N orders of
> a series expansion of an expression; so far we've been actually
> using sympy for this: there one can use series() [1] directly,
> as it computes "the first N orders", whereas in GiNaC series()
> expands "up to N-th order", so if I just need e.g. the leading
> order, then series() can't help me directly. Any idea of how can
> one get the leading order, or the first N orders with GiNaC?
> Would this need a lot of effort to implement?
> 
> [1] https://docs.sympy.org/latest/modules/series/series.html#sympy.series.series.series

Well, that's deliberate.

If I have a series of, say, exp(x) at 0 and another one of cos(x) at 0 
and you ask GiNaC to compute them to order N, then you get two series 
ending with the same Order(x^N), which you can add, zip, and compare 
term-by-term. In contrast, asking for "the first N orders" would get you 
about twice as far for cos(x) as for exp(x).

This was done for computations in dimensional regularization where one 
wants to make sure to catch all terms up to some pre-known order.

Maybe you could explain your use-case a bit more? Are you really 
interested in "the first N orders" or just "the leading order"?

All my best,
   -richy.
-- 
Richard B. Kreckel
<https://in.terlu.de/~kreckel/>



More information about the GiNaC-list mailing list