When an equation has multiple solutions, how do you find the first solution?
Example:
Say we're trying to find the first positive x-intercept of the cosine function:
$cos(x)=0 \land x \ge 0$
Running Solve
, we obtain the set of solutions:
solutions = Solve[Cos[x] == 0 && x >= 0, x]
$\left\{\left\{x\to \text{ConditionalExpression}\left[\frac{1}{2} \left(4 \pi c_1-\pi \right),c_1\in \mathbb{Z}\land c_1\geq 1\right]\right\},\left\{x\to \text{ConditionalExpression}\left[\frac{1}{2} \left(4 \pi c_1+\pi \right),c_1\in \mathbb{Z}\land c_1\geq 0\right]\right\}\right\}$
To proceed, we need to find the C[1]
that minimizes the substitution for x
. How do we do this?
Solve[{Cos[x] == 0, 0 <= x <= 2}, x]
$\endgroup$ – J. M.'s ennui♦ Jun 19 '16 at 17:28Needs["NumericalCalculus`"]; NLimit[ ArgMin[{eps*x^2 + Cos[x]^2, x > 0}, x], eps -> 0]
. $\endgroup$ – Daniel Lichtblau Jun 19 '16 at 22:05