Re: Calculating Sums Of Roots For Trans. Functions

*To*: mathgroup at smc.vnet.net*Subject*: [mg5536] Re: [mg5498] Calculating Sums Of Roots For Trans. Functions*From*: Allan Hayes <hay at haystack.demon.co.uk>*Date*: Thu, 19 Dec 1996 01:02:33 -0500*Sender*: owner-wri-mathgroup at wolfram.com

frankst at deakin.edu.au (Frank Stagnitti) [mg5498] Calculating Sums Of Roots For Trans. Functions writes >>>>>>>>>>> How do i calculate the first n roots of tan(z) = -z, and then sum them in one command. I think i need the right combinations of Findroot, Table and N/Sum commands. Findroot and Table give me a non-unique and non-ordered set of roots e.g. RootTable = Table[{FindRoot[Tan[z]==-z, {z,i}, MaxIterations ->50],i},{i,0,EndRange,Pi}] // TableForm In short, i'd like a procedure/command that essentially sums the first n (unique and ordered) roots of tan(z) = - z with no user intervention Any ideas?? <<<<<<<<<<<<<< Frank, From Plot[{-x, Tan[x]}, {x,0,20}] and a little experimentation we get the sum of the first fifty positive roots as follows Sum[ z/.FindRoot[Tan[z] == -z, {z,Pi/2 + n Pi + .02/(n+1)}, MaxIterations ->50 ], {n,0,49} ] 3928.67 The erratic behaviour shown by your code: RootTable = Table[{FindRoot[Tan[z]==-z, {z,i}, MaxIterations ->50],i},{i,0,60,Pi}]// TableForm z -> 0. 0 z -> 2.02876 Pi z -> 2.02876 2 Pi z -> 2.02876 3 Pi z -> 2.02876 4 Pi z -> 7.97867 5 Pi z -> 2.02876 6 Pi z -> 2.02876 7 Pi z -> 2.02876 8 Pi z -> 14.2074 9 Pi z -> 7.97867 10 Pi z -> 4.91318 11 Pi z -> 2.02876 12 Pi z -> 20.4692 13 Pi z -> 2.02876 14 Pi z -> 20.4692 15 Pi z -> 2.02876 16 Pi z -> 26.7409 17 Pi z -> 14.2074 18 Pi z -> 23.6043 19 Pi is explained by Plot[{-x, Tan[x]}, {x,0,20}] Try drawing a tangent to the curve at the points with these x coordinates, where it meets the x-axis is the first step in the root finding process. We can track what happens starting at 12Pi as follows: FindRoot[Tan[Print[z];z] == -z, {z,12Pi}] z 37.6991 18.8496 9.42478 4.71239 7.06858 4.37906 3.6763 1.86049 1.97323 2.02324 2.02871 2.02876 2.02876 {z -> 2.02876} Allan Hayes hay at haystack.demon.co.uk http://www,haystack.demon.co.uk