Você está na página 1de 2

'Code illustrating Newton-Raphson scheme for the equation:

' f(x) = x4+Ax3+(AB-C-AD)x2-(AC+2ABD)x-ABC = 0

Const ep = 1E-23: Const imax = 100


Private x As Single: Private xnew As Single: Private xl As Single
Private xu As Single: Private xm As Single: Private xmold As Single: Private A As
Single: Private B As Single
Private C As Single: Private D As Single
Private i As Integer
Private Failed As Boolean: Private Converged As Boolean
Sub Setup()
Failed = False
Converged = False
i = 0
End Sub
Sub NRRoot()
Set sht = Sheets("Newton Raphson1")
For rw = 2 To 2500
A = sht.Cells(rw, 12)
B = sht.Cells(rw, 13)
C = sht.Cells(rw, 11)
D = sht.Cells(rw, 1)
x = sht.Cells(rw, 15)
Setup
Do
Dim fx As Single: Dim fprimex As Single
fx = (x ^ 4) + (A * x ^ 3) + (((A * B) - C - (A * D)) * x ^ 2) - (((A * C) + (2 * A
* B * D)) * x) - (A * B * C)
fprimex = (4 * x ^ 3) + (3 * A * x ^ 2) + (2 * ((A * B) - C - (A * D)) * x) - (((A
* C) + (2 * A * B * D)))
xnew = x - fx / fprimex
Dim er As Single
er = Abs(2 * (xnew - x) / (xnew + x))
If er < ep Then
Converged = True
ElseIf i >= imax Then
Failed = True
Else
i = i + 1
x = xnew
End If
Loop Until Converged Or Failed
If Failed Then
sht.Cells(rw, 16).Value = "Iteration failed"
Else
sht.Cells(rw, 16).Value = xnew
End If
sht.Cells(rw, 17).Value = i
Next
End Sub

http://libgen.io/search.php?
req=ASCE&lg_topic=libgen&open=0&view=simple&res=25&phrase=1&column=def

https://suckhoe.vnexpress.net/tin-tuc/khoe-dep/4-phut-tap-ngoai-troi-cua-thanh-
nien-han-quoc-3834491.html

https://www.otosaigon.com/threads/doi-dieu-chia-se-ve-phim-cach-nhiet-o-to.8801451/
https://www.youtube.com/watch?v=1IbHPm_QNKQ

Você também pode gostar