ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 30 Nov 2015 21:37:12 +0100Solving Simultaneous Equations: How to Exclude Imaginary Numbers?https://ask.sagemath.org/question/31214/solving-simultaneous-equations-how-to-exclude-imaginary-numbers/Hello all,
I am working on a Calculus problem where you have to find the critical points of a function f(x,y,z) subject to a constraint function c(x,y,z) = constant. I managed to use Sagemath to output the answers, but it is including answers that have complex numbers. How can I exclude the answers with complex numbers?
Here's the code I have written:
> Blockquote
var('x y z u p', domain='real')
f = x^6 + y^6 + z^6
c = x^2 + y^2 + z^2
c1 = c == 6
fx = f.diff(x)
fy = f.diff(y)
fz = f.diff(z)
cx = u*c.diff(x)
cy = u*c.diff(y)
cz = u*c.diff(z)
eq1 = fx - cx == 0
eq2 = fy - cy == 0
eq3 = fz - cz == 0
answers = solve([eq1,eq2,eq3,c1],x,y,z,u)
Mon, 30 Nov 2015 21:37:12 +0100https://ask.sagemath.org/question/31214/solving-simultaneous-equations-how-to-exclude-imaginary-numbers/