again: roots of transcendental function...

*To*: mathgroup at smc.vnet.net*Subject*: [mg65402] again: roots of transcendental function...*From*: Dule <dule23 at gmx.de>*Date*: Thu, 30 Mar 2006 05:29:56 -0500 (EST)*Sender*: owner-wri-mathgroup at wolfram.com

Thank y'all for the very helpful suggestions to my previous post! I'm wondering that i didn't find "Union" by myself in the Help Browser...;-) The "RootSearch" Package is very useful for my application as well! Anyway, i didn't fix my problem yet! I need to fit this model which includes the roots of this transcendental function Cot[x] == x/a - a/(4*x) to experimental data. I'm using FindMinimum and that works fine with other models. The problem now is that i need to define the function which needs to be minimized with the mentioned model. The parameter "a" is one of the fitting parameters. In previous cases where the objective function contained more steps and numerical operations, I defined a module including all steps. Doing this with FindRoot (or RootSearch) made me a lot of difficulties. For every iteration step in FindMinimum the roots for the predicted parameter "a" have to be determined and then used for the calculation of the model. Therefore i defined a module in which a list of the roots for a predicted "a" should be construct. The values of this list should than be used for calculating the model. At present i get error messages because there is no numerical value for the parameter "a" given. In case this sounds confusing, i've attached the code (in this case with FindRoot). i hope somebody can give me a hint... time = Range[0.2, 30, 0.2]; model[a_, Ï?_, t_] := Module[{Î´, x, gl}, Î´ = x /. Union[Table[FindRoot[Cot[x] == x/a - a/(4*x), {x, i}], {i, 1, 50}]]; gl = Exp[a/2 (1 - (t/ Ï?)/2)] Sum[(Î´[[ i]] (a Sin[Î´[[i]]] + 2 Î´[[i]] Cos[ Î´[[i]]]) Exp[-(Î´[[i]])^2*(t/Ï?)/a])/((Î´[[ i]])^2 + (a/2)^2 + a), {i, 1, Length[Î´]}]; gl ] hju = Map[model[a, Ï?, t] /. {Pe -> 50, Ï? -> 5} /. {t -> #} &, time]