title: Julia: apply rotation to ODE solution
body: <p>I am playing around with the Julia ODE module. I solve a simple Newtonian mechanics equation, involving an inclined plane. For convenience (because I did so when I solved it analytically) I rotate my axes so that <em>e<sub>x</sub></em> follows the plane, and <em>e<sub>y</sub></em> is normal to it. When displaying the solution, though, I'd like to rotate it back so that <em>e<sub>y</sub></em> coincides with the direction of gravity.</p>
  <p>Now, pulling out my position vectors from the solution object is not a problem (although my method might not be very idiomatic), nor is plotting them. But doing so, I lose the nice magic that comes with plotting the solution directly. Is there a way to apply my rotation directly to the solution object, so it still behaves like a functor with ready to roll interpolation and the like?</p>
  <p>Passing my functions definitions, I run this:</p>
  <pre><code>prob = ODEProblem(pfm!, u0, tspan, (g, alpha))
  cb = ContinuousCallback(condition, affect!)
  sol = solve(prob, Tsit5(), reltol=1e-8, abstol=1e-8, callback=cb)
  </code></pre>
  <p>When plotting sol:</p>
  <p><a href="https://i.stack.imgur.com/WnfhU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WnfhU.png" alt="Nice interpolation" /></a></p>
  <p>When getting the position vector out before hand with</p>
  <pre><code>pos = hcat(sol.u...)[[1, 2], :]
  </code></pre>
  <p>I get</p>
  <p><a href="https://i.stack.imgur.com/z5g81.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/z5g81.png" alt="No interpolation" /></a></p>
  <p>And the not-much-more existing solution after manual rotation with</p>
  <pre><code>pos = rot_mat * hcat(sol.u...)[[1, 2], :]
  </code></pre>
  <p>produces</p>
  <p><a href="https://i.stack.imgur.com/23Uja.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/23Uja.png" alt="No interpolation, rotated" /></a></p>