Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a problem concerning ArcTan drawing a graph using ListPlot. I import a table of data:

a = Import["D:\2_b=10a.txt", "Table"];

Then I write:

ListPlot[Table[{i*0.005 Pi, -ArcTan[(a[[i]][[1]] - 
   a[[i - 1]][[1]]), (a[[i]][[2]] - a[[i - 1]][[2]])]}, {i, 2, 401, 1}]], PlotRange -> {{0, Pi}, {-4, 4}}]

The returned graph looks like


I know from the nature of my calculations that the function must be continuous on the interval $[0,Pi]$, but at $3Pi/4$ the ArcTan function goes to another branch, since ArcTan[x,y] chooses a quadrant. How could I possibly try to move the bottom part of the plot up by Pi, so the function is smooth and continuous?

I tried defining a function

myArcTan[x_] := Piecewise[{{ArcTan[x] + Pi, x < 0}, {ArcTan[x], x > 0}}];

but it doesn't work. Thank you very much.

share|improve this question

closed as off-topic by Louis, MarcoB, m_goldberg, Öskå, Edmund Jun 29 at 23:49

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – Louis, MarcoB, m_goldberg, Öskå, Edmund
If this question can be reworded to fit the rules in the help center, please edit the question.

This or this might help. – Daniel Lichtblau Aug 14 '14 at 17:42
Please upload your data or provide a self-contained example. – Mr.Wizard Aug 14 '14 at 20:37