Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Solving Simultaneous Equations: Excluding 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:

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)

Solving Simultaneous Equations: Excluding 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:

var('x y z u p', domain='real')

domain='real') f = x^6 + y^6 + z^6

z^6 c = x^2 + y^2 + z^2

z^2 c1 = c == 6

6 fx = f.diff(x)

f.diff(x) fy = f.diff(y)

f.diff(y) fz = f.diff(z)

f.diff(z) cx = u*c.diff(x)

u*c.diff(x) cy = u*c.diff(y)

u*c.diff(y) cz = u*c.diff(z)

u*c.diff(z) eq1 = fx - cx == 0

0 eq2 = fy - cy == 0

0 eq3 = fz - cz == 0

0 answers = solve([eq1,eq2,eq3,c1],x,y,z,u)

solve([eq1,eq2,eq3,c1],x,y,z,u)

Solving Simultaneous Equations: Excluding 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:

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)