[Date Index]
[Thread Index]
[Author Index]
# Re: Math Problem in Mathematica
Daniel wrote:
>
> The problem I would like to formulate in Mathematica is: Let f[i,j] =
> Abs[Sqrt[1-(i/n)^2]-j/n]. i and j run from 1 to n, and n is a fixed
> integer >=1. I want to find the sum S of the minimum of f over j, for
> each i for given n.
>
> Example: n=7. Min (i=1, j from 1 to 7)= .01
> Min (i=2, """ )= .04
> Min (i=3, ... = .05
> etc.
>
> and the sum S = 0.20.
>
> FindMinimum seemed like the right idea, but I don't know how to make it
> work for a function of discrete values.
>
> The problem appears as Problem 10365 in AMM.
>
> Daniel Tisdale
I have three ideas about this problem:
1) FindMinimum does not work for integers. You could write your own
routine modified from any of the standard minimization methods. I
recommend looking at a copy of "Numerical Recipes in...(C, Fortran
etc)" and adapting one of the routines in chapter 10. If you decide
that simplex minimization is the way you want to go, let me know and I
will send you a mathematica version of the multidimensional simplex
routine found in chapter 10.8 of Numerical Recipes in Fortran. You
will still need to adapt the method to only use integers.
Yet there may be an easier way...
2) Your function does not appear to have any behavior unique to integer
values. Suppose you let Findminimum minimize on the real values of
your function. Lets suppose that the value for the ordinate at the
minimum is 1.3. You then check out the value of the function at 1 and 2
and take the minimum and let that be your integer value for a minimum.
OR...
3) Your function doesn't seem to expensive to compute. You could just
make a list and take the minimum element using the list based Min and
Max functions.
minf[i]=Min[Table[f[i,j],{j,1,7}]]
This has a speed drawback, but as long as your function is simple, it
might not be so bad. If you used Compile, you could probably speed it
up even more.
Hope one of these ideas helps.
--
Remove the _nospam_ in the return address to respond.
Prev by Date:
**Re: Date in Header/Footer ??**
Next by Date:
**Re: curve fitting**
Prev by thread:
**Math Problem in Mathematica**
Next by thread:
**Re: Math Problem in Mathematica**
| |