ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 11 Jun 2012 16:24:51 +0200Need positive sqrts onlyhttps://ask.sagemath.org/question/9059/need-positive-sqrts-only/Hi,
I have solved some equations using solve() which does some manipution then takes a few positive and negative sqrts and then some more manipulation. There are several sets of solutions, but it's not obvious which ones correspond to which sign of sqrts. Is there an easy way I can make solve() only take positive square roots?
Thanks! And let me know if more info is needed.Mon, 11 Jun 2012 10:11:43 +0200https://ask.sagemath.org/question/9059/need-positive-sqrts-only/Answer by Shashank for <p>Hi,</p>
<p>I have solved some equations using solve() which does some manipution then takes a few positive and negative sqrts and then some more manipulation. There are several sets of solutions, but it's not obvious which ones correspond to which sign of sqrts. Is there an easy way I can make solve() only take positive square roots?</p>
<p>Thanks! And let me know if more info is needed.</p>
https://ask.sagemath.org/question/9059/need-positive-sqrts-only/?answer=13690#post-id-13690You can make sure solve returns only positive square roots by making sure that the argument of square root is positive. For eg.
solve(x*x==1,x)
gives x=1,x=-1
however,
assume(x>0)
solve(x*x==1,x)
returns x=1
I might be able to give a better answer if you could give me a simplified example of the problem.Mon, 11 Jun 2012 16:24:51 +0200https://ask.sagemath.org/question/9059/need-positive-sqrts-only/?answer=13690#post-id-13690