JuliaHomotopyContinuation / HomotopyContinuation.jl

A Julia package for solving systems of polynomials via homotopy continuation.
https://www.JuliaHomotopyContinuation.org
MIT License
178 stars 30 forks source link

solve systems with partial projective variables #481

Closed jaydu1 closed 2 years ago

jaydu1 commented 2 years ago

I am trying to solve a generalized eigenvalue problem with the following codes:

@var sigma u[1:2]
A = [1 2;3 4]
B = [0 1;3 2]
f = System([(sigma*A-B)*u;],
    variable_groups=[[sigma,], u])
S = solve(f, start_system = :total_degree)

It produces an error, as the number of variables is larger than the number of equations. I'm able to run this with an extra equation u'*u-1, but I just wondering if there is any way to specify the projective variables u explicitly and accelerate the code?Thanks in advance.

PBrdng commented 2 years ago

If your question is whether one can mix projective and affine coordinates, the answer is no!

But there are other options:

Option 1: Use a random affine equation for u (this does not increase the total degree):

@var σ u[1:2]
A = [1 2;3 4]
B = [0 1;3 2]
ℓ = randn(2)
f = System([(σ * A - B) * u; transpose(ℓ) * u - 1],
    variable_groups=[[σ,], u])
S = solve(f, start_system = :total_degree)

Option 2: Use multiprojective homotopies:

@var σ[1:2] u[1:2]
A = [1 2;3 4]
B = [0 1;3 2]
f = System([(σ[1] * A -  σ[2] * B) * u;],
    variable_groups=[σ, u])
S = solve(f)

(Running this second example I found a bug: The number of real solutions is not correctly displayed. I will fix it).

Does this help?

jaydu1 commented 2 years ago

Absolutely it helps. Thanks!