Program For Bisection Method In Fortran

/ Comments off

I'm trying to implement Bisection Method with Fortran 90 to get solution, accurate to within 10^-5 for 3x - e^x = 0 for 1.

  1. Bisection Method By Hand

Program rootfinderbisectionimplicit nonereal(4)::a,b,xn,fa,fb,fn,f,e,xn,t1,t2write(.,.)'Enter the temperatures t1 and t2'read(.,.)t1, t2write(.,.)'Enter your interval guess, a,b'read(.,.)a,bwrite(.,.)'Enter the precision you want'read(.,.)efa=f(a)fb=f(b)if (abs(fa)0) thenwrite(.,.)'There's an even number of root(s) in that interval'stopendifxn=0.5.(a+b)fn=f(xn)do while (abs(fn)e)if (fa.fn. The problem is that for the values I said above, I get the message 'There's an even number of root(s) in that interval'. Thus apparently the condition f(a).f(b)0 is satisfied.

However when I enter the numbers in my pocket calculator I get f(a)=-2.3862. And f(b)=2.3862. Where I truncated both values.

Airline industry fixed costs

Bisection

Thus the condition is not satisfied.I really don't see what's wrong. Any idea?Edit: I tried with many different values for a and b. I even changed t1 and t2, same message.Edit2: I've just tested the values of fa and fb. It thinks they are worth infinity. Going to check this out.Edit3: No idea why it thinks they are worth infinity.

Bisection Method By Hand

O0.Edit4: ok it does not plug in t1 and t2 inside my function.