ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 04 Sep 2012 18:26:18 -0500Simplify to real and positive numbershttps://ask.sagemath.org/question/9292/simplify-to-real-and-positive-numbers/ eng8 = [solve(eng==(k-1)*md*Vm1^2/(2*Patm*Vs*((Pc-(P2*s6))-(Pc-(P2*s6))^(1/k))),Vm1) for s6 in srange(r9,r10,s5,include_endpoint=1)]
v4=[v[0].rhs().n() for v in eng8]
v5=[v for v in v4 if v >= 0]
I can't seem to get v5 to output both real and positive numbers, only an empty list. All the inputs are positive, and I know the square root of the squared gives both positive and negative output. Any help?
Tue, 04 Sep 2012 08:24:34 -0500https://ask.sagemath.org/question/9292/simplify-to-real-and-positive-numbers/Comment by benjaminfjones for <pre><code>eng8 = [solve(eng==(k-1)*md*Vm1^2/(2*Patm*Vs*((Pc-(P2*s6))-(Pc-(P2*s6))^(1/k))),Vm1) for s6 in srange(r9,r10,s5,include_endpoint=1)]
v4=[v[0].rhs().n() for v in eng8]
v5=[v for v in v4 if v >= 0]
</code></pre>
<p>I can't seem to get v5 to output both real and positive numbers, only an empty list. All the inputs are positive, and I know the square root of the squared gives both positive and negative output. Any help?</p>
https://ask.sagemath.org/question/9292/simplify-to-real-and-positive-numbers/?comment=19112#post-id-19112Have you verified that the results in `eng8` are indeed positive real numbers? The statement "the square root of the squared gives both positive and negative output" does not make mathematical sense. What you probably mean is that the equation $x^2 = a$ has two solutions, one positive and one negative when $a > 0$. These are the principle square root of a (usually represented by sqrt(a)) and the negative of the principle square root of a.Tue, 04 Sep 2012 18:26:18 -0500https://ask.sagemath.org/question/9292/simplify-to-real-and-positive-numbers/?comment=19112#post-id-19112