2
$\begingroup$

Given the function f[x_] := x^2, how can I plot f[x] over the range where f[x] >= 10 and x ∈ [-5 to 5] without solving the inequality f[x] >= 10?

$\endgroup$
  • 3
    $\begingroup$ Do you mean something like this? f[x_]:=x^2; Plot[f[x], {x, -5, 5}, RegionFunction -> Function[{x,y}, f[x] >= 10]] $\endgroup$ – Amzoti Apr 4 '14 at 5:21
4
$\begingroup$

Here are some ways:

Plot[x^2, {x, -5, 5}, RegionFunction -> (#^2 >= 10 &)]
Plot[x^2 Boole[x^2 >= 10], {x, -5, 5}]
Plot[Piecewise[{{x^2, x^2 >= 10}}], {x, -5, 5}]
Plot[Piecewise[{{x^2, x^2 >= 10}, {10, True}}], {x, -5, 5}, 
 PlotRange -> {0, 25}]

Note the Piecewise examples join the discontinuities and in the last example I make it continuous but no differentiable at $x=\pm \sqrt{10}$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.