# Strange behavior of bool()

Here is my code

var("w0, pi, D, I")
A = matrix(SR, 2, 2, [[w0, 1],[w0-pi,1]])
y = vector([w0-D, w0-D-pi+I])
sol=A.solve_right(y)
sola=sol[0].full_simplify().function(D, pi, I, w0)
solb=sol[1].full_simplify().function(D, pi, I, w0)
f(x, D, pi, I, w0)=sola*x + solb
show(f(x, D, pi, I, w0))
f_x = f.diff(x).full_simplify()
show(f_x)
f_I = f.diff(I).full_simplify()
show(f_I)


Now, I make some assumptions and I verify the sign of $f_x$ and $f_I$.

assume(I, "real")
assume(pi, "real")
assume(I > pi)
bool(f_x < 0)
assume(w0, "real")
assume(x, "real")
assume(w0 > x)
bool(f_I > 0)


What is weird is that the result doesn't change should I ask for bool(f_x < 0) or bool(f_x > 0) and the same for $f_I$. I know that my question looks like an already asked question "symbolic functions and bool". But this time the expressions are elementary.

edit retag close merge delete

I have resolved my problem but an other one rise. How to tell Sagemath that 0 should be considerer a real not an integer ? (It's for the cas where I add '>=' to all the inequalities)

( 2020-04-23 09:47:38 +0100 )edit

Sort by » oldest newest most voted

Sorry, I have forget to precise that

assume(I > 0)
assume(pi > 0)


in that case the behavior is normal

more