2
$\begingroup$
Graphics[{Line[{{0, 3}, {0, 0}, {1, 0}, {1, 3}}], Line[{{2, 3}, {2, 0}, {3, 0}, {3, 3}}]}]

However, I want the output like this: parabola

Parabola of different width inside the two boxes. There are previous posts on similar questions. I can draw the first parabola, but not the second one. In fact, I do not understand that answer fully.

$\endgroup$
1
  • 2
    $\begingroup$ The easiest way is to use Show and add Plot with your parabola. $\endgroup$
    – Kuba
    Commented Nov 22, 2017 at 7:02

2 Answers 2

3
$\begingroup$

I guess, this is easy to do by combination of the Plot with Lines in Epilog:

enter image description here

Choosing the right function allows the change of the width of parabola, as you see.

UPD.: I guess, code is so simple that even beginner can realize how to do it..

Framed@Plot[{(x - 100)^2, 10 (x + 100)^2}, {x, -150, 150}, 
  PlotRange -> {-5, 500}, Axes -> False, 
  Prolog -> {Black, Thick, 
    Line@{{-130, 700}, {-130, 0}, {-70, 0}, {-70, 700}}, 
    Line@{{130, 700}, {130, 0}, {70, 0}, {70, 700}}}]
$\endgroup$
0
0
$\begingroup$

You can make an elliptic shape with Graphics. For example

Graphics[{Circle[{0.5, 1.5 (*centre*)}, {0.5, 1.5(*minor and major axes*)},
                 {Pi, 2 Pi (*angular range*)}]}]

enter image description here

In your case

Graphics[{Line[{{0,3},{0,0},{1,0},{1,3}}],Circle[{0.5,1.5},{0.5,1.5},{Pi,2Pi}],
          Line[{{2,3},{2,0},{3,0},{3,3}}],Circle[{2.5,1.5},{0.5,1.5},{Pi,2Pi}]}]

enter image description here

$\endgroup$
5
  • $\begingroup$ While parabola is a special case of ellipse I don't think Circle syntax allows this. Or did I miss the point? $\endgroup$
    – Kuba
    Commented Nov 23, 2017 at 9:59
  • $\begingroup$ @Kuba, you are right and I am a disaster again. It is indeed (half) an ellipse. My high school math marks still make sense. $\endgroup$
    – Sumit
    Commented Nov 23, 2017 at 11:06
  • 1
    $\begingroup$ It can be saved but you need to get math straight, start with: Show[ Graphics[{Circle[{0, 1000 }, {10, 1000}, {Pi, 2 Pi }]}, PlotRange -> 1], Plot[5 (x + .1)^2, {x, -1, 1}] , Frame -> True ] parameters for circle are out of the blue but you can try to provide approximate formula. $\endgroup$
    – Kuba
    Commented Nov 23, 2017 at 13:25
  • $\begingroup$ The only problem is, there is no specification for the parabola. Otherwise, appearance can be deceived, at least for a certain range. For example ContourPlot[{x^2/1 + (y - 3)^2/9 == 1, x^2 == 2/3 y}, {x, -1.5, 1.5}, {y, 0, 3}] and ContourPlot[{x^2/1 + (y - 3)^2/9 == 1, x^2 == 2/3 y}, {x, -1.5, 1.5}, {y, 0, 0.5}] $\endgroup$
    – Sumit
    Commented Nov 23, 2017 at 14:03
  • $\begingroup$ I think you can assume someone wants to plot a parabola based on a/b/c parameters. $\endgroup$
    – Kuba
    Commented Nov 23, 2017 at 14:35

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.