Opened 10 years ago

Closed 7 years ago

#12255 closed defect (fixed)

coeffs() fails on symbolic functions

Reported by: mjo Owned by: burcin
Priority: major Milestone: sage-6.5
Component: symbolics Keywords:
Cc: Merged in:
Authors: Michael Orlitzky Reviewers: Ralf Stephan
Report Upstream: N/A Work issues:
Branch: 3c181a0 (Commits, GitHub, GitLab) Commit: 3c181a04188f5ccf6327b848c9c5b27a0e612667
Dependencies: Stopgaps:

Status badges

Description (last modified by mjo)

This was reported on sage-support:

As of 4.8.alpha6,

sage: g = function('g', var('t'))
sage: f = 3*g + g**2 + t
sage: f.coeffs(g)
ValueError: The name "g(t)" is not a valid Python identifier.

This didn't throw a ValueError? in 4.7,

sage: f.coeffs(g)
[[g(t)^2 + t + 3*g(t), 0]]

but the result was still not the expected one. The correct answer would be,

sage: f.coeffs(g)
[[t, 0],[3, 1], [1, 2]]

Change History (9)

comment:1 Changed 10 years ago by mjo

  • Description modified (diff)

comment:2 Changed 9 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:3 Changed 8 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:4 Changed 8 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:5 Changed 8 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4

comment:6 Changed 7 years ago by rws

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

This seems fixed now (still wasn't in 6.2):

/home/ralf/sage/src/bin/sage-ipython:1: DeprecationWarning: coeffs is deprecated. Please use coefficients instead.
See for details.
  #!/usr/bin/env python
[[t, 0], [3, 1], [1, 2]]

comment:7 Changed 7 years ago by mjo

  • Authors set to Michael Orlitzky
  • Branch set to u/mjo/ticket/12255
  • Commit set to 3c181a04188f5ccf6327b848c9c5b27a0e612667
  • Milestone changed from sage-duplicate/invalid/wontfix to sage-6.5

Indeed, but let's add a doctest to Expression.coefficients() if you don't mind.

New commits:

3c181a0Trac #12255: Add a doctest for the fixed behavior.

comment:8 Changed 7 years ago by rws

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

Is fine!

comment:9 Changed 7 years ago by vbraun

  • Branch changed from u/mjo/ticket/12255 to 3c181a04188f5ccf6327b848c9c5b27a0e612667
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.