Re: Re: Is this a problem in mathematica?
- To: mathgroup at smc.vnet.net
- Subject: [mg74645] Re: [mg74622] Re: Is this a problem in mathematica?
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Thu, 29 Mar 2007 02:36:12 -0500 (EST)
- References: <eud3g1$l0t$1@smc.vnet.net> <200703280935.EAA28877@smc.vnet.net>
On 28 Mar 2007, at 11:35, Johan Gr=F6nqvist wrote:
> traz skrev:
>> 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?
>>
>
>
> The help browser page on Minimize says "Even if the same minimum is
> achieved at several points, only one is returned. "
>
> I think the problem might be solved by using FindMinimium, and
> starting
> from several different points.
>
> / johan
>
Even easier:
minDist = (x - 0)^2 + (y - 2)^2;
Minimize[{minDist, y == 1 + x^2 && x > 0}, {x, y}]
{3/4, {x -> 1/Sqrt[2], y -> 3/2}}
Andrzej Kozlowski=
- References:
- Re: Is this a problem in mathematica?
- From: Johan Grönqvist <johan.gronqvist@gmail.com>
- Re: Is this a problem in mathematica?