-
Notifications
You must be signed in to change notification settings - Fork 31
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
Issues dealing with BigFloat coefficients #528
Comments
Hello using HomotopyContinuation
using DynamicPolynomials
using Random
# Set random seed
Random.seed!(134)
@polyvar x[1:2]
# Function to generate a random polynomial with BigFloat coefficients
function random_polynomial(variables, degree::Int, num_terms::Int)
polynomial = zero(BigFloat) # Initialize the polynomial with a BigFloat zero
for _ in 1:num_terms
coeff = BigFloat(rand(-10.0:0.1:10.0))
powers = rand(0:degree, length(variables))
monomial = prod(v^p for (v, p) in zip(variables, powers))
polynomial += coeff * monomial
end
return polynomial
end
# Generate two random polynomials of degree 2 with 5 terms each
poly1 = random_polynomial(x, 4, 10)
poly2 = poly1 + BigFloat(1.0) * x[1] + BigFloat(1.0) * x[2]
grad_p1 = differentiate.(poly1, x)
grad_p2 = differentiate.(poly2, x)
# Define the system of equations
system_1 = System(grad_p1)
system_2 = System(grad_p2)
# Solve the system
R1 = HomotopyContinuation.solve(system_1)
println("Result: ", R1)
R2 = HomotopyContinuation.solve(system_2)
println("Result: ", R2) |
Hi all, all I can say is that we never tested against @gescholt Can you try |
@PBrdng
|
@PBrdng, switching the method to |
Then, the problem is the overflow in the polyhedral homotopy. It could be, though, that |
Numerically we will not make use of any of the additional precision provided by big floats. So any fix would just truncate the coefficients . |
I have a system where the coefficients of the polynomials are huge integers. When declaring these polynomials, their coefficients are stored as
BigFloat
. When trying to solve the system, the package seems to be unable to handle such coefficients.F is a
System
whose polynomials coefficients haveBigFloat
type. Output:The text was updated successfully, but these errors were encountered: