Giter Club home page Giter Club logo

Comments (6)

saschatimme avatar saschatimme commented on August 18, 2024 1

Numerically we will not make use of any of the additional precision provided by big floats. So any fix would just truncate the coefficients .

from homotopycontinuation.jl.

gescholt avatar gescholt commented on August 18, 2024

Hello
I think I ran into the same issue, I have two very similar systems, but system 1 runs fine, system2 returns the same error as you. At first I thought the error has to do with constant coefficients appearing in the system, but then I generated some random polynomial and that doesn't seem to be the issue.
Maybe it has to do with the differentiate command?

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)

from homotopycontinuation.jl.

PBrdng avatar PBrdng commented on August 18, 2024

Hi all,

all I can say is that we never tested against BigFloat. In principle, everything should be abstractified to an extend that allows any number type. But there is always a chance a bug slipped through. I think, one has to test all functions with BigFloat input to understasnd what goes wrong.

@gescholt Can you try @var instead of @polyvar ?

from homotopycontinuation.jl.

gescholt avatar gescholt commented on August 18, 2024

@PBrdng @var gives the same output:

ERROR: MethodError: no method matching HomotopyContinuation.ToricHomotopy(::MixedSystem{(0xd448607d78e104ed, 1)}, ::Vector{Vector{Complex{BigFloat}}})

Closest candidates are:
  HomotopyContinuation.ToricHomotopy(::S, ::Vector{ComplexF64}, ::Vector{Float64}, ::Vector{Float64}, ::StructArrays.StructVector{ComplexF64, @NamedTuple{re::Vector{Float64}, im::Vector{Float64}}, Int64}, ::Vector{ComplexF64}, ::Vector{ComplexF64}, ::Vector{ComplexF64}, ::Base.RefValue{ComplexF64}, ::Base.RefValue{ComplexF64}, ::TaylorVector{5, ComplexF64}, ::TaylorVector{4, ComplexF64}, ::TaylorVector{3, ComplexF64}) where S<:AbstractSystem
   @ HomotopyContinuation ~/.julia/packages/HomotopyContinuation/NcbGJ/src/homotopies/toric_homotopy.jl:16
  HomotopyContinuation.ToricHomotopy(::AbstractSystem, ::Vector{Vector{ComplexF64}})
   @ HomotopyContinuation ~/.julia/packages/HomotopyContinuation/NcbGJ/src/homotopies/toric_homotopy.jl:37

from homotopycontinuation.jl.

gescholt avatar gescholt commented on August 18, 2024

@PBrdng, switching the method to HomotopyContinuation.solve(system_2; start_system=:total_degree) indeed make the computation work.

from homotopycontinuation.jl.

PBrdng avatar PBrdng commented on August 18, 2024

@PBrdng, switching the method to HomotopyContinuation.solve(system_2; start_system=:total_degree) indeed make the computation work.

Then, the problem is the overflow in the polyhedral homotopy.

It could be, though, that BigFloats are converted to usual floats in the implementation. Like I said, no one has ever tested this against BigFloats.

from homotopycontinuation.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.