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

Don't turn coefficients into float on div #144

Closed
shashi opened this issue Sep 8, 2023 · 3 comments · Fixed by JuliaAlgebra/MultivariatePolynomials.jl#296
Closed

Don't turn coefficients into float on div #144

shashi opened this issue Sep 8, 2023 · 3 comments · Fixed by JuliaAlgebra/MultivariatePolynomials.jl#296

Comments

@shashi
Copy link

shashi commented Sep 8, 2023

julia> pa = PolyForm(x+2y).p
2y + x

julia> pa/1
2.0y + x

It should at best be Rational... If one of the coeffs is already Float then it makes if the output has floats.

@blegat
Copy link
Member

blegat commented Sep 9, 2023

What is PolyForm ? I think it is consistent with Julia, 1 / 2 is also Float

@hersle
Copy link

hersle commented Mar 5, 2024

Hi! PolyForm is a wrapper in SymbolicUtils.jl, which underlies Symbolics.jl. Reliably working with integer/rational coefficients would greatly help symbolic calculations.

Anyway, here div is not consistent with base Julia:

julia> using DynamicPolynomials

julia> @polyvar x
(x,)

julia> div(x, x)
1.0

julia> div(7, 7)
1

Should/could this be fixed?

@shashi
Copy link
Author

shashi commented Mar 12, 2024

Thanks @hersle ! @blegat, we use div, / is just surface notation. PolyForm wraps your polynomials and implements the Symbolics expression interface.

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.

3 participants