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

Multiplication with 0 discards of coefficients. #80

Closed
manuelbb-upb opened this issue Feb 3, 2021 · 0 comments
Closed

Multiplication with 0 discards of coefficients. #80

manuelbb-upb opened this issue Feb 3, 2021 · 0 comments

Comments

@manuelbb-upb
Copy link
Contributor

manuelbb-upb commented Feb 3, 2021

I use DynamicPolynomials.jl for a muliti-variate interpolation task, where I was thrown off guard when the resulting interpolant equates to the constant 0 polynomial.
Then the variable information is lost. In my case, I am not able to differentiate properly and obtain the zero gradient.

Consider

@polyvar x[1:2]
p1 = x[1] * 0.0
p2 = x[1] * 0.0 + x[2] * 0.0
p3 = ( x[1] + x[2] ) * 0.0

All polynomials are the constant zero polynomial. Using DynamicPolynomials i get

variables(p1) == [x[1],]
variables(p2) == [x[1],x[2],]

but variables(p3) is empty. When using TypedPolynomials we get variables(p3) == [x[1],x[2],].

p1 is a Term and p2 is a sum of two Terms. In contrast, p3 is the product of a Polynomial and a Term.
Hence I suspect this behavior is due to lines 62-63 in the file mult.jl.

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

1 participant