My algorithm works well and it does converge with a tolerance as a parameter precision. I
check a condition
(abs(x_fun(mid_x))>precision) & (x_fun(interval[b])*x_fun(interval[a])<0)
As I understand it, your condition will never be true, unless you are lucky to hit an
exact extrema point.
Hope it helps.
Sincerely,
Olena Ageyeva
From: clee at
hbs.edu
To: gov2001-l at
lists.fas.harvard.edu
Date: Sat, 21 Feb 2009 23:48:20 -0500
Subject: [gov2001-l] PS3 1.3 and 1.4: Question about bisection algorithm
Hi guys,
I?ve implemented a code for method of bisection, but
when I tried it on the intervals [-3, -.5], and [-.5,1], my algorithm does not
converge with a tolerance rate of 0.001. I think the reason why this is
happening is because in my base case, I always check the condition:
if(f(x_m) == 0)
However, I noticed that in the case of the interval [-3, -.5],
the f(x_m) only gets really really close to 0, but never exactly equals 0.
My question is that should I implement some sort of
round-off condition, or is this is known convergence problem with the method of
bisection?
By round-off condition, I mean that if f(x_m) gets to be
around 0.0001, then I?d tell the program that this is close enough to
zero and return the x_m value.
Thanks,
Clarence
_________________________________________________________________
Windows Live? Hotmail??more than just e-mail.
http://windowslive.com/howitworks?ocid=TXT_TAGLM_WL_t2_hm_justgotbetter_how…