Any way to get the leading order of a series expansion?
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...
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...
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/>
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).
I understand this use case, but ours is different. We have integrals that need to be expanded to a given order; each integral has a prefactor; we have our method of expanding integrals without prefactors, but we need to know the orders in advance, so knowing the leading order of the prefactor is an essential first step.
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"?
Just the leading order is sufficient.
On 5/16/23 09:42, Vitaly Magerya wrote:
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).
I understand this use case, but ours is different. We have integrals that need to be expanded to a given order; each integral has a prefactor; we have our method of expanding integrals without prefactors, but we need to know the orders in advance, so knowing the leading order of the prefactor is an essential first step.
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"?
Just the leading order is sufficient.
I guess some new code would have to be written to support this use case. -richy.
participants (2)
-
Richard B. Kreckel
-
Vitaly Magerya