# Modified bisection formula for deriving implied volatility for a dividend paying american option

I am trying to work out the formula for calculating the implied volatility of an american option on a stock paying dividends (discrete payments or annualized yield).

On page 171 of Haug

The following code is provided for the Bisection algorithm, along with the comment: "With small modifications, the function can also be used to find the implied volatility for American and exotic options". However, I am unable to find further information in the book (or online), which provides instructions on the required modification(s).

I include the function code below, hopefully, someone may be able to suggest the required modifications:

function BisectionAlgorithm(CallPutFlag As String, S As Double, X as Double, T As Double,
r As Double, b as Double, cm As Double) As Double
Dim vLow as Double, vHigh As Double, vi as Double
Dim cLow As Double, cHigh As Double, epsilon as Double, tempval As Double

vLow=0.01
vHigh=1
epsilon=0.000001
cLow = GBlackScholes(CallPutFlag,S,X,T,r,b,vLow)
cHigh = GBlackScholes(CallPutFlag,S,X,T,r,b,vHigh)
vi=vLow+(cm-cLow)*(vHigh-vLow)/(cHigh-cLow)
tempval=GBlackScholes(CallPutFlag,S,X,T,r,b,vi)

While Abs(cm-tempval) > epsilon
if tempval < cm Then
vLow=vi
Else
vHigh=vi
End If

cLow = GBlackScholes(CallPutFlag,S,X,T,r,b,vLow)
cHigh = GBlackScholes(CallPutFlag,S,X,T,r,b,vHigh)
vi=vLow+(cm-cLow)*(vHigh-vLow)/(cHigh-cLow)
tempval=GBlackScholes(CallPutFlag,S,X,T,r,b,vi)
Wend

BisectionAlgorithm=vi
End Function

-