Ask Your Question
0

SageMath is not solving this inequality

asked 2020-03-17 21:51:29 +0100

thethinker gravatar image

updated 2020-03-17 21:52:02 +0100

I have the following inequality:

ineqal=T1Sol[0].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 flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2020-03-18 10:49:41 +0100

Sébastien gravatar image

updated 2020-03-18 10:51:43 +0100

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)
edit flag offensive delete link more

Comments

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?

thethinker gravatar imagethethinker ( 2020-03-18 14:36:58 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-03-17 21:51:29 +0100

Seen: 526 times

Last updated: Mar 18 '20