Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

This question already has an answer here:

I have a plot but the x and y axis need to be switched. The problem is that I can't explicitly solve for the other so I can change the axis.

e = .65;

Ec[M_] = M + 
  Sum[(1/2^(n - 1)*
      Sum[((-1)^k*(n - 2*k)^(n - 1))/((n - k)!*k!)*
        Sin[(n - 2*k)*M], {k, 0, Floor[n/2]}])*e^n, {n, 1, 3}]
Plot[Ec[M], {M, 0, 2 \[Pi]}, 
 PlotRange -> {{0, 2 \[Pi]}, {0, 2 \[Pi]}}]

Basically, I want Ec to be on the x axis and M the y axis. As of right now, they are swapped.

share|improve this question
    
You've seen ParametricPlot[]? –  J. M. May 27 '13 at 3:35
    
@J.M. I have used it before. –  dustin May 27 '13 at 3:35
1  
In that case, ponder on what ParametricPlot[{Sin[y], y}, {y, 0, 3}] does, and see if you can apply this to your problem at hand. –  J. M. May 27 '13 at 3:38
    
@J.M. thanks, can you post this an answer so I can accept it? –  dustin May 27 '13 at 3:40
2  
I was actually encouraging you to answer your own question using my hint... ;) Please do so. –  J. M. May 27 '13 at 3:42
add comment

marked as duplicate by m_goldberg, Artes, Michael E2, Yves Klett, Oleksandr R. May 27 '13 at 15:38

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

up vote 6 down vote accepted

Per J.M.s suggestion, the solution to the problem is:

e = .65;

Ec[M_] = M + 
   Sum[(1/2^(n - 1)*
       Sum[((-1)^k*(n - 2*k)^(n - 1))/((n - k)!*k!)*
         Sin[(n - 2*k)*M], {k, 0, Floor[n/2]}])*e^n, {n, 1, 10}];
ParametricPlot[{Ec[M], M}, {M, 0, 2 \[Pi]}, 
 PlotRange -> {{0, 2 \[Pi]}, {0, 2 \[Pi]}}, GridLines -> Automatic, 
 PlotStyle -> Red]
share|improve this answer
    
Excellent. ${}$ –  J. M. May 27 '13 at 3:50
    
@MichaelE2 not for another day. –  dustin May 27 '13 at 23:31
    
OK - just wanted to make sure you knew. Sorry to be a bother. –  Michael E2 May 28 '13 at 0:46
add comment

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