Opened 4 years ago

Closed 3 years ago

#8943 closed enhancement (fixed)

RuntimeError with series

Reported by: casamayou Owned by: burcin
Priority: minor Milestone: sage-4.7.1
Component: calculus Keywords: series, taylor
Cc: Merged in: sage-4.7.1.alpha1
Authors: Alexei Sheplyakov, Burcin Erocal Reviewers: Karl-Dieter Crisman
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: #11317 Stopgaps:

Description (last modified by casamayou)

The function *series* can not give the power series expansion of f(x)=(1+arctan(x))(1/x) , while *taylor* succeeds. Note that the function f can be continuously extended at 0.

sage: taylor((1+arctan(x))**(1/x), x, 0, 3)
1/16*x^3*e + 1/8*x^2*e - 1/2*x*e + e
sage: ((1+arctan(x))**(1/x)).series(x==0, 3)
RuntimeError: power::eval(): division by zero

Subsidiary question: why the functions *taylor* and *series* perform similar tasks, but differently?

Attachments (1)

trac_8943-series.patch (860 bytes) - added by burcin 3 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 4 years ago by casamayou

  • Description modified (diff)

comment:2 Changed 3 years ago by kcrisman

  • Priority changed from trivial to minor

Looks like this is in Ginac/Pynac?. But maybe it makes sense not to have an answer here? After all, the technical definition would imply that f doesn't have a Taylor series there, if it doesn't even exist. Probably Maxima is more lenient about such things.

Changed 3 years ago by burcin

comment:3 Changed 3 years ago by burcin

  • Authors set to Alexei Sheplyakov, Burcin Erocal

This was fixed upstream in ginac. The changes will be in the next pynac release. Patch with doctest is attached.

comment:4 Changed 3 years ago by burcin

  • Dependencies set to 11317
  • Status changed from new to needs_review

New pynac package with the fix is at #11317.

comment:5 Changed 3 years ago by kcrisman

  • Reviewers set to Karl-Dieter Crisman
  • Status changed from needs_review to positive_review

This is nice, and the other examples given by the author also did not work before but now do:

sage: (cos(x)^(sin(x)/x)).series(x==0,9)
1 + (-1/2)*x^2 + 1/8*x^4 + (-1/30)*x^6 + 631/120960*x^8 + Order(x^9)
sage: ((1+x)^(1/x)).series(x==0,9)
(e) + (-1/2*e)*x + (11/24*e)*x^2 + (-7/16*e)*x^3 + (2447/5760*e)*x^4 + (-959/2304*e)*x^5 + (238043/580608*e)*x^6 + (-67223/165888*e)*x^7 + (559440199/1393459200*e)*x^8 + Order(x^9)

Also, the new series does correctly approximate the original function near x=0 :)

comment:6 Changed 3 years ago by jdemeyer

  • Dependencies changed from 11317 to #11317
  • Milestone changed from sage-4.7 to sage-4.7.1

comment:7 Changed 3 years ago by jdemeyer

  • Merged in set to sage-4.7.1.alpha1
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.