1
$\begingroup$

I was wondering if there is a suitable way to plot the function

$$f(x, y) = \begin{cases} x & y < x^3 \\\\ y & y \geq x^3 \end{cases}$$

Maybe with piecewise? But it's a two variables function, and the condition is itself reling on a function..

Thank you!

$\endgroup$

1 Answer 1

2
$\begingroup$

Try with:

f[x_, y_] = Piecewise[{{x, y < x^3}, {y, y >= x^3}}]

Plot3D[f[x, y], {x, -4, 4}, {y, -4, 4}, Exclusions -> None]
$\endgroup$
1
  • 3
    $\begingroup$ Simpler: Piecewise[{{x, y < x^3}}, y] (using $y$ as the default result). $\endgroup$
    – Roman
    Mar 13 at 13:03

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.