Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*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 2005

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

Search the Archive

Re: FindMinimum::nnum

  • To: mathgroup at smc.vnet.net
  • Subject: [mg54115] Re: [mg54075] FindMinimum::nnum
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Fri, 11 Feb 2005 03:33:27 -0500 (EST)
  • References: <200502100746.CAA16536@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On 10 Feb 2005, at 07:46, Joshua A. Solomon wrote:

> The following one-line program produces a strange error message.
>
> FindMinimum[(2.3-FindMinimum[Sin[x 
> y],{x,2}][[2,1,2]])^2,{y,1}][[2,1,2]]
>
> The error message is
>
> FindMinimum::nnum: The function value Sin[2. y] is not a number at {x} 
> =
> {2.}.
>
> Eventually, the correct output (2.05 or thereabouts) is given, but how 
> can
> this code be re-written so as not to produce the error message 
> (barring the
> obvious hack of Off[FindMinimum::nnum])?
>
> js
> -- 
> Joshua A. Solomon
> http://www.staff.city.ac.uk/~solomon
>
>
>

There are a number of ways based on the same idea; here is one that I 
find slightly amusing:


FindMinimum[(2.3 - If[y > 0, FindMinimum[Sin[x*y], {x, 2}][[2,1,2]], 
FindMinimum[Sin[x*y], {x, 2}][[2,1,2]]])^2, {y, 1}][[2,1,2]]


2.04886477306882


Andrzej Kozlowski
Chiba, Japan
http://www.akikoz.net/~andrzej/
http://www.mimuw.edu.pl/~akoz/


  • Prev by Date: Creating beta multivariate random variables
  • Next by Date: Re: Plotting just specific points
  • Previous by thread: FindMinimum::nnum
  • Next by thread: Re: FindMinimum::nnum