Ask Your Question

Sage wrongly suggests there are only trivial solutions, why?

asked 2017-08-14 12:10:55 +0200

Jo Be gravatar image

I have a system of two quadratic equations which I want to solve. WolframAlpha shows me whole families of solution, but sage says there are only trivial solutions. The equations are

\begin{align} d\cdot\lvert\alpha\rvert^2 + \alpha^* \beta + \alpha\beta^* ==&0, \end{align} \begin{align} d\cdot\lvert\beta\rvert^2 + \alpha^* \beta + \alpha\beta^* ==&0, \end{align} where $d$ is constant and I want to solve for the complex numbers $\alpha, beta$

I have the following minimal working example

assume(a, 'complex')
assume(b, 'complex')
assume(q, 'real')

eq(x,y) = q*norm(x) + conjugate(x)*y + x*conjugate(y)

solution = solve([eq(a,b) == 0, eq(b,a) == 0], [a,b])
polySolution = solve([eq(a,b) == 0, eq(b,a) == 0], [a,b], to_poly_solve=True)

and the output then is

sage: solution
[[a == 0, b == 0]]
sage: polySolution
[[a == 0, b == 0]]

which is simply not correct.

Now, as I said, I have found solutions with WolframAlpha, but the next candidate I have to compute gives 18 equations in 5 complex variables, which I cannot possibly solve with WA. Sage, again, tells me that there are only trivial solutions, but because of this smaller example presented here, I believe that that is wrong.

Does anyone know how to force sage to give solutions?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-08-15 09:13:45 +0200

nbruin gravatar image

The problem is that "conjugate" isn't C-linear, so the system of equations you are presenting isn't polynomial. Conjugation is R-linear, so if you write everything out in terms of real and imaginary parts, you're fine:

sage: var("x1,x2,y1,y2,d")
(x1, x2, y1, y2, d)
sage: alpha=x1+i*y1
sage: beta=x2+i*y2
sage: alpha_star=x1-i*y1
sage: beta_star=x2-i*y2
sage: Nalpha=alpha*alpha_star
sage: Nbeta=beta*beta_star
sage: eq1=d*Nalpha+alpha_star*beta+alpha*beta_star
sage: eq2=d*Nbeta+alpha_star*beta+alpha*beta_star

In order to solve these equations, you should split them in real and imaginary parts as well, but in this case the equations are already real:

sage: eq1.expand()
d*x1^2 + d*y1^2 + 2*x1*x2 + 2*y1*y2
sage: eq2.expand()
d*x2^2 + d*y2^2 + 2*x1*x2 + 2*y1*y2

Now you can just solve. To get better performance you might want to look into using polynomial rings instead.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2017-08-14 12:10:55 +0200

Seen: 548 times

Last updated: Aug 15 '17