# sagemath fails to solve an equation and inequation

I do not understand why

var('R','p','x')
sol1=solve(R^(1/3)*p == x^(1/3),x)
show(sol1)


this work but this fails to isolate $x$

var('R','p','x')
sol1=solve(R^(1/3)*p <= x^(1/3),x)
show(sol1)


And that

var('R','p','x')
sol2=solve(0 == (R-x)^(1/3)*p + (1-p)* (-x)^(1/3),x)
show(sol2)


doesn't find $x$. And, as a consequence, of cours this :

var('R','p','x')
sol2=solve(0 <= (R-x)^(1/3)*p + (1-p)* (-x)^(1/3),x)
show(sol2)


fails. I have tried all simplification ways.

edit retag close merge delete

Sort by » oldest newest most voted

The first two can be (awkwardly) solved by Sage :

sage: E1=R^(1/3)*p == x^(1/3)
sage: E1.solve(x, algorithm="sympy")
[x == R*p^3]
sage: I1=R^(1/3)*p <= x^(1/3)
sage: [x-v for v in solve(I1^3,x)]
[R*p^3 == x, R*p^3 > x]


But the third one : sage: I2=0 <= (R-x)^(1/3)p + (1-p) (-x)^(1/3)

requires manual solution. Sage can help, at least for record-keeping :

sage: I22=((((I2-I2.rhs().operands())/(1-p))^3)).expand() ; I22
x <= -R*p^3/(p^3 - 3*p^2 + 3*p - 1) + p^3*x/(p^3 - 3*p^2 + 3*p - 1)
sage: I23=I22-I22.rhs().operands() ; I23
-p^3*x/(p^3 - 3*p^2 + 3*p - 1) + x <= -R*p^3/(p^3 - 3*p^2 + 3*p - 1)
sage: I23.factor()/(I23.factor().lhs().coefficient(x))
x <= R*p^3/(3*p^2 - 3*p + 1)


"The competition" fares a bit better :

sage: mathematica.Reduce(I2,x)
Element[p, Reals] &&
((R < 0 && ((p <= 1 && x <= R) || (p > 1 &&
x <= (p^3*R)/(1 - 3*p + 3*p^2)))) || (R == 0 && x <= 0) ||
(R > 0 && ((p < 0 && x <= (p^3*R)/(1 - 3*p + 3*p^2)) ||
(p >= 0 && x <= 0))))


HTH,

more

Emmanuel I have a big problem. What I do is preparing correction for students under SageCells. Unfortunately, algorithm="sympy" option doesn't work. Are you aware of an other soluytion ? It seems that many things are differently managed under Sagemath notebook and SaeCells which is dommageable. And I do not know how to connect people who develop SageCells