Thanks, Chris. Here's the code that generates k0:

k=PolynomialRing(RationalField(),'k').gen()
m3,m2,m1,m0=var('m3,m2,m1,m0')
alpha,newbeta,delta,phi,psi,gamma=var('alpha,newbeta,delta,phi,psi,gamma')
a,b,d=var('a,b,d')
tl,tr,beta=var('tl,tr,beta')
assume(tl>0,tr>.5,tl<.5,tr<1,beta>0,beta<1)
f=(m3*k^3+m2*k^2+m1*k+m0)
yy=f.roots()

g0=yy[0][0].subs(m3=4,m2=2*alpha-2*delta-psi-gamma,m1=2*newbeta+2*phi
+delta*gamma-alpha*psi,m0=-newbeta*psi-phi*gamma)
h0=g0.subs(alpha=d-1-2*a,newbeta=2*(a*(1-d)),gamma=1+2*a-d,delta=1+d
+2*b,phi=2*b*(1+d),psi=2*b+1+d)
k0=h0.subs(a=tl,b=tr,d=2*beta)

So basically k0 is one of the three symbolic roots of polynomial f,
where the coefficients of f have been substituted by functions of the
three ultimate parameters of the problem, tl,tr and beta. It is a
function of these parameters.


On Aug 29, 9:46 pm, Chris Chiasson <[EMAIL PROTECTED]> wrote:
> This sounds like one of the questions that comes up on the Mathematica
> user list.
>
> Is there any way you could give the setup for the problem at an
> earlier stage in your computations? I think it might be easier for a
> human to understand if he/she could see how you arrived at k0.
>
> On Aug 29, 6:33 pm, Alberto <[EMAIL PROTECTED]> wrote:
>
> > Think of k0 as one of the symbolic solutions to a cubic
> > equation. It comes from using "roots()" on some cubic polynomial. k0
> > turns out to be a function of three parameters: "tl,tr and beta" (you
> > can see what k0 looks like at the end of this message).
>
> > my problem is that i write
>
> > assume(tl>0,tr>.5,tl<.5,tr<1,beta>0,beta<1)
>
> > and then write
>
> > bool(k0.real()>0)
>
> > Sage then gives me the following error:
>
> > Computation failed since Maxima requested additional constraints (use
> > assume):
> > Is  4*(4*(2*(2*tl-2*beta+1)*(2*tr+2*beta+1)+4*(2*beta+1)*tr
> > +4*(1-2*beta)*tl)^3
> >   -18*(-2*(2*tr+2*beta+1)-2*tr-2*tl+2*(-2*tl+2*beta-1)-2)
> >      *(-2*(1-2*beta)*tl*(2*tr+2*beta+1)-2*(2*beta+1)*(2*tl-2*beta
> > +1)*tr)
> >      *(2*(2*tl-2*beta+1)*(2*tr+2*beta+1)+4*(2*beta+1)*tr
> > +4*(1-2*beta)*tl))
> >  -(-2*(2*tr+2*beta+1)-2*tr-2*tl+2*(-2*tl+2*beta-1)-2)^2
> >   *(2*(2*tl-2*beta+1)*(2*tr+2*beta+1)+4*(2*beta+1)*tr
> > +4*(1-2*beta)*tl)^2
> >  +432*(-2*(1-2*beta)*tl*(2*tr+2*beta+1)-2*(2*beta+1)*(2*tl-2*beta
> > +1)*tr)^2
> >  +4*(-2*(2*tr+2*beta+1)-2*tr-2*tl+2*(-2*tl+2*beta-1)-2)^3
> >    *(-2*(1-2*beta)*tl*(2*tr+2*beta+1)-2*(2*beta+1)*(2*tl-2*beta
> > +1)*tr)  positive, negative, or zero?
>
> > So SUPPOSE I know that such term is indeed negative. So I write
>
> > assume(4*(4*(2*(2*tl-2*beta+1)*(2*tr+2*beta+1)+4*(2*beta+1)*tr
> > +4*(1-2*beta)*tl)^3
> >   -18*(-2*(2*tr+2*beta+1)-2*tr-2*tl+2*(-2*tl+2*beta-1)-2)
> >      *(-2*(1-2*beta)*tl*(2*tr+2*beta+1)-2*(2*beta+1)*(2*tl-2*beta
> > +1)*tr)
> >      *(2*(2*tl-2*beta+1)*(2*tr+2*beta+1)+4*(2*beta+1)*tr
> > +4*(1-2*beta)*tl))
> >  -(-2*(2*tr+2*beta+1)-2*tr-2*tl+2*(-2*tl+2*beta-1)-2)^2
> >   *(2*(2*tl-2*beta+1)*(2*tr+2*beta+1)+4*(2*beta+1)*tr
> > +4*(1-2*beta)*tl)^2
> >  +432*(-2*(1-2*beta)*tl*(2*tr+2*beta+1)-2*(2*beta+1)*(2*tl-2*beta
> > +1)*tr)^2
> >  +4*(-2*(2*tr+2*beta+1)-2*tr-2*tl+2*(-2*tl+2*beta-1)-2)^3
> >    *(-2*(1-2*beta)*tl*(2*tr+2*beta+1)-2*(2*beta+1)*(2*tl-2*beta
> > +1)*tr)<0)
>
> > and then I write again
>
> > bool(k0.real()>0)
>
> > Here's the problem: Sage gives me exactly the same error, about the
> > same expression, as if I had not assumed it negative. And I checked
> > with assumptions() and verified that the assumption about the
> > expression being negative was there.
>
> > Any insights as to what may be going on?
>
> > (to begin with I'm not even sure if writing k0.real() is legal, given
> > what k0 is)
>
> > Should I be doing
>
> > bool(k0>0)
>
> > instead?
>
> > (case in which my problem is that I have tried bool(k0>0), bool(k0<0)
> > and  bool(k0==0) and I always get "False" even though I ran
> > simulations for 1000 values of the parameters that go in k0 and in all
> > cases k0>0. Is my problem then that I am expecting too much of
> > "bool"?)
>
> > Thanks!
>
> > Alberto
>
> > ps-- here's the root i'm evaluating, k0:
>
> > (-sqrt(3)*I/2 - 1/2)*(sqrt(4*(4*(2*(2*tl - 2*beta + 1)*(2*tr + 2*beta
> > +
> > 1) + 4*(2*beta + 1)*tr + 4*(1 - 2*beta)*tl)^3 - 18*(-2*(2*tr + 2*beta
> > +
> > 1) - 2*tr - 2*tl + 2*(-2*tl + 2*beta - 1) - 2)*(-2*(1 -
> > 2*beta)*tl*(2*tr
> > + 2*beta + 1) - 2*(2*beta + 1)*(2*tl - 2*beta + 1)*tr)*(2*(2*tl -
> > 2*beta
> > + 1)*(2*tr + 2*beta + 1) + 4*(2*beta + 1)*tr + 4*(1 - 2*beta)*tl)) -
> > (-2*(2*tr + 2*beta + 1) - 2*tr - 2*tl + 2*(-2*tl + 2*beta - 1) -
> > 2)^2*(2*(2*tl - 2*beta + 1)*(2*tr + 2*beta + 1) + 4*(2*beta + 1)*tr +
> > 4*(1 - 2*beta)*tl)^2 + 432*(-2*(1 - 2*beta)*tl*(2*tr + 2*beta + 1) -
> > 2*(2*beta + 1)*(2*tl - 2*beta + 1)*tr)^2 + 4*(-2*(2*tr + 2*beta + 1) -
> > 2*tr - 2*tl + 2*(-2*tl + 2*beta - 1) - 2)^3*(-2*(1 - 2*beta)*tl*(2*tr
> > +
> > 2*beta + 1) - 2*(2*beta + 1)*(2*tl - 2*beta + 1)*tr))/(96*sqrt(3)) -
> > ((-36*(-2*(2*tr + 2*beta + 1) - 2*tr - 2*tl + 2*(-2*tl + 2*beta - 1) -
> > 2)*(2*(2*tl - 2*beta + 1)*(2*tr + 2*beta + 1) + 4*(2*beta + 1)*tr +
> > 4*(1
> > - 2*beta)*tl) + 432*(-2*(1 - 2*beta)*tl*(2*tr + 2*beta + 1) -
> > 2*(2*beta
> > + 1)*(2*tl - 2*beta + 1)*tr) + 2*(-2*(2*tr + 2*beta + 1) - 2*tr - 2*tl
> > +
> > 2*(-2*tl + 2*beta - 1) - 2)^3)/3456))^(1/3) - ((sqrt(3)*I/2 -
> > 1/2)*(12*(2*(2*tl - 2*beta + 1)*(2*tr + 2*beta + 1) + 4*(2*beta +
> > 1)*tr
> > + 4*(1 - 2*beta)*tl) - (-2*(2*tr + 2*beta + 1) - 2*tr - 2*tl +
> > 2*(-2*tl
> > + 2*beta - 1) - 2)^2)/(144*(sqrt(4*(4*(2*(2*tl - 2*beta + 1)*(2*tr +
> > 2*beta + 1) + 4*(2*beta + 1)*tr + 4*(1 - 2*beta)*tl)^3 - 18*(-2*(2*tr
> > +
> > 2*beta + 1) - 2*tr - 2*tl + 2*(-2*tl + 2*beta - 1) - 2)*(-2*(1 -
> > 2*beta)*tl*(2*tr + 2*beta + 1) - 2*(2*beta + 1)*(2*tl - 2*beta +
> > 1)*tr)*(2*(2*tl - 2*beta + 1)*(2*tr + 2*beta + 1) + 4*(2*beta + 1)*tr
> > +
> > 4*(1 - 2*beta)*tl)) - (-2*(2*tr + 2*beta + 1) - 2*tr - 2*tl + 2*(-2*tl
> > +
> > 2*beta - 1) - 2)^2*(2*(2*tl - 2*beta + 1)*(2*tr + 2*beta + 1) +
> > 4*(2*beta + 1)*tr + 4*(1 - 2*beta)*tl)^2 + 432*(-2*(1 -
> > 2*beta)*tl*(2*tr
> > + 2*beta + 1) - 2*(2*beta + 1)*(2*tl - 2*beta + 1)*tr)^2 + 4*(-2*(2*tr
> > +
> > 2*beta + 1) - 2*tr - 2*tl + 2*(-2*tl + 2*beta - 1) - 2)^3*(-2*(1 -
> > 2*beta)*tl*(2*tr + 2*beta + 1) - 2*(2*beta + 1)*(2*tl - 2*beta +
> > 1)*tr))/(96*sqrt(3)) - ((-36*(-2*(2*tr + 2*beta + 1) - 2*tr - 2*tl +
> > 2*(-2*tl + 2*beta - 1) - 2)*(2*(2*tl - 2*beta + 1)*(2*tr + 2*beta + 1)
> > +
> > 4*(2*beta + 1)*tr + 4*(1 - 2*beta)*tl) + 432*(-2*(1 - 2*beta)*tl*(2*tr
> > +
> > 2*beta + 1) - 2*(2*beta + 1)*(2*tl - 2*beta + 1)*tr) + 2*(-2*(2*tr +
> > 2*beta + 1) - 2*tr - 2*tl + 2*(-2*tl + 2*beta - 1) -
> > 2)^3)/3456))^(1/3))) + (2*(2*tr + 2*beta + 1) + 2*tr + 2*tl - 2*(-2*tl
> > +
> > 2*beta - 1) + 2)/12


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to