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

Degree of a monomial containing noncommutative variable #148

Closed
atbug opened this issue Oct 27, 2020 · 0 comments · Fixed by #150
Closed

Degree of a monomial containing noncommutative variable #148

atbug opened this issue Oct 27, 2020 · 0 comments · Fixed by #150

Comments

@atbug
Copy link

atbug commented Oct 27, 2020

I am not sure whether there is a standard definition of degree for monomial containing non-commutative variables, but I think the following behavior is counter-intuitive:

julia> using DynamicPolynomials

julia> @ncpolyvar x y z
(x, y, z)

julia> degree(x*y*x, x)
1

Maybe the degree function can be modified as something like

function degree(m::AbstractMonomial, v::AbstractVariable)
    indices = findall(isequal(v), variables(m))
    if isempty(indices)
        return 0
    else
        return sum(exponents(m)[indices])
    end
end

Any comments?

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

Successfully merging a pull request may close this issue.

1 participant