0
$\begingroup$

Say I have a function

How can I plot the following function

enter image description here

Thank you for your help!

$\endgroup$
2
  • 1
    $\begingroup$ Look up the documentation for ContourPlot. $\endgroup$
    – march
    Feb 10, 2017 at 19:24
  • $\begingroup$ I imagine you want the full heart. You can use the real-valued cube root instead of the principal valued one: ContourPlot[x^2 + (y - CubeRoot[x]^2)^2 == 1, {x, -1, 1}, {y, -1, 2}] $\endgroup$
    – Greg Hurst
    Feb 10, 2017 at 21:18

1 Answer 1

3
$\begingroup$

Using the suggestion of @march:

ContourPlot[x^2 + (y - x^(2/3))^2 == 1, {x, -1, 1}, {y, -1, 2}]

enter image description here

Alternatively, if you are more comfortable with the use of Plot:

Plot[Flatten@Solve[x^2 + (y - x^(2/3))^2 == 1, y][[;; , ;; , 2]], {x, -1, 1}]

enter image description here

$\endgroup$
5
  • $\begingroup$ Flatten is not necessary in Plot as they formulas aren't to deep, but if you want to see where it transitions from one solution to the other, you can replace it with Evaluate. $\endgroup$
    – rcollyer
    Feb 10, 2017 at 19:46
  • $\begingroup$ I think the OP meant something like ContourPlot[{x^2 + (y - x^(2/3))^2 == 1, (-x)^2 + (y - (-x)^(2/3))^2 == 1}, {x, -1, 1}, {y, -1, 2}, ContourStyle -> Red]? (+1) $\endgroup$
    – kglr
    Feb 10, 2017 at 19:47
  • $\begingroup$ Thanks for helping me ... excellent answer @Marchi $\endgroup$ Feb 10, 2017 at 20:10
  • $\begingroup$ Thanks for helping me ... excellent answer @rcollyer $\endgroup$ Feb 10, 2017 at 20:10
  • $\begingroup$ Thanks for helping me ... excellent answer @kglr $\endgroup$ Feb 10, 2017 at 20:11

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