Skip to content

Interesting possible failure of monodromy solving #611

@orebas

Description

@orebas

Below is an MWE. I noticed that when solving the very simple equation x^3=8, monodromy solving doesn't seem to find any new solutions beyond the one it's fed. The default solver doesn't seem to have this issue. I will try using some different parameters to see if it helps.

Example output:

julia> include("HC-MWE.jl")

=== Regular solving ===
All solutions from regular solve:
3-element Vector{Vector{ComplexF64}}:
 [2.0 + 0.0im]
 [-1.0 + 1.7320508075688772im]
 [-1.0 - 1.7320508075688774im]

=== Monodromy solving ===
1-element Vector{Vector{ComplexF64}}:
 [-1.0 + 1.7320508075688772im]

Solutions from monodromy:
1-element Vector{Vector{ComplexF64}}:
 [-1.0 + 1.7320508075688772im]

Verification for monodromy solutions (should all be close to 0):
x = -1.0 + 1.7320508075688772im => residual = 1.9860273225978185e-15

julia> include("HC-MWE.jl")

=== Regular solving ===
All solutions from regular solve:
3-element Vector{Vector{ComplexF64}}:
 [2.0 + 0.0im]
 [-1.0 + 1.7320508075688774im]
 [-1.0 - 1.7320508075688772im]

=== Monodromy solving ===
1-element Vector{Vector{ComplexF64}}:
 [2.0 + 0.0im]

Solutions from monodromy:
1-element Vector{Vector{ComplexF64}}:
 [2.0 + 0.0im]

Verification for monodromy solutions (should all be close to 0):
x = 2.0 + 0.0im => residual = 0.0

MWE:

using HomotopyContinuation

# Create a simple system with the same structure as your problem
function MonodromyTest()
	@var x p

	# Define the system: x³ - 8 = 0 (when p = 0)
	F = System([x^3 - 8.0 - p], parameters = [p])

	println("\n=== Regular solving ===")
	# Solve with p = 0
	result = solve(F, target_parameters = [0.0])

	# Display all solutions
	println("All solutions from regular solve:")
	display(solutions(result))

	println("\n=== Monodromy solving ===")
	# Now try with monodromy
	# First find a start pair
	found_start_pair = false
	pair_attempts = 0
	newx = nothing
	param_final = [0.0]

	while (!found_start_pair && pair_attempts < 50)
		testx, testp = find_start_pair(F)
		newx = solve(F, testx, start_parameters = testp, target_parameters = param_final,
			tracker_options = TrackerOptions(automatic_differentiation = 3))
		startpsoln = solutions(newx)
		pair_attempts += 1
		if (!isempty(startpsoln))
			found_start_pair = true
		end
	end

	display(solutions(newx))

	# Now do monodromy solve
	result_mono = monodromy_solve(F, solutions(newx), param_final,
		show_progress = true,
		timeout = 120.0,
		max_loops_no_progress = 20,
		unique_points_rtol = 1e-6,
		unique_points_atol = 1e-6,
		tracker_options = TrackerOptions(automatic_differentiation = 3))

	println("\nSolutions from monodromy:")
	display(solutions(result_mono))

	# Verify these are actually solutions
	println("\nVerification for monodromy solutions (should all be close to 0):")
	for sol in solutions(result_mono)
		residual = abs(sol[1]^3 - 8)
		println("x = ", sol[1], " => residual = ", residual)
	end
end

MonodromyTest()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions