# SageMath is not solving this inequality

I have the following inequality:

ineqal=T1Sol.rhs().numerator() > 0
ineqal


$$-\kappa m^{4} + 8 \pi m^{3} r - 4 \pi r^{2} > 0$$

So it's a quadratic, but I would imagine it's solveable. Find the zeros, check the sign on either side of them, and tell me where it's positive. If you need more info, yell at me about assumptions. But instead:

solve(ineqal,r)


$$\left[\left[-\kappa m^{4} + 8 \pi m^{3} r - 4 \pi r^{2} > 0\right]\right]$$

Sometimes I can trick it into behaving with some expand() or simplify_full(), but that seems not to be working here. Any ideas?

edit retag close merge delete

Sort by » oldest newest most voted

At least SageMath solves the equality (you may then guess the solution from the sign of the coefficient for r^2):

sage: kappa = var('kappa')
sage: m = var('m')
sage: r = var('r')
sage: expr = -kappa*m^4+8*pi*m^3*r - 4*pi*r^2
sage: solve(expr == 0, r)
[r == 1/2*(2*pi*m^3 - sqrt(4*pi^2*m^2 - pi*kappa)*m^2)/pi,
r == 1/2*(2*pi*m^3 + sqrt(4*pi^2*m^2 - pi*kappa)*m^2)/pi]


Sympy gives a simplified solution for the equality, but it neither give you the intervals for when the expression is positive:

sage: solve(expr == 0, r, algorithm='sympy')
[r == m^3 - 1/2*sqrt(4*pi*m^2 - kappa)*m^2/sqrt(pi),
r == m^3 + 1/2*sqrt(4*pi*m^2 - kappa)*m^2/sqrt(pi)]
sage: solve(expr > 0, r, algorithm='sympy')
ConditionSet(r, -kappa*m**4 + 8*pi*m**3*r - 4*pi*r**2 > 0, Reals)

more

Right, so we can kind of do it ourselves (finding the zeros, if they exist, and then determining the sign of the function around them), but that seems "simple" enough that Sage should be able to do it. Is this a Sage thing, or algebra systems in general?