# assume() command with functions

How can this be?

sage: x = var('x')
sage: Q = function('Q', x)
sage: assume(x>0)
sage: assume(Q>0)
sage: bool(Q>0)
False


And even

sage: bool(abs(Q)>0)
False


Am I forgetting or neglecting something? Thank you

edit retag close merge delete

Sort by » oldest newest most voted

The assume function doesn't work with symbolic functions.

I think the command assume(Q>0) should raise an exception (it doesn't right now obviously). If you look at the documentation for assume you'll see that all the examples involve symbolic variables only.

On the other hand, the type of Q in your example is sage.symbolic.expression.Expression so maybe this is supposed to work and you've found a bug. I'll dig deeper and see what I can find.

more

I guess my problem is related to this one:

var('Nr N1 N2 yr x1 x2 y2 Pr p0 P1 p2')
assume(N1>0, N2>0, Nr>0, Pr>0, p0>0, p2>0, p0+p2-1<0);
assume(P1-Nr*p2+p2-Nr*p0+p0+Nr-1>0)
h1 = 1/sqrt(2*pi*Nr)*exp(-(yr-(x1+x2))^2/(2*Nr))/sqrt(2*pi*N2)*exp(-(y2-sqrt(Pr/((1-p0)(Nr+P1/(1-p0-p2))))*yr)^2/(2*N2))*(y2-sqrt(Pr/((1-p0)(Nr+P1/(1-p0-p2))))*yr)/Nr*sqrt(Pr/((1-p0)*(Nr+P1/(1-p0-p2))))*yr*(1/(2*(1-p0))-P1/(2*(1-p0-p2)^2*(P1/(1-p0-p2)+Nr)))+1/sqrt(2*pi*N2)*exp(-(y2-sqrt(Pr/((1-p0)(Nr+P1/(1-p0-p2))))*yr)^2/(2*N2))/sqrt(2*pi*Nr)*exp(-(yr-(x1+x2))^2/(2*Nr))*(yr-(x1+x2))/Nr*x1^3/(2*P1); h1
h2 = 1/2*h1(x2=0,x1=sqrt(P1/(1-p0-p2)))+1/2*h1(x2=0,x1=-sqrt(P1/(1-p0-p2))); h2
py2x1x2 = integrate(h2,yr,-oo,oo); py2x1x2
Traceback (click to the left of this block for traceback)
...
Is  p2+p0-1  positive or negative?


The important parts are

assume(p0+p2-1<0);


and

Is  p2+p0-1  positive or negative?


obviously. Did I get you right, this is not supposed to work?

Thank you

more

I do not really understand the implications of this, even reading the reference. Is there any way to accomplish what I am trying to do? p0 und p2 are just real positive constants the value of which I do not know.

Deleted that because it was not really an answer. I just meant that even facing similar results, sage does seem to behave differently when trying to solve our problems.