Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' by Waseem Alkurdi - 07/10/18
- Private Sub Command1_Click()
- Dim fx, fxd, fxdd As Double
- Dim x(0 To 22) As Double
- Dim xl As Double
- x(0) = 2
- For i = 0 To 20
- fx = ((x(i)) ^ 3) + 2 * ((x(i)) ^ 2) + 10 * (x(i)) - 20
- fxd = (3 * (x(i) ^ 2) + 4 * x(i) + 10) * (3 * ((x(i) ^ 2)) + 4 * x(i) + 10)
- fxdd = 6 * x(i) + 4
- xl = ((fxd) - fx * fxdd)
- xl = sqr(xl)
- Next
- If Abs(fx) > (1 / (10 * 10 ^ 9)) Then
- x(i + 1) = x(i) - fx / (xl)
- Print "x [" & Str(x(i + 1)) & "]"
- Print "f(x)=" & Str(Abs(fx))
- End If
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement