Mathematica 9 is now available
Student Support Forum
Student Support Forum > General > > "Minimum Distance between Two 3D Functions?"

Post Reply:
Email Address:

Please send email when my message is replied to.

Url (optional):
Message: view original message?
Attachment (optional):
Please answer this:5+1 =

Original Message (ID '43799') By Bill Simpson:
Please check this carefully to make certain that I have not introduced any scrape-n-paste errors in the process of doing this. In[1]:= r[t_] := Piecewise[{{{-1000, -1000, -1000}, t<0}, {{5*t, 0, 3*(1 + Cos[t])}, 0 <= t <= Pi}, {{5*Pi - 5*Sin[t], 5 + 5*Cos[t], 0}, Pi2.31536,t->18.2768}} Just because we place constraints on the variables in NMinimize does not seem to ensure that the variables will always satisfy those constraints. That can mean that one or both your functions can be undefined, and thus NMinimize fails, or that a minimum outside your conditions might confuse the process. So I augment your two functions to make certain they are defined for all possible values and that they return very large results that will never be a minimum when outside your original ranges. It might be nicer if these large results got linearly worse as we get farther outside the boundaries, but sometimes just large constants are enough.