MathGroup Archive 2002

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

Search the Archive

Re: Find all complex root in a region

  • To: mathgroup at smc.vnet.net
  • Subject: [mg38123] Re: [mg38072] Find all complex root in a region
  • From: Selwyn Hollis <selwynh at earthlink.net>
  • Date: Tue, 3 Dec 2002 04:33:44 -0500 (EST)
  • References: <200211281909.OAA24065@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

(1) The function may have no zeros.

(2) The coefficients in your function have such wildly differing 
magnitudes that you'll never get any reliable numerical results unless 
you do a lot of rescaling.

Hope this helps...

---
Selwyn Hollis


Massimiliano Casaletti wrote:
> Hi all,
> i have to find all the roots in a region of this equation for a sweep
> of value in w :
> function[z_,w_]:=Module[{k0,sl},k0=w/(3*10^8);sl=(Sqrt[k0^2-z^2])/(377*k0)-(I*Sqrt[e*k0^2-z^2])/(377*k0*Tan[o*Sqrt[e*k0^2-z^2]])+I
> w a (1 - b t w^2)/((1 - b t w^2)*(1 - g a w^2) - b a w^2)];
> 
> where a,b,g,t,o,e are costs:
> 
> o=0.00406
> e=1.001
> b=0.048*10^(-9)
> t=0.4521*10^(-12)
> g=0.396*10^(-9)
> a=0.176*10^(-12)
> 
> I've tried with the following function posted by Selwyn Hollis:
> 
> shotgun[fn_, {z_Symbol, z1_?NumericQ, z2_?NumericQ, dz_?NumericQ},
>     tol_?NumericQ, fuzz_?NumericQ]:= Module[{gridpts,shot,solns},
> 
>   (* Construct a list of grid points. The mesh size is dz.*)
>    gridpts = Table[x + I*y, {x,Re[z1],Re[z2],dz},
> {y,Im[z1],Im[z2],dz}];
> 
>   (* It's a bit faster if we compile Abs[fn]. *)
>    fc = Compile[{{z,_Complex,2}}, Abs[fn]];
> 
>   (* Keep only the grid points where Abs[fn] < tol. *)
>    starters = Extract[gridpts, Position[fc[gridpts], _?(#<tol&)]];
> 
>   (* Map FindRoot through the list of starting points.*)
>    shot = Chop@FindRoot[fn,{z,#}]&/@starters;
> 
>   (* Sort by magnitude and remove "repetitions".
>      A "repetition" occurs when consecutive solutions differ by  	
>      less than fuzz. *)
>    solns = Sort[shot,(Abs[z/.#1] < Abs[z/.#2])&];
>    solns = First/@Split[solns,(Abs[(z/.#1)-(z/.#2)] < fuzz)&];
> 
>   (* Sort again and remove "repetitions". *)
>    First/@Split[Sort[solns],(Abs[(z/.#1)-(z/.#2)] < fuzz)&]
> 
>      ]
> 
> It works fine with some function but not with the mine.
> Does anybody know how to change it, to make it works fine?
> Thanks,
> Massimiliano Casaletti
> 
> P.S. Sorry for my english
> 
> 
> 




  • Prev by Date: Re: bug in Sum?
  • Next by Date: Re: solving non-algebraic exponential equations
  • Previous by thread: Re: Find all complex root in a region
  • Next by thread: Re: solving non-algebraic exponential equations