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

MathGroup Archive 2006

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

Search the Archive

Re: optimization nested in root-finding

  • To: mathgroup at smc.vnet.net
  • Subject: [mg64995] Re: optimization nested in root-finding
  • From: dh <dh at metrohm.ch>
  • Date: Sat, 11 Mar 2006 05:15:30 -0500 (EST)
  • References: <durlt4$m9d$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Version= 5.1 for Microsoft Windows (October 25, 2004)

Hello Neely,
put a print statement Print[x] into function f2. You will see, that f2 
is called with a non numerical argument x.
You may prevent this by declaring:
f2[x_Real]:=...

HOWEVER, this is strange because FindRoot has the attribute "HoldAll" 
and should therefore replace the symbol x by a numerical value before 
calling f2.
???? HAS ANYBODY AN EXPLANATION ????
It looks like a bug to me.

Daniel

E. Neely Atkinson wrote:
> I want to find some zeros of a function f(x). The evaluation of
> f in turn requires finding a minimum. For a simple example.
> 
> obj2[x_, y_] := (x - 2)^2 + (y - 3)^2
> 
> f2[x_] :=  
>  Module[
>     {y},    
>     FindMinimum[obj2[x, y], {y, 0}][[1]]
>     ]
> 
> Thus, f2[x] is the minimum value obj[x,y] can take for a
> given fixed x.
> 
> Now, I can plot f2[x] and all is well. However, when
> I try to solve f2[x]==5, I have trouble.
> 
> FindRoot[f2[x] == 5, {x, 1, 1.01}]
> 
> complains and returns. I am sure I am doing something silly,
> but I am having a slow-brain day and would appreciate any help.
> 
> Neely Atkinson
> Department of Biostatistics and Applied Mathematics
> M. D. Anderson Cancer Center
> 
> eatkinso at mdanderson.org
> 


  • Prev by Date: Bugs--Excessive Mathematica CPU usage on Sun running Solaris 10.
  • Next by Date: Re: Import[file,"Table"] ????
  • Previous by thread: Re: optimization nested in root-finding
  • Next by thread: Re: optimization nested in root-finding