4
$\begingroup$

I'm trying to find the shortest distance between r(t) and rm(t), at a certain time t. I could not get it using EuclideanDistance, any guess on how to do that? Here is what I have:

r[t_] = {Sin[2 \[Pi]*t], t^3, Cos[2 \[Pi]*t]^2}; EscapePath = ParametricPlot3D [ r[t], {t, 0, 2}, AxesLabel -> {Style["x", Large], Style["y", Large ], Style["z", Large]}]; start = Graphics3D[{Green, Sphere[r[0], 0.1]}]; loc1 = Graphics3D[{Red, Sphere [r[2], 0.1]}]; rm[t_] = {1.2*Sin[2 \[Pi]*t], t^4, 1.1*Cos[2 \[Pi]*(t + 0.2)]^2}; MissilePath = ParametricPlot3D [ rm[t], {t, 0, 2}, AxesLabel -> {Style["x", Large], Style["y", Large ], Style["z", Large]}]; startm = Graphics3D[{Blue, Sphere[rm[0], 0.1]}]; loc1m = Graphics3D[{Yellow, Sphere [rm[2], 0.1]}]; Show[EscapePath, MissilePath, start, startm, loc1, loc1m, PlotRange -> All, Background -> RGBColor[0.97`, 0.93`, 0.68`] ] 
$\endgroup$

2 Answers 2

4
$\begingroup$
r[t_] = {Sin[2 \[Pi]*t], t^3, Cos[2 \[Pi]*t]^2}; rm[t_] = {1.2*Sin[2 \[Pi]*t], t^4, 1.1*Cos[2 \[Pi]*(t + 0.2)]^2} // Rationalize; separation[t_] = EuclideanDistance[r[t], rm[t]] // Simplify[#, Element[t, Reals]] &; separation[t] == Norm[r[t] - rm[t]] // Simplify[#, Element[t, Reals]] & 

True

minPts = {#[[2, 1, -1]], #[[1]]} & /@ (FindMinimum[ {separation[t], 0 <= t <= 2}, {t, #}] & /@ {.15, .4, .65, .9, 1.15, 1.4}); Plot[separation[t], {t, 0, 1.5}, Epilog -> {Red, PointSize[Medium], Tooltip[Point[#], #] & /@ minPts}, Frame -> True, Axes -> False, FrameLabel -> (Style[#, 14] & /@ {"t", "Separation"})] 

enter image description here

NMinimize[{separation[t], 0 <= t <= 2}, t] 

{0.118657, {t -> 0.4059}}

$\endgroup$
1
  • $\begingroup$ Wow that is exactly what i was trying to achieve, thanks. I was using the function EuclideanDistance wrong so thats why it wouldn't compute the distance. $\endgroup$ Commented Sep 20, 2014 at 1:38
2
$\begingroup$

The minimum of distance is achieved at the same point as the minimum of the square of the distance, so

Minimize[{, (r[t]-rm[t]).(r[t]-rm[t]), t>=0, t<=2}, {t}] 

Should do the trick.

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.