Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'When using Bisection Method in Mathematica.' topicStudent Support Forum > General > Archives > "When using Bisection Method in Mathematica."

Next Comment >Help | Reply To Topic
Author Comment/Response
Heecheol Ihm
10/25/98 10:20am

Hi, everyone.
Below , I made a program using Bisection Method to
solve the funtion fun1.
I want a advice to correct a error in my program.
If anybody know it, send email to me.

Clear[beta,gammac,gammas,kappamax,fun1]

n1=1.;
n2=3.44;
n3=3.4;
h=1 10^(-3);
lambda=1.15 10^(-3);
k=2 Pi/lambda;
beta=Sqrt[n2^2 k^2 - kappa^2];
gammac=Sqrt[beta^2 - n1^2 k^2];
gammas=Sqrt[beta^2 - n3^2 k^2];
kappamax=Sqrt[n2^2 k^2 - n3^2 k^2];



fun1[kappa_]:=Tan[h kappa^2] - (Sqrt[(n2^2-n1^2)k^2-kappa^2]+
Sqrt[(n2^2-n3^2)k-kappa^2])/(kappa(1-((Sqrt[(n2^2-n1^2)k^2-
kappa^2])(Sqrt[(n2^2-n3^2)k^2-kappa^2]))/kappa^2))

Plot[{Tan[h kappa]-(gammac + gammas)/(kappa (1 -
(gammac gammas)/kappa^2))},
{kappa,1,kappamax}, PlotRange->{-10,10}];
error=10^(-5);
bi=1900.;
bf=2500.;

If[Abs[fun1[bi]]<error,
Print[''Solution='',bi,'' '',fun1[bi]]];
If[Abs[fun1[bf]]<error,
Print[''Solution='',bf,'' '',fun1[bf]]];

Print[''Solution='',bi,'' '',fun1[bi]//N];
Print[''Solution='',bf,'' '',fun1[bf]//N];

If[fun1[bi]*fun1[bf]>0,
Print[''There is no solution in this region'']];

( Label[point1];
bm=(bi+bf)/2;
If[Abs[fun1[bm]]<error, Goto[point2]];
If[fun1[bm]*fun1[bi]<0, bf=bm, bi=bm];
Goto[point1];
Label[point2];
Print[''Solution='', bm]
)


URL: ,

Subject (listing for 'When using Bisection Method in Mathematica.')
Author Date Posted
When using Bisection Method in Mathematica. Heecheol Ihm 10/25/98 10:20am
Re: When using Bisection Method in Mathematica. Forum Modera... 10/27/98 10:17am
Next Comment >Help | Reply To Topic