How can I solve this equation (both numerically and literally) only in the positive reals $\mathbb{R}^+$?
Solve[x == (v0 - (A CD t v0^2 ρ)/(4m)) Cos[θ] t, t]
And for example, is there a way to have an output like this :
52.0756
and not like this :
{{t -> -52.3918}, {t -> 52.0756}}
?
Answer
You could use ReplaceAll
(i.e. /.
) and Select
Select[x /. Solve[x^2 - 1 == 0, x], Positive]
gives
{1}
It is a list (List
) not a single number. You might not know how many positive solutions exist:
Select[x /. NSolve[(x - 1) (x + 3) (x - 3) == 0, x], Positive]
{1., 3.}
Edit:
Using Part
or its short-hand notation [[]]
you can select parts from the list:
Part[{1}, 1]
1
{1}[[1]]
1
Part[{1.,3.},2]
3.
Comments
Post a Comment