| New Reply |
How to minimise a function of integers? |
Share Thread | Thread Tools |
| Jul18-12, 07:48 AM | #1 |
|
|
How to minimise a function of integers?
I want to find the positive integer, [itex]x[/itex], which minimises the following function:[tex]f(x) = (mn - 2(n-1)x - 1)^2[/tex]where [itex]m[/itex] and [itex]n[/itex] are positive integers. I also have the further constraint that:[tex]\frac{m}{x} = \mathrm{positive \ integer}[/tex]I guess calculus might not be a good route to take, since [itex]x[/itex] can only take certain discrete values. Indeed, computing [itex]\frac{d}{dx}f(x)[/itex] and equating to zero gives:[tex]x_{\mathrm{min}}=\frac{mn-1}{2(n-1)}[/tex]which does not necessarily lead us to the correct solution (if we round to the nearest integer factor of [itex]m[/itex]).
Does anyone know how to solve this sort of problem? |
| Jul18-12, 08:47 AM | #2 |
|
|
|
| Jul18-12, 10:21 AM | #3 |
|
|
i personally don't see how you can do better than what you have.
let's say m = 2^4*3^3 = 432 if n is a low value, say 5, i get... (432*5-1)/(2*(5-1)) = 269; closest factor being 216. (432*5-2*4*216-1)^2 = 431^2. no other factor of 432 give a smaller value. if n is large, say 7^3 = 343... (432*343-1)/(2*(343-1)) = 216. again, plugging 216 in we see no factor of m gives a better result. |
| Jul18-12, 10:27 AM | #4 |
|
|
How to minimise a function of integers?![]() In this case, the minimum is at [itex]\frac{m}{x}=1.8865[/itex], which is closer to 1 than the optimal value 3. I could probably find more extreme failures, but the shape is generally something like this. |
| Jul18-12, 10:34 AM | #5 |
|
|
The broad shape of the graph is it starts at some value, it decreases until it reaches a minimum, and then increases until it reaches a final value. So, if you know the graph has this overall shape and you know where the true minimum occurs, and you know which values of x are allowed, do you see how to combine that information? |
| Jul18-12, 10:55 AM | #6 |
|
|
|
| Jul18-12, 11:07 AM | #7 |
|
|
No matter how I look at it, I can't see how to restrict the solution to the allowable discrete values (to give some sort of closed-form expression). Although I can evaluate any example numerically, doing that doesn't really give me much real insight into the nature of the problem.
Any more ideas? |
| Jul18-12, 11:21 AM | #8 |
|
|
|
| Jul18-12, 11:29 AM | #9 |
|
|
If the function to be minimised is not symmetrical about the minimum, then I guess I'd be in trouble (?)... but my problem here is straightforward. Many thanks for the help! |
| Jul18-12, 11:47 AM | #10 |
Recognitions:
|
|
| Jul18-12, 12:59 PM | #11 |
|
|
|
| Jul18-12, 01:19 PM | #12 |
|
Recognitions:
|
Harry you havd the right idea when you said that you should use the value of x as close as possible to [itex]x_{min}=\frac{mn-1}{2(n-1)}[/itex]
But you should have expressed it as, [itex]\frac{m}{k}[/itex] as close as possible to [itex]\frac{mn-1}{2(n-1)}[/itex] which gives, [itex]\frac{1}{k}[/itex] as close as possible to [itex]\frac{mn-1}{2m(n-1)}[/itex] Where "k" is one of the factors of "m". |
| Jul18-12, 01:24 PM | #13 |
|
Recognitions:
|
^ ... continued
So in your numerical example above. Instead of solving for possible values of "x" that made 27/x as close as possible to the ideal value of 1.8865. You should instead have been solving for the value of k (where x = 27/k) such that 1/k is as close as possible to 1/1.8865. This would lead you directly to k=3 rather than k=1. |
| Jul18-12, 02:33 PM | #14 |
|
|
I would say that the minimum (for the constraints you gave us) should always occur when x = 1. I am not absolutely sure, but I'll show you what I did:
Suppose the minimum is [itex] k^2 [/itex]. Then we want the x for which [itex] f(x) = (mn - 2(n-1)x - 1)^2 = k^2 [/itex]. Now all numbers are required to be positive integers so k must be an integer. (by the way, I put k^2 because the left side is a perfect square). so [itex] mn - 2(n-1)x - 1 = ± k [/itex]. so [itex] x = \frac {1 - mn ± k} {2(1-n)} [/itex] since x is a positive integer, 1 - mn ± k must be divisible by 2(1-n). the smallest value of k for which 1 - mn + k is divisible by 2(1-n) is when 1 - mn + k = 2(1-n) (this is the smallest possible multiple of itself). so k = 2(1-n)-1+mn = 1 + mn - 2n. This will be a positive integer whenever m ≥ 2 (and if m = 1 then x must be 1 anyways because x divides m). So x is 2(1-n) / 2(1 - n) = 1 which divides m. (and so we can't use 1 - mn - k because in this case, x would be less than 1, but there are no positive integers less than 1). So the minimum respecting your constraints should always occur at x = 1 |
| Jul18-12, 03:53 PM | #15 |
|
|
There is definitely value in considering alternative ways to solve problems, looking for new things to learn and new ideas that can be applied in general. However, there is the danger of getting in the habit of being "too clever", and wind up making problems many, many times harder because you overlook a straightforward method. Worse, it can even prevent you from solving problems: if you aren't in the habit of recognizing "oh, there are only two possibilities, I can just try them both out", then that will lead to a failure to look for -- or even recognize -- solutions to hard problems that begin with"do something clever to reduce the problem to one of two possibilities...." |
| Jul19-12, 03:22 AM | #16 |
Recognitions:
|
We already have counterexamples in the thread. |
| Jul19-12, 09:36 AM | #17 |
|
|
oops I guess I messed up haha :P sorry for that
EDIT: ahhh forget it I think I see it. the denominator is 2(1-n) which is negative, so what I did was nonsense. |
| New Reply |
| Tags |
| integer value, minimization |
| Thread Tools | |
Similar Threads for: How to minimise a function of integers?
|
||||
| Thread | Forum | Replies | ||
| Euler's derivation of Riemann Zeta Function for even integers | General Math | 2 | ||
| How would you minimise these gravimetric analysis errors? | Biology, Chemistry & Other Homework | 3 | ||
| minimise constraint | Calculus & Beyond Homework | 1 | ||
| recursive formula for zeta function of positive even integers | Linear & Abstract Algebra | 8 | ||
| Function continuous at irrationas and integers | Calculus | 5 | ||