Hi, an overflow error keeps occurring at the step where I calculate my FX. Have tried multiple ways, anyone able to help?? This is an algoritm for the Newton Rhapson method.
Thank you.
Thank you.
PHP:
Sub NewtonRhapsonMethod()
Dim a, E As Double 'a is the inputed initial value, E is the Accuracy(Epsilon)
Dim k, N As Integer
Dim FX, FDX, DL As Double 'FDX is the derivative of FX, FV is the functional value of the updated estimate
a = Cells(3, 7)
E = Cells(5, 7)
N = Cells(5, 8)
k = 1
Cells(2, 1) = k
Cells(2, 2) = a
a = x
Do While k <= N
FX = ((x) ^ 4) + (2 * ((x) ^ (2))) - (x) - (3)
FDX = 4 * (x) ^ 2 + 2 * (x) - 1
DL = -(FX) / (FDX)
x = x + DL
Cells(1 + k, 3) = DL
Cells(1 + k, 4) = x
Cells(1 + k, 5) = FX
If Abs(DL) <= 0 Then
Cells(1 + k, 4).Select
ActiveCell.Interior.ColorIndex = 36
ActiveCell.Font.Bold = True
Exit Sub
End If
If k > N Then
MsgBox "Procedure is not successful"
Exit Sub
End If
k = k + 1
Cells(1 + k, 1).Value = k
Loop
End Sub