Re: Math Problem in Mathematica
- To: mathgroup@smc.vnet.net
- Subject: [mg10408] Re: Math Problem in Mathematica
- From: dreissNOSPAM@nospam.earthlink.net (David Reiss)
- Date: Mon, 12 Jan 1998 04:10:53 -0500
- Organization: EarthLink Network, Inc.
- References: <694bda$kp6@smc.vnet.net>
In article <694bda$kp6@smc.vnet.net>, Daniel <koheleth@ix.netcom.com> 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 This simple implementation seems to be what you want (it used the function Min); but, I dont seem to get exactly the same numerical results that you note in your post. Perhaps I misunderstood...or...? In[1]:= Clear[f,MinfOverj,SumMins]; f[i_,j_,n_] :=Abs[Sqrt[1-(i/n)^2]-j/n]; MinfOverj[i_,n_]:=Min[Table[ f[i,j,n], {j,1,n}]]; SumMins[n_]:=Sum[MinfOverj[i,n],{i,1,n}]; Here are the minima for n=7 for i=1 to 7 In[2]:= Table[MinfOverj[i,7],{i,1,7}]//N Out[2] {0.0102567,0.0416852,0.046365,0.0364911,0.0144315,0.0563498,0.142857} And this is the sum: In[3]:= SumMins[7]//N Out[3]= 0.348436 -- David Reiss dreissNOSPAM@nospam.earthlink.net http://home.earthlink.net/~dreiss To send personal email, remove the words "nospam" and "NOSPAM" from the email address