Services & Resources / Wolfram Forums
MathGroup Archive
*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: Minimizing an integer value function

  • To: mathgroup at
  • Subject: [mg60896] Re: Minimizing an integer value function
  • From: Bill Rowe <readnewsciv at>
  • Date: Sun, 2 Oct 2005 01:54:47 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

On 10/1/05 at 2:55 AM, ingolf.dahl at (Ingolf Dahl) wrote:

>Suppose we have a function that only takes integer values, but
>anyway is quite smooth


>func1[x_, y_, z_] := Floor[(x - 2.1)^2 + (y - 3.21)^2 + (z - 4.3)^4
>+ 54.9]


>func2[x_, y_, z_] := Floor[(x - 2)^2 + (y - 30000)^2 + (z - 4)^4 +

>What is the best way to minimize such a function, using

Hmmm... You say the function "only takes integer values" but the examples you post are written to accept any value and return integer values. Also, I would not decribe something returning integer values as quite smooth. However, NMinimize does what you want. For example,

NMinimize[{func1[x, y, z], {x, y, z} \[Element] Integers}, 
  {x, y, z}]
{54., {x -> 2, y -> 3, z -> 4}}
To reply via email subtract one hundred and four

  • Prev by Date: Re: mole units
  • Next by Date: Re: Rounding?
  • Previous by thread: Minimizing an integer value function
  • Next by thread: Finding length in recursive definition?