Opened 4 years ago

Closed 2 years ago

#19996 closed enhancement (fixed)

Implement extracting symbolic coefficient of rational exponent

Reported by: dkrenn Owned by:
Priority: major Milestone: sage-8.1
Component: symbolics Keywords:
Cc: Merged in:
Authors: Ralf Stephan Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: 6d8d994 (Commits) Commit: 6d8d9942ebfc4f9d8b83d52e0daca2146476cecf
Dependencies: #23820 Stopgaps:

Description (last modified by rws)

sage: (x^(1/2)).coefficient(x, 1/3)
sqrt(x)

It seems that 1/3 gets 0 (floor division, whyever).

EDIT: because the function takes an integer:

        INPUT:

        - ``s`` - expression

        - ``n`` - integer, default 1

so it's rather an enhancement.

Reported as https://github.com/pynac/pynac/issues/216

Change History (9)

comment:1 Changed 3 years ago by rws

  • Description modified (diff)
  • Report Upstream changed from N/A to Reported upstream. Developers acknowledge bug.

comment:2 Changed 3 years ago by rws

  • Description modified (diff)
  • Report Upstream changed from Reported upstream. Developers acknowledge bug. to Reported upstream. Developers deny it's a bug.
  • Summary changed from wrong result extracting symbolic coefficient (rational exponent) to Implement extracting symbolic coefficient of rational exponent
  • Type changed from defect to enhancement

comment:3 Changed 2 years ago by rws

  • Branch set to u/rws/implement_extracting_symbolic_coefficient_of_rational_exponent

comment:4 Changed 2 years ago by rws

  • Authors set to Ralf Stephan
  • Commit set to 484142a16b5efe58366424eb5e9dc9247b7fde8e
  • Dependencies set to pynac-0.7.11
  • Milestone changed from sage-7.1 to sage-8.1
  • Report Upstream changed from Reported upstream. Developers deny it's a bug. to Fixed upstream, in a later stable release.

This branch needs pynac-0.7.11+ and allows any coefficient. There is different behaviour in this doctest:

             sage: f = (a*sqrt(2))*x^2 + sin(y)*x^(1/2) + z^z
...
             sage: f.coefficient(x, 0)
-            sqrt(x)*sin(y) + z^z
+            z^z

New commits:

484142a19996: allow any n in ex.coefficient(x,n)

comment:5 Changed 2 years ago by rws

  • Dependencies changed from pynac-0.7.11 to #23820
  • Report Upstream changed from Fixed upstream, in a later stable release. to N/A

comment:6 Changed 2 years ago by git

  • Commit changed from 484142a16b5efe58366424eb5e9dc9247b7fde8e to 6d8d9942ebfc4f9d8b83d52e0daca2146476cecf

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

6d8d994Merge branch 'develop' into t/19996/implement_extracting_symbolic_coefficient_of_rational_exponent

comment:7 Changed 2 years ago by rws

  • Status changed from new to needs_review

comment:8 Changed 2 years ago by tscrim

  • Reviewers set to Travis Scrimshaw
  • Status changed from needs_review to positive_review

LGTM.

comment:9 Changed 2 years ago by vbraun

  • Branch changed from u/rws/implement_extracting_symbolic_coefficient_of_rational_exponent to 6d8d9942ebfc4f9d8b83d52e0daca2146476cecf
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.