Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#20017 closed enhancement (fixed)

implement cos and sin of power series

Reported by: chapoton Owned by:
Priority: major Milestone: sage-7.1
Component: calculus Keywords:
Cc: Merged in:
Authors: Frédéric Chapoton Reviewers: Ralf Stephan
Report Upstream: N/A Work issues:
Branch: a7cb277 (Commits) Commit:
Dependencies: Stopgaps:


As we already have exp and log.

Change History (5)

comment:1 Changed 5 years ago by chapoton

  • Branch set to u/chapoton/20017
  • Commit set to a7cb277b2445abe758660cd058ebdb05d3d16cab
  • Status changed from new to needs_review

This has been extracted from #14878.

New commits:

20163ebtrac #14878 sin for power series, step1
ed55e28trac #14878 step 2, cos for multi-variable power series
0a0921cMerge branch 'u/chapoton/14878' into 7.1.b0
2e093f6trac #14878 now sin and cos for all power series
a7cb277Merge branch 'u/chapoton/14878' into 7.1.b2

comment:2 Changed 5 years ago by rws

You're practically substituting into the series for x. This is fast for small order but may not be optimal for say 1000 coefficients.

You may be interested in general in a timing comparison. For Symengine there is a benchmark to compute sin(x+x^2)*cos(x+x^2) to order 1000 which needs 120ms using the Flint implementation on my machine. Your branch at the moment takes 2.1s which is not too bad.

comment:3 Changed 5 years ago by rws

  • Reviewers set to Ralf Stephan
  • Status changed from needs_review to positive_review

Apart from the not optimal performance at higher order this looks good. Please cc me with any further tickets like this.

sage: R.set_default_prec(100)
sage: time _ = sin(x*exp(x))
CPU times: user 44 ms, sys: 0 ns, total: 44 ms
Wall time: 44.7 ms
sage: R.set_default_prec(200)
sage: time _ = sin(x*exp(x))
CPU times: user 216 ms, sys: 0 ns, total: 216 ms
Wall time: 214 ms
sage: R.set_default_prec(300)
sage: time _ = sin(x*exp(x))
CPU times: user 660 ms, sys: 8 ms, total: 668 ms
Wall time: 667 ms
sage: R.set_default_prec(400)
sage: time _ = sin(x*exp(x))
CPU times: user 1.61 s, sys: 4 ms, total: 1.62 s
Wall time: 1.61 s
sage: R.set_default_prec(500)
sage: time _ = sin(x*exp(x))
CPU times: user 3.19 s, sys: 4 ms, total: 3.2 s
Wall time: 3.19 s

comment:4 Changed 5 years ago by vbraun

  • Branch changed from u/chapoton/20017 to a7cb277b2445abe758660cd058ebdb05d3d16cab
  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:5 Changed 4 years ago by rws

  • Commit a7cb277b2445abe758660cd058ebdb05d3d16cab deleted

The cases in comment:3 are computed about 10x faster by pynac-0.7.0.

Note: See TracTickets for help on using tickets.