Ask Your Question
1

Sage cannot solve non-linear polynomial systems symbolically!

asked 2025-04-26 02:14:25 +0200

l3gi0n gravatar image
x, y, z = var('x y z')
eq1 = x + y + z == 2
eq2 = x^2 + 2*y + 3*z == 4
eq3 = x + y + z^2 == 10
show(solve([eq1,eq2,eq3],x,y,z))

This gives me numerical solutions.

in Mathematica:

{eq1, eq2, eq3} = {x + y + z == 2, x^2 + 2*y + 3*z ==4, x + y + z^2 == 10};
Solve[{eq1, eq2, eq3}, {x, y, z}]

gives me symbolic solutions.

Any way to get symbolic solutions in sagemath ?

edit retag flag offensive close merge delete

Comments

You mean solutions involving square roots etc. ( like $\frac{1}{2} \left(2-i \sqrt{2 \left(\sqrt{33}-1\right)}\right)$ ) rather than floating point results, right? You should force the integers to be symbols. The following is a "impractical" workaround:

x, y, z = var('x y z')
var('a,b,c')
eq1 = x + y + z == a
eq2 = x^2 + 2*y + 3*z == b
eq3 = x + y + z^2 == c
soln=solve([eq1,eq2,eq3],x,y,z)
show(soln[0][0].rhs().subs(a=2,b=4,c=10))
tolga gravatar imagetolga ( 2025-04-26 07:52:12 +0200 )edit

Tip: in the Ask Sage search box, type: polynomial system.

slelievre gravatar imageslelievre ( 2025-05-03 10:26:53 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted
3

answered 2025-04-26 12:37:53 +0200

Max Alekseyev gravatar image

updated 2025-04-26 13:20:46 +0200

Solution via ideals machinery

R.<x, y, z> = QQbar[]
eq1 = x + y + z - 2
eq2 = x^2 + 2*y + 3*z - 4
eq3 = x + y + z^2 - 10
V = ideal([eq1,eq2,eq3]).variety()
for p in V:
    show( {v:e.radical_expression() for v,e in p.items()} )

Results can be seen at Sagecell.

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

Stats

Asked: 2025-04-26 02:14:25 +0200

Seen: 251 times

Last updated: Apr 26