2
$\begingroup$

I've recently posted a question on Math.SE related to the graph of the following function: $$ |\sin x|^y + |\cos x|^y = 1$$

I had some troubles with transforming the function to see what the graph looks like so decide to refer to desmos, W|A and Mathematica neither of which gave me the exact plot. I would like to know:

Is it possible to improve the graph or apply some (general) technique so that it's more accurate than the ones by the link?

Here is a snippet for copy and paste: ContourPlot[Abs[Cos[x]]^y + Abs[Sin[x]]^y == 1, {x, -Pi, Pi}, {y, 0, 3}]

And its output:

plot

Please note that i'm fairly new to Mathematica and may miss something that may be obvious for an experienced user.

$\endgroup$
1
$\begingroup$

The refinement of a plot can be achieved with the Option MaxRecursion -> ...

ContourPlot[Abs[Cos[x]]^y + Abs[Sin[x]]^y == 1, {x, -Pi, Pi}, {y, 0, Pi}, MaxRecursion -> 5]

enter image description here

$\endgroup$
  • $\begingroup$ Thank for your answer, you could not reproduce it due to my fault. I was plotting it for $x \in [- \pi , \pi]$. I've just updated the OP $\endgroup$ – roman Aug 2 '18 at 9:15
  • 1
    $\begingroup$ If $x=\frac \pi 2$, then $ y$ may be an arbitrary positive real number. The same issue with $x=− \frac \pi 2$ and $x=\pi$ and $x=−\pi$. $\endgroup$ – user64494 Aug 2 '18 at 11:13
  • 1
    $\begingroup$ The MaxRecursion -> 8, WorkingPrecision -> 12 options make the realistic plot. $\endgroup$ – user64494 Aug 2 '18 at 17:32

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.