Given a basic, two-dimensional ballistic trajectory problem, I can solve the equations of motion using DSolve
(or NDSolve
) by decomposing the vector equations of motion into equations with the scalar components, as follows:
DSolve[
Flatten@{
Thread[{rx''[t], ry''[t]} == {rx[t], -9.8 ry[t]}],
Thread[{vx[t], vy[t]} == {rx'[t], ry'[t]}],
{Thread[{rx[0], ry[0]} == {0, 0}],
Thread[{vx[0], vy[0]} == {40 Cos[30 °],
40 Sin[30 °]}]}
},
{rx[t], ry[t], vx[t], vy[t]},
t
];
But which general approaches are possible to do this just with "vectors"? (I'm not interested in having anyone solve this particular example per se.)
For example, something like this would be desirable:
DSolve[
{
Thread[m r''[t] == {0, -9.8} r[t]],
Thread[v[t] == r'[t]],
{Thread[r[0] == {0, 0}],
Thread[v[0] == {40 Cos[30 °], 40 Sin[30 °]}]}
},
{r[t], v[t]},
t
]
Surely this must be possible in some way? I understand that "vectors" are just Lists
, and that Mathematica doesn't know that I want r[t]
, r'[t]
or v[t]
to be "vectors". However, using {r[t][[1]],r[t][[2]]}
hasn't worked for me yet, either. I would also prefer to implement the method myself "manually" rather than rely on packages which I would have to see as a black box.
DSolve
. One can write a function to replace vector functions with component/coordinate functions and then reassemble the component solutions into a vector solution. I don't know what's the matter with such an approach. You'd think users would have asked for it and WRI considered it. $\endgroup$