Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Is this a problem in mathematica? (2nd)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg74631] Re: Is this a problem in mathematica? (2nd)
  • From: Peter Pein <petsie at dordos.net>
  • Date: Thu, 29 Mar 2007 02:29:01 -0500 (EST)
  • References: <eud3g1$l0t$1@smc.vnet.net> <eudcub$s6o$1@smc.vnet.net>

dimitris schrieb:
> Execute the following command also
> 
> FrontEndExecute[{HelpBrowserLookup["RegGuide", "Maximize"]}]
> 
> and see the "Furter Examples".
> 
> For your needs the following will give you waht you want.
> 
> (Minimize[(x + 0)^2 + (y - 2)^2, y == x^2 + 1 && #1[x, 0], {x, y}]
> & ) /@ {Greater, Less}
> 
> {{3/4, {x -> 1/Sqrt[2], y -> 3/2}}, {3/4, {x -> -(1/Sqrt[2]), y ->
> 3/2}}}
> 
> Dimitris
> 
> =CF/=C7 traz =DD=E3=F1=E1=F8=E5:
>> 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 mathemati=
> ca or can my code be changed to output the other value of x for the minimum=
>  distance?
> 
> 

Or remember that the derivative of the distance has to be zero and the second
(or any even) derivative has to be >0 at the minima:

In[1]:=
distsquare[x_] := (#1 . #1 & )[{x, 1 + x^2} - {0, 2}];
Reduce[distsquare'[x] == 0 && distsquare''[x] > 0, x]

Out[2]= x == -(1/Sqrt[2]) || x == 1/Sqrt[2]


P²


  • Prev by Date: RE: comments in import files
  • Next by Date: Re: Re: Is this a problem in mathematica?
  • Previous by thread: Re: Is this a problem in mathematica? (2nd)
  • Next by thread: Closing All Input Cells at Once