2017-10-27 02:01:18 +0100 | asked a question | assume(x, 'real') returns non-real values when solving %sage %var x, y our functionf(x,y) = x*y + 8/x + 1/y first order partial derivativesfx(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 numbersassume(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 == -2Isqrt(3) - 2, y == -1/4Isqrt(3) - 1/4], [x == 2Isqrt(3) - 2, y == 1/4Isqrt(3) - 1/4]] Why is it giving non-real values? |