Opened 5 years ago

Closed 3 years ago

#16203 closed defect (fixed)

conversion from SR.series to PowerSeries

Reported by: rws Owned by:
Priority: major Milestone: sage-7.2
Component: algebra Keywords: series conversion days71
Cc: kcrisman Merged in:
Authors: Ralf Stephan Reviewers: Maurizio Monge, Marc Mezzarobba
Report Upstream: N/A Work issues:
Branch: aa9c05c (Commits) Commit: aa9c05c65a43fc26d947dfadcdc7fe77156a614e
Dependencies: #17399, #17438, #17659 Stopgaps:

Description (last modified by rws)

sage: R.<x> = PowerSeriesRing(SR)
sage: var('y')
y
sage: ex=1/(1-y)
sage: ex.series(y,20)
1 + 1*y + 1*y^2 + 1*y^3 + 1*y^4 + 1*y^5 + 1*y^6 + 1*y^7 + 1*y^8 + 1*y^9 + 1*y^10 + 1*y^11 + 1*y^12 + 1*y^13 + 1*y^14 + 1*y^15 + 1*y^16 + 1*y^17 + 1*y^18 + 1*y^19 + Order(y^20)
sage: s=R(_); s
1 + y + y^2 + y^3 + y^4 + y^5 + y^6 + y^7 + y^8 + y^9 + y^10 + y^11 + y^12 + y^13 + y^14 + y^15 + y^16 + y^17 + y^18 + y^19 + Order(y^20)
sage: type(s)
<type 'sage.rings.power_series_poly.PowerSeries_poly'>
sage: s.list()
[1 + 1*y + 1*y^2 + 1*y^3 + 1*y^4 + 1*y^5 + 1*y^6 + 1*y^7 + 1*y^8 + 1*y^9 + 1*y^10 + 1*y^11 + 1*y^12 + 1*y^13 + 1*y^14 + 1*y^15 + 1*y^16 + 1*y^17 + 1*y^18 + 1*y^19 + Order(y^20)]

The correct result would be 1 + x + x^2.... Obviously Order(20) is not recognized as a marker for the existence of a power series. The whole symbolic expression is taken as a constant.

Also reported in http://ask.sagemath.org/question/24777/how-to-convert-a-taylor-polynomial-to-a-power-series/ and http://ask.sagemath.org/question/24968/coefficients-in-polynomial-ring-over-symbolic-ring/

Change History (29)

comment:1 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:2 Changed 4 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4

comment:3 Changed 4 years ago by rws

  • Description modified (diff)

comment:4 Changed 4 years ago by rws

  • Description modified (diff)

comment:5 Changed 4 years ago by kcrisman

  • Cc kcrisman added

comment:6 Changed 4 years ago by rws

  • Branch set to u/rws/conversion_from_sr_series___to_powerseries_sr__gives_unexpected_result

comment:7 Changed 4 years ago by rws

  • Commit set to 0a43e2185b5a218184ee64dc2f2a3d6d4c4d0de6
  • Dependencies set to #17399, #17438

New commits:

32ae67c17399: do not let maxima handle ex.series coefficients
0a43e2116203: preliminary implementation, dependent on 17399, 17438

comment:8 Changed 4 years ago by rws

  • Branch u/rws/conversion_from_sr_series___to_powerseries_sr__gives_unexpected_result deleted
  • Commit 0a43e2185b5a218184ee64dc2f2a3d6d4c4d0de6 deleted

comment:9 Changed 4 years ago by rws

  • Branch set to public/16203

comment:10 Changed 4 years ago by rws

  • Commit set to 53b2ca4e5f0c07c2c4e16d6fc6ee71f15ad29093
  • Status changed from new to needs_review
  • Summary changed from conversion from SR.series() to PowerSeries(SR) gives unexpected result to conversion from SR.series to PowerSeries

This also resolves #16198


New commits:

32ae67c17399: do not let maxima handle ex.series coefficients
99820cf17399: roll back previous commit to allow merge of 17428
d7da52c17438: implement coeff list
9452fa917438: deprecate ex.coeff/coeffs()
0fec12917438: implement ex.list()
168b659Merge branch 'u/rws/coefficients_of_symbolic_expressions_revamp' of trac.sagemath.org:sage into t/17399/fix_coefficients_for_symbolic_series
6cd528617399: handle series in ex.coefficients()
53b2ca416203: implement conversion SR.series --> PowerSeries

comment:11 follow-up: Changed 4 years ago by tscrim

As currently stated in the description, this is the correct result as the variable for PowerSeriesRing is x, whereas we have some symbolic expression in y (so is naturally an element in the coefficient ring). Having mismatched variable names automatically converting over seems fraught with problems and could lead to subtle bugs.

comment:12 in reply to: ↑ 11 Changed 4 years ago by rws

Replying to tscrim:

As currently stated in the description, this is the correct result as the variable for PowerSeriesRing is x, whereas we have some symbolic expression in y (so is naturally an element in the coefficient ring). Having mismatched variable names automatically converting over seems fraught with problems and could lead to subtle bugs.

I see. So, conversion to an existing power series ring should only be allowed if the series expansion variable has the same name as the ring var. Multiple vars aren't supported by SR.series anyway.

comment:13 Changed 4 years ago by git

  • Commit changed from 53b2ca4e5f0c07c2c4e16d6fc6ee71f15ad29093 to e1a90393ca47a2f057cd43231b8f67ec05443748

Branch pushed to git repo; I updated commit sha1. New commits:

e1a903916203: implement ex.series_variable; disallow ex.series conversion into mismatched PowerSeries ring element

comment:14 Changed 4 years ago by rws

  • Authors set to Ralf Stephan

comment:15 Changed 4 years ago by rws

  • Branch changed from public/16203 to public/16203-1

comment:16 Changed 4 years ago by rws

  • Commit changed from e1a90393ca47a2f057cd43231b8f67ec05443748 to 3ece975a59933edd7e742dbdc665ab85e1f9dafb
  • Dependencies changed from #17399, #17438 to #17399, #17438, #17659

New commits:

3ece97516203: conversion from SR.series to PowerSeries

comment:17 Changed 4 years ago by git

  • Commit changed from 3ece975a59933edd7e742dbdc665ab85e1f9dafb to 84bc4fb0a28b4094da5fc130d08de00e862bd2a0

Branch pushed to git repo; I updated commit sha1. New commits:

8c4aceaMerge branch 'develop' into t/16203/public/16203-1
84bc4fb16203: sync with 17659

comment:18 Changed 4 years ago by git

  • Commit changed from 84bc4fb0a28b4094da5fc130d08de00e862bd2a0 to 1d363e0f7758d02b6d36ad968016ce68a50919d1

Branch pushed to git repo; I updated commit sha1. New commits:

1d363e016203: fixes

comment:19 Changed 4 years ago by git

  • Commit changed from 1d363e0f7758d02b6d36ad968016ce68a50919d1 to 50cb33cc5e93de8679d7b4c7e2134320ca462a6f

Branch pushed to git repo; I updated commit sha1. New commits:

50cb33cMerge branch 'develop' into t/16203/public/16203-1

comment:20 Changed 4 years ago by rws

  • Milestone changed from sage-6.4 to sage-pending

Pending because #17659 is pending.

comment:21 Changed 3 years ago by rws

  • Branch changed from public/16203-1 to public/16203-2

comment:22 Changed 3 years ago by rws

  • Commit changed from 50cb33cc5e93de8679d7b4c7e2134320ca462a6f to 9cb0cc909988327b9a4a94e20743e95fbccae11c
  • Milestone changed from sage-pending to sage-7.2

New commits:

9cb0cc9Merge branch 'public/16203-1' of trac.sagemath.org:sage into tmp06

comment:23 Changed 3 years ago by maurimo

  • Keywords days71 added
  • Reviewers set to Maurizio Monge
  • Status changed from needs_review to needs_work

"is" should be "==". The changes to ring.pyx are unrelated and should be removed. Everything else looks alright.

comment:24 Changed 3 years ago by rws

  • Branch changed from public/16203-2 to public/16203-3

comment:25 Changed 3 years ago by rws

  • Commit changed from 9cb0cc909988327b9a4a94e20743e95fbccae11c to ec8c797a4c57ac144d23c93749ad2e6f7ca5f9c7
  • Status changed from needs_work to needs_review

New commits:

ec8c79716203: conversion from SR.series to PowerSeries

comment:26 Changed 3 years ago by git

  • Commit changed from ec8c797a4c57ac144d23c93749ad2e6f7ca5f9c7 to aa9c05c65a43fc26d947dfadcdc7fe77156a614e

Branch pushed to git repo; I updated commit sha1. New commits:

aa9c05c16203: fix string cmp

comment:27 Changed 3 years ago by mmezzarobba

  • Reviewers changed from Maurizio Monge to Maurizio Monge, Marc Mezzarobba
  • Status changed from needs_review to positive_review

comment:28 Changed 3 years ago by rws

Thanks!

comment:29 Changed 3 years ago by vbraun

  • Branch changed from public/16203-3 to aa9c05c65a43fc26d947dfadcdc7fe77156a614e
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.