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 total_degree thin-wrapper like function to polytools #13179

Closed
smichr opened this issue Aug 23, 2017 · 4 comments
Closed

add total_degree thin-wrapper like function to polytools #13179

smichr opened this issue Aug 23, 2017 · 4 comments

Comments

@smichr
Copy link
Member

smichr commented Aug 23, 2017

Just as there is a degree function and a Poly.degree method, a total_degree function could be added to polys.polytools.

Perhaps something like the following:

def total_degree(f):
    f = sympify(f)
    if f.is_Poly:
        rv = f.total_degree()
    elif f.is_Number:
        rv = 0
    else:
        rv = Poly(f).total_degree()
    # the Poly method returns int; SymPy functions return SymPy objects
    return Integer(rv)
@asmeurer
Copy link
Member

It should also allow to specify the generators. It should match the other polys functions in its form.

@smichr
Copy link
Member Author

smichr commented Aug 23, 2017

specify the generators

ahh...so total_degree(x*y + z**3, x, y) gives 2 instead of 3?

@asmeurer
Copy link
Member

Yes

>>> Poly(x*y + z**3, x, y).total_degree()
2

Anything not in the generators should be thought of as a symbolic constant.

@Yathartha22
Copy link
Member

@smichr I would like to work on this.

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

No branches or pull requests

3 participants