Re: Problem with element and Maximize
- To: mathgroup at smc.vnet.net
- Subject: [mg82767] Re: Problem with element and Maximize
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Tue, 30 Oct 2007 05:45:12 -0500 (EST)
- Organization: Uni Leipzig
- References: <fg6r4j$du1$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
Hi, you really think that: if you feed Maximize with floating point (machine preccision numbers) it would remove all rounding errors and present you an integer ... and you think that Round[] the solution would not be the better idea ?? Regards Jens Uncle Paul wrote: > I'm not sure what I am doing wrong. I am trying to get the nearest > integer maximim for the mentioned equation. I could round the X > value, but I would like to operate Mathematica correctly. > > (*generate the equation*) > data = {{0, 0}, {10, 10}, {20, 0}, {30, 10}}; > eq = Fit[data, {1, x, x^2, x^3}, x] > Plot[eq, {x, 0, 30}] > > Maximize[{eq, x \[Element] Integers}, x] (*wrong!*) > > Maximize[{eq}, x] (*correct, but not integer, of course*) > > > Best Regards, > Paul >