Opened 6 years ago

Last modified 5 weeks ago

## #22069 new defect

# Coefficients of truncated series bug

Reported by: | pluschny | Owned by: | |
---|---|---|---|

Priority: | major | Milestone: | |

Component: | symbolics | Keywords: | coefficients |

Cc: | slelievre | Merged in: | |

Authors: | Reviewers: | ||

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

Branch: | Commit: | ||

Dependencies: | Stopgaps: |

### Description

This has been reported on AskSM.

At least in some cases coefficients() does not return the leading coefficient.

Example:

g = lambda x, n: (1 + x

^{2})^{n}+ n*x*(1 + x^{2})^{(n - 1)}

g(x,4).series(x,12).coefficients()

Returns:

[ [1, 0], [4, 1], [4, 2], [12, 3], [6, 4], [12, 5], [4, 6], [4, 7] ]

Compare with the deprecated coeffs() which returns correct values:

[ [1, 0], [4, 1], [4, 2], [12, 3], [6, 4], [12, 5], [4, 6], [4, 7], [1, 8] ]

### Change History (4)

### comment:1 Changed 6 years ago by

### comment:2 Changed 6 years ago by

Component: | algebra → symbolics |
---|

### comment:3 Changed 6 years ago by

Summary: | Coefficients → Coefficients of truncated series bug |
---|

### comment:4 Changed 5 weeks ago by

Milestone: | sage-7.5 |
---|

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

Just a hint, to expand expressions as

`g(x,4)`

you better use`expand`

instead of`series`

. The bug seems associated with truncated series so this is also a workaround.