5
$\begingroup$

How can I plot a quarter of circle using x as abscissa while y as ordinate by taking advantage of the Plot function of Mathematica when a is in the range of [0,Pi/2] ?

x=2*Sin[a];
y=2*Cos[a];
$\endgroup$
2
  • 1
    $\begingroup$ You mean you don't want to use ParametricPlot? $\endgroup$
    – xzczd
    Oct 15 '12 at 5:09
  • $\begingroup$ @xzczd, I am sorry for my poor experience in using mathematica and I haven't used ParametricPlot till now. But in fact, it really works. $\endgroup$
    – SunnySky
    Oct 16 '12 at 0:08
8
$\begingroup$

Use ParametricPlot, not Plot:

ParametricPlot[{2*Sin[a], 2*Cos[a]}, {a, 0, Pi/2}]

Mathematica graphics

$\endgroup$
5
  • 3
    $\begingroup$ You should leave some easy ones for the newer/intermediate users, y'know... $\endgroup$
    – rm -rf
    Oct 15 '12 at 15:13
  • $\begingroup$ @rm-rf I doubt SunnySky is unhappy about getting an answer sooner rather than having to wait until later. $\endgroup$
    – Mr.Wizard
    Oct 15 '12 at 21:46
  • 1
    $\begingroup$ It is kinda discouraging to see you answer all the low hanging fruits, is all I'm saying. These posts allow new and intermediate users to feel like they're contributing something to the site and it's important to realize that we also need to constantly build a pool of users who are motivated to answer questions. This is not a race to see who can answer all the low hanging questions... FYI, I prowl the site way more often and compulsively than you do and have been doing so since January; I leave most of the low hanging ones and only answer some when I've gone a stretch without much rep gain. $\endgroup$
    – rm -rf
    Oct 15 '12 at 22:09
  • 1
    $\begingroup$ @rm-rf I'd like to hear about this "problem" from some of the "new and intermediate users" I'm supposedly discouraging rather than one of the top dogs (or frogs). It's not as though I am responding to the majority of questions as I once did on SO; I'm busier now and the site is much busier. I still see the site as being primarily about getting help, not gaining "points," and I feel that delaying or omitting answers works against this goal. $\endgroup$
    – Mr.Wizard
    Oct 15 '12 at 22:31
  • $\begingroup$ @rm-rf Also, I don't doubt that you could answer a lot more questions than you do but I don't know if your reserve is actually helping anyone (besides me perhaps as it is kinda fun being at the top of the score board). $\endgroup$
    – Mr.Wizard
    Oct 15 '12 at 22:34
8
$\begingroup$

Here is a solution from graphics primitive Circle:

Graphics[Circle[{0, 0}, 1, {0, Pi/2}]]

enter image description here

I am not sure what the final goal of your question is, but maybe this will help - this is how to use graphics primitives inside Plot

Plot[Sin[x], {x, -Pi/2, Pi/2},
 Epilog -> {Thick, Circle[{0, 0}, 1, {0, Pi/2}]},
 AspectRatio -> Automatic, Frame -> True, Axes -> False]

enter image description here

You can provide a lot of options to Circle, including making it elliptic. Here is basic options for circular arc:

Manipulate[
 Graphics[{
   {CapForm["Round"], Thickness[.05], Blue, 
    Circle[{0, 0}, 1, {a, a + s}]},
   {Thick, Circle[]}}]
 , {{a, 0, "position"}, 0, 2 Pi}
 , {{s, Pi/2, "angle"}, 0, 2 Pi}]

enter image description here

$\endgroup$
5
  • $\begingroup$ This is interesting but I don't think it answers the question asked. (+1/-1) $\endgroup$
    – Mr.Wizard
    Oct 15 '12 at 5:59
  • $\begingroup$ @Mr.Wizard oh, forgot to read below the title... :) keep/delete? $\endgroup$ Oct 15 '12 at 6:02
  • $\begingroup$ Keep; someone's bound to stumble onto this question when looking for the functionality you show, so I deem it helpful. I just can't make up my mind on the vote. $\endgroup$
    – Mr.Wizard
    Oct 15 '12 at 6:05
  • 2
    $\begingroup$ @Mr.Wizard - I don't see how this wouldn't answer OP's question. Granted Vitaliy doesn't use Plot, but ParametricPlot isn't Plot either. And with Graphic and Circle the result is there! :-) $\endgroup$
    – stevenvh
    Oct 15 '12 at 14:47
  • $\begingroup$ @stevenvh the OP specifically asks to plot (lower case) this from given equations for x and y over a specific interval. None of that is in this answer. Presumably the OP didn't know about ParametricPlot and just assumed that the functionality was somewhere in Plot. $\endgroup$
    – Mr.Wizard
    Oct 15 '12 at 21:43

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.