Advertisement
WaseemAlkurdi

Untitled

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