asymptotic expansion of sin and cos at infinity

148 views
Skip to first unread message

Avichal Dayal

unread,
Feb 23, 2014, 11:36:44 AM2/23/14
to sy...@googlegroups.com
Gruntz uses the series code extensively and I've encountered the following error
quite a few times:-

PoleError:
Asymptotic expansion of cos around [oo] is not implemented.

If you use limit, answer is evaluated correctly to 0.

However there might be cases where we might need expansion of sin and cos to
correctly evaluate limit.

Since sin and cos do not converge at infinity and are bounded functions,
in my opinion asymptotic expansion of sin and cos at [oo] should be simply
Order(1), right?

I maybe wrong, but that would enable Gruntz to give the correct result.

Aaron Meurer

unread,
Feb 23, 2014, 3:01:50 PM2/23/14
to sy...@googlegroups.com
It sounds correct to me. Do things work if you make that change?

Aaron Meurer
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sympy.
> For more options, visit https://groups.google.com/groups/opt_out.

Avichal Dayal

unread,
Feb 24, 2014, 12:15:34 AM2/24/14
to sy...@googlegroups.com
It sounds correct to me. Do things work if you make that change?
No, I face some problems.
1) Series throws an error as the number of terms is not 6.
2) Even if I removed the above error, Gruntz hangs when calculating the following limit:-

gruntz(sin(x)/x**2, x, oo)

If this is the correct approach, I'll work on it and see what's causing it to hang.

Avichal Dayal

unread,
Feb 28, 2014, 12:02:25 PM2/28/14
to sy...@googlegroups.com
Currently the series method does not allow to return only the Order term.

That is because by default n=6, and since it does not get enough terms
it throws an error.

So, how would it detect that series obtained is the actual one and not an
error (since less terms are calculated)?

Sergey Kirpichev

unread,
Mar 1, 2014, 4:54:36 AM3/1/14
to sy...@googlegroups.com
On Friday, February 28, 2014 9:02:25 PM UTC+4, Avichal Dayal wrote:
Currently the series method does not allow to return only the Order term.

Why do you think so?

In [2]: O(1).series(x,n=100)
Out[2]: O(1)

> Since sin and cos do not converge at infinity and are bounded functions,
> in my opinion asymptotic expansion of sin and cos at [oo] should be simply
> Order(1), right?

Typo?  Perhaps, O(1, (x, oo))

Why you think, that that's
1) an expansion
2) the "right" one.

O(1) - just a set of function with some specific behaviour around x=0.

Avichal Dayal

unread,
Mar 1, 2014, 7:37:26 AM3/1/14
to sy...@googlegroups.com
Typo?  Perhaps, O(1, (x, oo))
Yes, I meant O(1, (x, oo))


Why you think, that that's
1) an expansion
2) the "right" one.
Yes, it's not an expansion and I'm not sure if it's right.
But then what should be the output for series(sin(x), x, oo)?
Currently it gives NotImplementedError.

Sergey B Kirpichev

unread,
Mar 1, 2014, 7:50:14 AM3/1/14
to sy...@googlegroups.com
On Sat, Mar 01, 2014 at 04:37:26AM -0800, Avichal Dayal wrote:
> But then what should be the output for series(sin(x), x, oo)?

Perhaps, something to indicate an error.

> Currently it gives NotImplementedError.

Maybe ValueError instead.

Alexey U. Gudchenko

unread,
Mar 1, 2014, 7:50:52 AM3/1/14
to sy...@googlegroups.com
I didn't found about this problem in the wiki pages and roadmaps


But I found the old diskuss in issue tracker

http://code.google.com/p/sympy/issues/detail?id=2200

--
Alexey Gudchenko

Avichal Dayal

unread,
Mar 1, 2014, 8:35:01 AM3/1/14
to sy...@googlegroups.com
Perhaps, something to indicate an error.
But there are instances where series(sin(x), x, oo) is used by other methods
For e.g.:- gruntz((sin(x) + cos(x)/x**2, x, oo) tries to find that series
If we raise an error, then those limits won't work (which should)

Sergey Kirpichev

unread,
Mar 1, 2014, 8:39:20 AM3/1/14
to sy...@googlegroups.com

Limit may work, if we implement algorithms to solve this kind
of problems.   gruntz() wont work, but it's expected.

Ondřej Čertík

unread,
Mar 4, 2014, 2:20:50 PM3/4/14
to sympy
I think the Gruntz algorithm actually might work for these as well ---
at the point after doing the expansion
in terms of omega, when you are determining the limit x->0, you just
need to be able to handle cases where
sin/cos are oscillating, but bounded. Depending on the case, the
result can either be finite, e.g.
x*sin(1/x) when x->0, or oscillating, then the limit doesn't exist. Etc.

Ondrej

Sergey B Kirpichev

unread,
Mar 5, 2014, 5:03:50 AM3/5/14
to sy...@googlegroups.com
On Tue, Mar 04, 2014 at 12:20:50PM -0700, Ondřej Čertík wrote:
> I think the Gruntz algorithm actually might work for these as well ---
> at the point after doing the expansion
> in terms of omega, when you are determining the limit x->0, you just
> need to be able to handle cases where
> sin/cos are oscillating, but bounded. Depending on the case, the
> result can either be finite, e.g.
> x*sin(1/x) when x->0, or oscillating, then the limit doesn't exist.

Gruntz suggests (pp. 86-87) that this problem may be solved with a
kind of interval calculus for mrv. But this would be some (unknown
yet) extension for the Gruntz algorithm.

Ondřej Čertík

unread,
Mar 5, 2014, 11:35:59 AM3/5/14
to sympy
That's right, it would be some new work.

Ondrej

someone

unread,
Mar 5, 2014, 7:23:46 PM3/5/14
to sy...@googlegroups.com
Hi,

> > Gruntz suggests (pp. 86-87) that this problem may be solved with a
> > kind of interval calculus for mrv. But this would be some (unknown
> > yet) extension for the Gruntz algorithm.
>
> That's right, it would be some new work.

Ok, very nice. So why not try it out right now?

Ondřej Čertík

unread,
Mar 6, 2014, 2:47:23 PM3/6/14
to sympy
Definitely, go for it!

Ondrej
Reply all
Reply to author
Forward
0 new messages