Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Expression.coefficient(...expand=True) keyword #20824

Open
rwst opened this issue Jun 14, 2016 · 15 comments
Open

Add Expression.coefficient(...expand=True) keyword #20824

rwst opened this issue Jun 14, 2016 · 15 comments

Comments

@rwst
Copy link

rwst commented Jun 14, 2016

There is no reason why there should be different results:

sage: (x*(x*y+y^2)).coefficient(x)
y
sage: (x*(x*y+y^2)).coefficient(x,2)
0
sage: (x*(x*y+y^2)).expand().coefficient(x)
y^2
sage: (x*(x*y+y^2)).expand().coefficient(x,2)
y

This would also be unsurprising for Mma users, see #9505 comment:6

Maybe add keyword expand=True.

Component: symbolics

Author: Ralf Stephan

Branch/Commit: u/rws/20824 @ 7ab049f

Issue created by migration from https://trac.sagemath.org/ticket/20824

@rwst rwst added this to the sage-7.3 milestone Jun 14, 2016
@rwst

This comment has been minimized.

@rwst rwst changed the title Expression.coefficient() should expand beforehand Expression.coefficient() problems Jun 15, 2016
@rwst

This comment has been minimized.

@rwst

This comment has been minimized.

@rwst
Copy link
Author

rwst commented Aug 17, 2016

@rwst
Copy link
Author

rwst commented Aug 17, 2016

Author: Ralf Stephan

@rwst
Copy link
Author

rwst commented Aug 17, 2016

Commit: a45909c

@rwst
Copy link
Author

rwst commented Aug 17, 2016

New commits:

a45909c20824: add Expression.coefficient(...expand=True) keyword

@rwst rwst changed the title Expression.coefficient() problems Add Expression.coefficient(...expand=True) keyword Aug 17, 2016
@rwst rwst modified the milestones: sage-7.3, sage-7.4 Aug 17, 2016
@mezzarobba
Copy link
Member

comment:6

Hmm, I don't really see the benefit compared to expr.expand().coefficient(...)...

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 9, 2017

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

1d6fc68Merge branch 'develop' into t/20824/expression_coefficient___problems

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 9, 2017

Changed commit from a45909c to 1d6fc68

@rwst
Copy link
Author

rwst commented Mar 3, 2018

Changed branch from u/rws/expression_coefficient___problems to u/rws/20824

@rwst
Copy link
Author

rwst commented Mar 3, 2018

New commits:

7ab049f20824 Add Expression.coefficient(...expand=True) keyword

@rwst
Copy link
Author

rwst commented Mar 3, 2018

Changed commit from 1d6fc68 to 7ab049f

@rwst rwst modified the milestones: sage-7.4, sage-8.2 Mar 3, 2018
@bryangingechen
Copy link
Mannequin

bryangingechen mannequin commented Jul 28, 2018

comment:10

I had a look at the patch:

  • It looks like r is assigned in the try block but then not returned or called afterwards. Is this necessary? (I haven't completely digested the pynac interface so I may be missing something, but this looks strange...)
  • Should this be added to coefficients as well?
  • The indentation to TESTS: in the docstring was changed accidentally.

@mkoeppe mkoeppe removed this from the sage-8.2 milestone Dec 29, 2022
@mkoeppe
Copy link
Member

mkoeppe commented Feb 12, 2023

Branch has merge conflicts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants