The attached file demo.nb:
Defines two Bezier curves cur1 and cur2. It graphs them, and then tries to use NMaximize to find the distance between them.
As the results show
(1) Plot first evaluates the plotted function with the symbolic argument "t", even though the documentation of plot says " ...evaluates the fi and gi only after assigning specific numerical values to variables." Plot seems to be smart enough to produce a correct plot, even though the call with "t" returns Null.
(2) Then NMaximize also tries to evaluate the target function with the symbolic argument "t". However, NMaximize isn't smart enough to recover when the target function returns nonsense. (And I have other examples in which the symbolic call hopelessly messes up the state of the target function, so that _no_ future call with any kind of argument would return a meaningful result.)
This seems like a general behavior in Mathematica ... I've seen it in other places.
In the case of NMaximize, it seems particularly inappropriate. What does the "N" mean, if NMaximize tries to evaluate the target symbolically?
I'm sure that the Wolfram people have a reason for this. But it seems to me that (1) the documentation should describe this behavior, and (2) there should be an option to turn it off.
And, of course, Plot should work as documented.
My apolgies for not putting the code in here directly, and making you look at the attached file. The machine I have Mathematica on is not connected to the net, so I have to carry home on a thumb drive anything I post here. So it's hard to post code.
Wolfram should be aware that it takes an hour to put togther this clean demo. And _days_ wasted because of this kind of non-intuitive and non-documented behavior of Mathematica.
Yours
David Golber