# Motion study using initial conditions

I think I'm making a mistake to reach my goal.

I would like to find an $x[t]$ function that could describe the following conditions:

1 - The object is in position $x=151$ (meters) at time $t=5$ (second).

2 - The object is in position $x=1215$ (meters) at time $t=59$ (second).

3 - The object has velocity $v=0$ (meters/second) at time $t=5$ (second).

4 - The object has velocity $v=0$ (meters/second) at time $t=59$ (second).

5 - The object has acceleration $a=1$ (meters/second^2) at time $t=5$ (second).

6 - The object has acceleration $a=0$ (meters/second^2) at time $t=59$ (second).

DSolve[{x[5] == 151, x[59] == 1215, x'[5] == 0, x'[59] == 0,
x''[5] == 1, x''[59] == 0}, x[t], t]


The goal

The idea is that the object be stopped at position $x=151$, be accelerated and decelerate at a certain point in the path (which may actually be random), so that when it reaches position $x=1215$, it stops.

• This problem seems underspecified. I think that it has an infinite number of solutions. – bbgodfrey Dec 27 '17 at 14:23
• But would it be possible to get one random solution? – LCarvalho Dec 27 '17 at 14:27
• Try a sum of Chebyshev polynomials, defined over the domain {5, 59}. Choose coefficients such that the six boundary conditions are satisfied. – bbgodfrey Dec 27 '17 at 14:47
• Your question concernes an interpolation problem. What means ' I want 1/3 of the path to be linear' ? – Ulrich Neumann Dec 27 '17 at 18:37
• @Ulrich Neumann I removed the information about 1/3 linear in the path. Got confused. – LCarvalho Dec 28 '17 at 3:05

The trick is to pick a model. You have 6 equations so your model should have 6 degrees of freedom. One simple choice is a 5th order polynomial.

ClearAll[x,t,a,b,c,d,e,f]
x[t_]=a t^5+b t^4+c t^3+d t^2+e t+f


$f + e t + d t^2 + c t^3 + b t^4 + a t^5$

soln=Solve[{x[5]==151,x[59]==1215,x'[5]==0,x'[59]==0,x''[5]==1,x''[59]==0},{a,b,c,d,e,f}]


$\left\{\left\{a\to \frac{821}{76527504},b\to -\frac{124799}{76527504},c\to \frac{2668003}{38263752},d\to -\frac{12041369}{38263752},e\to -\frac{99539195}{76527504},f\to \frac{12063850529}{76527504}\right\}\right\}$

Show[{
Plot[Piecewise[{{x[5],t<5},{x[t],t>=5}}]/.soln,{t,0,60},Ticks->{{5,59},{151,1215}}],
Graphics[{Dashed,
Line@{{0,151},{65,151}},
Line@{{0,1215},{65,1215}},
Line@{{5,0},{5,220}},
Line@{{59,0},{59,1300}}
}]
}]


soln = Solve[{x[5] == 151, x[59] == 1215, x'[5] == 0, x'[59] == 0,
x''[5] == 1, x''[59] == 0}, {a, b, c, d, e, f}] /. Rule -> Set;
x[t]


$\frac{821 t^5}{76527504}-\frac{124799 t^4}{76527504}+\frac{2668003 t^3}{38263752}-\frac{12041369 t^2}{38263752}-\frac{99539195 t}{76527504}+\frac{12063850529}{76527504}$

• Added /. Rule -> Set, to show the result you wanted! – LCarvalho Dec 27 '17 at 23:34
• I saw your profile. So many years without returning to the site ... you came back just because it's the end of the year ... – LCarvalho Dec 27 '17 at 23:39
• @LCarvalho: I usually read this site on my work computer, and with their restrictions on internet posting I just don't post all that often. – user7739 Dec 28 '17 at 5:28

Your question can be easily solved with

y = Interpolation[{{{5}, 151, 0, 1} , {{59}, 1215, 0, 0}},Method -> "Hermite"]
Plot[y[t], {t, 5, 59}]


• Is it possible to obtain the polynomial function of this result? – LCarvalho Dec 27 '17 at 23:23
• @LCarvalho: Would be fine, but I don't know if its possible. You could do it by hand in the same way as user7739 proposed inhis answer. – Ulrich Neumann Dec 28 '17 at 12:53