Re: Is this a problem in mathematica?
- To: mathgroup at smc.vnet.net
- Subject: [mg74627] Re: [mg74615] Is this a problem in mathematica?
- From: Sseziwa Mukasa <mukasa at jeol.com>
- Date: Thu, 29 Mar 2007 02:26:58 -0500 (EST)
- References: <200703280644.BAA20508@smc.vnet.net>
On Mar 28, 2007, at 2:44 AM, traz wrote: > Let's say I wanna solve this problem: > > Determine point(s) on y = x^2 +1 that are > closest to (0,2). > > So in mathematica: > > minDist = (x - 0)^2 + (y - 2)^2; > Minimize[minDist, y == 1 + x^2, {x, y}] > > Output will give you: x -> -1/Sqrt[2], y -> 3/2 > > but x also has another answer: +1/Sqrt[2]. Is this a problem in > mathematica or can my code be changed to output the other value of > x for the minimum distance? Minimize just searches for a minimum, if there are two or more minima it will only find one at most. If you want general solutions use Solve to find the minima of the first derivative. In[4]:= Solve[D[x\^2 + (1 + x^2 - 2)^2, x]== 0, x] Out[4]= {{x -> 0}, {x -> -1/Sqrt[2]}, {x -> 1/Sqrt[2]}} Checking the distance for each point will allow you to reject the point at 0 as a minimum. Regards, Ssezi
- References:
- Is this a problem in mathematica?
- From: traz <t_raz@yahoo.com>
- Is this a problem in mathematica?