       Re: Is this a problem in mathematica?

• To: mathgroup at smc.vnet.net
• Subject: [mg74668] Re: [mg74615] Is this a problem in mathematica?
• From: Carl Woll <carlw at wolfram.com>
• Date: Fri, 30 Mar 2007 03:01:32 -0500 (EST)
• References: <200703280644.BAA20508@smc.vnet.net>

```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, y -> 3/2
>
>but x also has another answer: +1/Sqrt. Is this a problem in mathematica or can my code be changed to output the other value of x for the minimum distance?
>
>
Another possibility besides those menioned by others is to use Solve
once you know the minimum:

minDist=(x-0)^2+(y-2)^2;
Minimize[minDist,y==1+x^2,{x,y}]
{3/4,{x->-1/Sqrt,y->3/2}}

Solve[{minDist==3/4,y==1+x^2},{x,y}]
{{y->3/2,x->-1/Sqrt},{y->3/2,x->-1/Sqrt},{y->3/2,x->1/Sqrt},{y->3/2,x->1/Sqrt}}

Carl Woll
Wolfram Research

```

• Prev by Date: New to mathematica: Question about solving differential eqs
• Next by Date: Re: Closing All Input Cells at Once
• Previous by thread: Re: Is this a problem in mathematica?
• Next by thread: Re: Is this a problem in mathematica?