wow, thank you. I would not have thought of using list comprehensions here.
Is there a way to do [s for s in sol if <all of the assumptions are satisfied>] thanks Robin On Fri, Dec 9, 2011 at 11:48 AM, achrzesz <achrz...@wp.pl> wrote: > > > On Dec 8, 9:36 pm, robin hankin <hankin.ro...@gmail.com> wrote: >> hello >> >> I have been playing with assumptions(). I want to assume a>b >> but solve() gives me a solution which is not consistent with this: >> >> sage: var('a b') >> (a, b) >> sage: assume(a>b) >> sage: assumptions() >> [a > b] >> sage: solve([a+b==2,a-b==0],a,b) >> [[a == 1, b == 1]] >> sage: >> >> How come the solution (viz a=b=1) is not consistent with my assumption()? >> >> -- >> Robin Hankin >> Uncertainty Analyst >> hankin.ro...@gmail.com > > Sometimes one can use workarounds: > > sage: var('a b') > (a, b) > sage: sol=solve([a+b==2,a-b==0],a,b) > sage: [s for s in sol if s[0].rhs()>s[1].rhs()] > [] > > sage: sol=((x+1)*x*(x-1)==0).solve(x) > sage: [s for s in sol if s.rhs()>0] > [x == 1] > > sage: var('x y') > sage: sol=solve([x^2-4*x+y^2==0,y^4==x^2],x,y) > sage: [s for s in sol if all([s[0].rhs()>0,s[1].rhs()>0])] > [[x == 3, y == sqrt(3)]] > > -- > To post to this group, send email to sage-support@googlegroups.com > To unsubscribe from this group, send email to > sage-support+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/sage-support > URL: http://www.sagemath.org -- Robin Hankin Uncertainty Analyst hankin.ro...@gmail.com -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org