Opened 7 years ago

Closed 7 years ago

#16197 closed enhancement (duplicate)

provide missing function expansions of power series

Reported by: rws Owned by:
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: calculus Keywords: function, series expansion
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by rws)

Some functions do not support rings/power-series*:

sage: R.<x> = PowerSeriesRing(ZZ)
sage: sqrt(1-4*x^2)
1 - 2*x^2 - 2*x^4 - 4*x^6 - 10*x^8 - 28*x^10 - 84*x^12 - 264*x^14 - 858*x^16 - 2860*x^18 + O(x^20)
sage: sin(1+4*x^2)
...
TypeError: cannot coerce arguments: no canonical coercion from Power Series Ring in x over Integer Ring to Symbolic Ring

What is missing:

  • acos, acosh, asin, asinh, atan, atanh, cos, cosh, cotanh, dilog, gamma, intformal, lngamma, psi, sin, sinh, tan, tanh

Change History (11)

comment:1 Changed 7 years ago by kcrisman

Similarly to my other comment on this, I don't know if we want n(pi/4) in here or not...

Also, the regular SR one works fine:

sage: ex.series(X,16)
(sin(1)) + (4*cos(1))*X^2 + (-8*sin(1))*X^4 + (-32/3*cos(1))*X^6 + (32/3*sin(1))*X^8 + (128/15*cos(1))*X^10 + (-256/45*sin(1))*X^12 + (-1024/315*cos(1))*X^14 + Order(X^16)

so I'm not sure why you referenced it, though I agree that the error you get for power series rings is not ideal. Is there a way to either use SR for this (perhaps not "correct" for power series rings though?) or to get Pari to return a symbolic constant term?

sage: atan(4*X^2+1)
arctan(4*X^2 + 1)
sage: _.series(X,16)
(1/4*pi) + 2*X^2 + (-4)*X^4 + 16/3*X^6 + (-128/5)*X^10 + 256/3*X^12 + (-1024/7)*X^14 + Order(X^16)

What if the coefficients weren't rationals? Or integers? Note that in your example there is a 16/3 coefficient, which presumably isn't in the power series ring over integers. These may be dumb questions, but I'm just trying to explore what is really the desired behavior - certainly wrapping more Pari stuff is not a bad idea!

comment:2 follow-up: Changed 7 years ago by rws

Pari's symblic is not up to this. I'd consider it a bug that there is no default precision to SR series results (like with PowerSeries), so yes, if your last example would work without the 16 this ticket would rather be about my example sin(1+4*x^2)---it should simply work like series() and give back one instead of SR.

The rest of the ticket concerns possibly missing functions and I will move this to another ticket.

comment:3 in reply to: ↑ 2 ; follow-up: Changed 7 years ago by kcrisman

Pari's symblic is not up to this. I'd consider it a bug that there is no default precision to SR series results (like with PowerSeries), so yes, if your last example would work without the 16 this ticket would rather be about my example sin(1+4*x^2)---it should simply work like series() and give back one instead of SR.

Hmm, that's an interesting suggestion. One could imagine it's a bug the other way around, but I have no vested interest in this - I think a default for either one could be useful, in principle, and (importantly) wouldn't be backward-incompatible. But what would the default be? It's hard to imagine one non-arbitrary... hmm. What do Mathematica and/or Maple and/or Magma do with this? If there is a standard one could use that.

comment:4 in reply to: ↑ 3 Changed 7 years ago by rws

  • Description modified (diff)
  • Summary changed from provide function expansions of power series (from Pari) to provide missing function expansions of power series

I wrote earlier:

The rest of the ticket concerns possibly missing functions and I will move this to another ticket.

Nothing missing there except the a.g.m., fortunately.

Replying to kcrisman:

Hmm, that's an interesting suggestion. One could imagine it's a bug the other way around, but I have no vested interest in this - I think a default for either one could be useful, in principle, and (importantly) wouldn't be backward-incompatible. But what would the default be? It's hard to imagine one non-arbitrary... hmm.

This is now #16201

What do Mathematica and/or Maple and/or Magma do with this? If there is a standard one could use that.

If I ask for "cosine power series" in Wolfram Alpha I get 1-x^2/2+x^4/24-x^6/720+O(x^7)

comment:5 Changed 7 years ago by rws

Edit: my copy of another comment was unrelated so I deleted it

Last edited 7 years ago by rws (previous) (diff)

comment:6 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:7 Changed 7 years ago by rws

  • Milestone changed from sage-6.3 to sage-duplicate/invalid/wontfix
  • Status changed from new to needs_review

Closing as wontfix since all issues mentioned have their own tickets.

comment:8 Changed 7 years ago by kcrisman

I only see one ticket mentioned. Just for completeness, can you mention them (if there are others)?

comment:9 Changed 7 years ago by rws

Default symbolic expression series precision is #16201, and symbolic agm function is #16202.

comment:10 Changed 7 years ago by kcrisman

  • Status changed from needs_review to positive_review

comment:11 Changed 7 years ago by vbraun

  • Resolution set to duplicate
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.