I took a break from Stack Exchange, jumped in my spacecar and flew the following squiggle:
$$a_x = \cos(10 \ t)$$ $$a_y = \sin(5 \ t)$$ $$a_z = \cos(2 \ t)$$
starting at xyz = [-0.01, 0, -0.05]
and v_xyz = [0, -0.2, 0]
with a total flight time of $2 \pi$.
When I got home I was told "Oh that was a lovely lissajous squiggle, but how much delta-v did you put on the car?"
I said "Oh, not much" and made a beeline to my computer to get back on Stack Exchange.
Question: How much delta-v DID I use?
- If I have an acceleration vector (same as thrust vector; lets assume mass doesn't change) as a function of time $\mathbf{F}(t)$ what is the general integral expression for total delta-v should I use?
- If someone looked up my trip in Horizons and got my state vectors $\mathbf{x}(t)$ and $\mathbf{v}(t)$ and had a numerical integrator and interpolator, what is the general integral expression for total delta-v should they use?
"bonus points" for including a Python script in your answer
3D plot of position (returns to origin) and plots of velocity components
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from scipy.integrate import odeint as ODEint
def deriv(X, t):
x, v = X.reshape(2, -1)
ax = np.cos(10*t)
ay = np.sin(5*t)
az = np.cos(2* t)
return np.hstack((v, [ax, ay, az]))
times = np.linspace(0, 2*np.pi, 1001)
X0 = np.hstack(([-0.01, 0, -0.05], [0, -0.2, 0]))
answer, info = ODEint(deriv, X0, times, full_output=True)
xyz, vxyz = answer.T.reshape(2, 3, -1)
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1, projection='3d', proj_type = 'ortho')
x, y, z = xyz
ax.plot(x, y, z)
ax.plot(x[:1], y[:1], z[:1], 'ok')
ax.plot(x[-1:], y[-1:], z[-1:], 'or')
plt.show()
for thing in vxyz:
plt.plot(thing)
plt.show()