Question about FindRoot function?
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg1244] Question about FindRoot function?
- From: ptaszyns at uci.agh.edu.pl (Boguslaw Ptaszynski)
- Date: Fri, 26 May 1995 06:10:11 -0400
- Organization: University of Mining & Metallurgy
Hi, MathGroup !
I have a problem with FindRoot function. I want to find some roots of any
one variable function ff[x], when x runs from x1 to x2 and uses step dx.
I have written the Package named zerowe.m :
BeginPackage["Zerowe1`"]
Zerowe1::usage=".."
Begin["`Private`"]
Zerowe1[ ff_,pe_,x1_,x2_,dx_] :=
Module [ {pierw,imax,u,k,llk,i},
pierw=Table[FindRoot[ff==0,{x,k},AccuracyGoal->10, MaxIterations->50,WorkingPrecision->30],{k,x1,x2,dx}];
imax=Length[pierw];
]
End[]
EndPackage[]
Next, I have started the procedure:
<<Private/zerowe1.m
Zerowe[Tan[x]+(2/pe)*x, 60, 2, 20, 0.5]
and I have got the following message:
FindRoot::frnum:
Function(Tan[x]+(2/pe)*x)is not a length 1 list
of numbers at (Zerowa1`Private`x)=(2.0)
FindRoot::frns:
Starting value Zerowe1`Private`k$1 in
(Zerowe1`Private`x,Zerowe1`Private`k$1) is not a number
and Out:
{{Zerowe1`Private`x,Zerowe1`Private`k$5}}
Can someone tell me how does this problem solve ?
Many thanks,
Regards,
Boguslaw Ptaszynski