Ask Your Question
2

assume() command with functions

asked 2012-07-30 12:00:21 +0100

brenogil gravatar image

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 flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2012-07-30 13:41:27 +0100

benjaminfjones gravatar image

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.

edit flag offensive delete link more

Comments

And cc: me if you end up opening a ticket...

kcrisman gravatar imagekcrisman ( 2012-07-30 15:11:42 +0100 )edit
0

answered 2012-08-16 11:46:09 +0100

andi gravatar image

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

edit flag offensive delete link more

Comments

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.

andi gravatar imageandi ( 2012-08-17 06:01:14 +0100 )edit

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.

brenogil gravatar imagebrenogil ( 2012-08-17 06:15:41 +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

2 followers

Stats

Asked: 2012-07-30 12:00:21 +0100

Seen: 3,533 times

Last updated: Aug 17 '12