First time here? Check out the FAQ!

Ask Your Question
0

SageMath is not solving this inequality

asked 5 years ago

thethinker gravatar image

updated 5 years ago

I have the following inequality:

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

κm4+8πm3r4πr2>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)

[[κm4+8πm3r4πr2>0]]

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

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 5 years ago

Sébastien gravatar image

updated 5 years ago

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)
Preview: (hide)
link

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 ( 5 years ago )

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: 5 years ago

Seen: 577 times

Last updated: Mar 18 '20