MathGroup Archive 1995

[Date Index] [Thread Index] [Author Index]

Search the Archive

Question about FindRoot function?


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


  • Prev by Date: Re: Optimizing FindMinimum for speed using intermediate calculations.
  • Next by Date: DirectionFieldPlot[]
  • Previous by thread: Re: [Q] Differential operators <--> polynomials
  • Next by thread: DirectionFieldPlot[]