       # Re: Math Problem in Mathematica

• To: mathgroup@smc.vnet.net
• Subject: [mg10357] Re: Math Problem in Mathematica
• From: Paul Abbott <paul@physics.uwa.edu.au>
• Date: Mon, 12 Jan 1998 04:09:54 -0500
• Organization: University of Western Australia
• References: <694bda\$kp6@smc.vnet.net>

```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.

A direct implementation works fine:

In:= f[i_, j_, n_] = Abs[Sqrt[1 - (i/n)^2] - j/n];

In:= S[n_] := Sum[Min[Table[f[i, j, n], {j, n}]], {i, 1, n}]

In:= S
Out=
24   4 Sqrt   3 Sqrt   2 Sqrt   2 Sqrt -- - --------- -
--------- - --------- + ---------- -  7        7           7
7           7

Sqrt   Sqrt
-------- - --------
7          7

Note that Mathematica gives you the exact answer to this problem rather
than a numerical approximation:

In:= N[%]
Out= 0.348436

This does not agree with the answer above.  If the sum over is
restricted to 1<=i<n then you do get an answer of approximately 0.20.

Cheers,
Paul

____________________________________________________________________
Paul Abbott                                   Phone: +61-8-9380-2734
Department of Physics                           Fax: +61-8-9380-1014
The University of Western Australia            Nedlands WA  6907
mailto:paul@physics.uwa.edu.au  AUSTRALIA
http://www.pd.uwa.edu.au/~paul

God IS a weakly left-handed dice player
____________________________________________________________________

```

• Prev by Date: Re: Easy question: Infinite Series, Infinite Sequences
• Next by Date: Re: Rotate3D bug solution
• Prev by thread: Re: Math Problem in Mathematica
• Next by thread: Re: Math Problem in Mathematica