%sage %var x, y

# our function

f(x,y) = x*y + 8/x + 1/y

# first order partial derivatives

fx(x,y) = diff(f(x,y), x) fy(x,y) = diff(f(x,y), y)

# find where both are simultaneously equal to zero.

# the syntax is solve([system, of, equations, to, solve], variables, to, solve, for)

# To keep from finding any complex number solutions, we tell sage to assume that x and y are real numbers

assume(x, 'real') assume(y, 'real') solutions = solve([fx(x,y) == 0, fy(x,y) == 0], x, y) solutions

returns
[[x == 4, y == (1/2)], [x == -2*I*sqrt(3) - 2, y == -1/4*I*sqrt(3) - 1/4], [x == 2*I*sqrt(3) - 2, y == 1/4*I*sqrt(3) - 1/4]]
Why is it giving non-real values?