JuliaHomotopyContinuation / HomotopyContinuation.jl

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

Calculating the Conjugate of a Variable #402

Closed pkroenert closed 4 years ago

pkroenert commented 4 years ago

Hi folks,

when I calculate the complex conjugate I get the wrong solution:

@var b1 b2 subs(conj(b1)*b2, b1=>2+im, b2=>3) Output: 6 + 3*im

where it should be Output: 6 - 3*im

Do I have to explicitly declare my variables as complex?

Thanks for your help!

saschatimme commented 4 years ago

This is by design since complex conjugation is not algebraic. If your model involves a variable and their complex conjugate, then you need to introduce two separate variables and an additional constraint linking the two together.

pkroenert commented 4 years ago

Thank you very much for the fast reply!

By the way, a very nice package!

pkroenert commented 4 years ago

I am struggling to find an additional constraints between the the complex number z and it's complex conjugate \bar{z}. I'm not sure if it is even possible to establish a constraint, when only +,-,*,/ is allowed.

Do you have an additional advice for me?

saschatimme commented 4 years ago

Can you describe me a small example of the kind of problem you like to solve?

pkroenert commented 4 years ago

Of course:

Define a vector of complex variables: vec=[b1,b2,b3] matrices=[mat1,mat2,mat3]

Calculate the bilinear product: f1 = adjoint(vec) * matrices[1] * vec - 12 f2 = adjoint(vec) * matrices[2] * vec - 45 f3 = adjoint(vec) * matrices[3] * vec - 38

sys = System([f1,f2,f3])

solve(sys)

PBrdng commented 4 years ago

You can attack problems involving conjugations like this as follows:

Define variables x1, x2, x3andy1, y2, y3 and define b1 = x1 + im * y1 etc. Then, f1,f2,f3 are polynomials of the form f1 = g1 + im * h1 with g1 and h1 real polynomials etc.

Your problem is then translated to solving for the real solutions of [f1, f2, f3, g1, g2, g3].

pkroenert commented 4 years ago

Thank you so much, it works now! Great Job, thanks for the support! Once our paper is ready, we will cite your package!