7
$\begingroup$

The function y = 4 - 4 ( (1 - x^4)^(1/4) ) is defined on the interval (-1, 1) but as you can see on the image rendered with Mathematika 12 the ends of the curve don't touch y = 4 line, however they must do. How do I get a better drawing?
y = 4 - 4 ( (1 - x^4)^(1/4) )

Plot[{{4 - 4 ((1 - x^4)^(1/4))}, {4}}, {x, -1, 1}, 
 AspectRatio -> Automatic, PlotRange -> Full]
$\endgroup$
7
  • 1
    $\begingroup$ You can always enlarge the interval, say from -1.5 to 1.5. $\endgroup$
    – yarchik
    Commented Feb 12, 2021 at 19:31
  • 1
    $\begingroup$ Please post the code you used to make this plot $\endgroup$
    – Conor
    Commented Feb 12, 2021 at 19:33
  • 1
    $\begingroup$ You can use the PlotRange option. $\endgroup$ Commented Feb 12, 2021 at 19:33
  • 1
    $\begingroup$ Plot[{4,4-4((1-x^4)^(1/4))},{x,-1,1},PlotRange->{0,4},PlotPoints->1000] $\endgroup$
    – Bill
    Commented Feb 12, 2021 at 19:34
  • 1
    $\begingroup$ Similar problem: mathematica.stackexchange.com/questions/173397/… $\endgroup$
    – Michael E2
    Commented Feb 12, 2021 at 19:45

2 Answers 2

17
$\begingroup$

By default, there is a very slight offset from the boundary in the sample points used.

Plot[{4 - 4 ((1 - x^4)^(1/4)), 4}, {x, -1, 1}, 
 Method -> "BoundaryOffset" -> False, AspectRatio -> Automatic]
$\endgroup$
2
  • $\begingroup$ It's funny, if I set {x, -1.5, 1.5} your method stops working. $\endgroup$
    – yarchik
    Commented Feb 12, 2021 at 21:19
  • 1
    $\begingroup$ @yarchik Seems predictable to me....Discrete sampling has its drawbacks. I think one would stick to the domain {x, -1, 1} since experience teaches going outside like {x, -1.5, 1.5} is a mistake in functions like Sqrt[] (1), 2)) and other even roots; and the problem with dancing on the edge of the domain is somewhat obvious after a little thought. $\endgroup$
    – Michael E2
    Commented Feb 13, 2021 at 2:11
8
$\begingroup$

How about a ContourPlot ?

ContourPlot[
           {
              y == 4
            , y == 4 - 4 ((1 - x^4)^(1/4))
           }
          , {x, -1, 1}
          , {y, -1, 5}
          , PlotPoints -> 200
          , AspectRatio -> GoldenRatio
          , GridLines -> Automatic
  ]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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