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

gcd of polynomials with Complex coefficient (should it fail?) #91

Open
shashi opened this issue Aug 23, 2021 · 1 comment
Open

gcd of polynomials with Complex coefficient (should it fail?) #91

shashi opened this issue Aug 23, 2021 · 1 comment

Comments

@shashi
Copy link

shashi commented Aug 23, 2021

julia> using DynamicPolynomials

julia> @polyvar a b
(a, b)

julia> julia> gcd(im*a, a)
ERROR: MethodError: no method matching gcd(::Complex{Bool}, ::Complex{Bool})
Closest candidates are:
  gcd(::AbstractPolynomialLike, ::Any) at /home/shashi/.julia/dev/MultivariatePolynomials/src/gcd.jl:50
  gcd(::AbstractPolynomialLike, ::Any, ::MultivariatePolynomials.AbstractUnivariateGCDAlgorithm) at /home/shashi/.julia/dev/MultivariatePolynomials/src/gcd.jl:50
  gcd(::Any, ::AbstractPolynomialLike) at /home/shashi/.julia/dev/MultivariatePolynomials/src/gcd.jl:49
  ...
Stacktrace:
  [1] promote_operation_fallback(op::typeof(gcd), #unused#::Type{Complex{Bool}}, #unused#::Type{Complex{Bool}})
    @ MutableArithmetics ~/.julia/packages/MutableArithmetics/8xkW3/src/interface.jl:20
  [2] promote_operation(::Function, ::Type, ::Type)
    @ MutableArithmetics ~/.julia/packages/MutableArithmetics/8xkW3/src/interface.jl:58

It would make generic downstream code so much easier to write even if this returned 1...

@shashi
Copy link
Author

shashi commented Aug 23, 2021

In general, what is a good way to call GCD between two Polynomials only when it's going to work?

@shashi shashi changed the title gcd of polynomials with constant coefficient (should it fail?) gcd of polynomials with Complex coefficient (should it fail?) Aug 23, 2021
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