Opened 4 years ago

Last modified 4 years ago

## #20065 new enhancement

# Asymptotic Expansions: adaptive precision

Reported by: | cheuberg | Owned by: | |
---|---|---|---|

Priority: | major | Milestone: | sage-7.1 |

Component: | asymptotic expansions | Keywords: | performance |

Cc: | dkrenn, behackl | Merged in: | |

Authors: | Reviewers: | ||

Report Upstream: | N/A | Work issues: | |

Branch: | Commit: | ||

Dependencies: | Stopgaps: |

### Description (last modified by )

Try to predict the precision needed instead of relying on fixed default precision in order to speed up calulations.

Example:

sage: A.<n> = AsymptoticRing('n^QQ', QQ, default_prec=200) sage: ex = 1/n + O(1/n^2); ex n^(-1) + O(n^(-2)) sage: %time ex.subs(n=n+1) CPU times: user 1min 4s, sys: 0 ns, total: 1min 4s Wall time: 1min 4s n^(-1) + O(n^(-2)) sage: A.<n> = AsymptoticRing('n^QQ', QQ, default_prec=5) sage: ex = 1/n + O(1/n^2); ex n^(-1) + O(n^(-2)) sage: %time ex.subs(n=n+1) CPU times: user 56 ms, sys: 4 ms, total: 60 ms Wall time: 51.5 ms n^(-1) + O(n^(-2))

If inversion (or logarithm, exponentiation accepted a parameter `initial_error`

and started with this initial error instead of zero, then they would terminate much earlier. So substitution could start with the error terms and feed the current error into each successive step.

The same idea for singularity analysis is #20054.

See #17601 for the asymptotic expansions meta ticket.

**Note:**See TracTickets for help on using tickets.