Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. var maxpogr_adams: Float
  2. var kol_iter_Adams = 0
  3. var ni:FloatArray
  4. var delta_yi_exp:FloatArray
  5. var delta_yi_inter:FloatArray
  6. var yi_exp:FloatArray
  7. do {
  8. maxpogr_adams=0f
  9. h = (y0 - x0) / this.iteration
  10. ni = FloatArray(iteration + 2)
  11. delta_yi_exp = FloatArray(iteration + 1)
  12. delta_yi_inter = FloatArray(iteration + 1)
  13. yi_exp = FloatArray(iteration + 1)
  14. ni[0] = h * function_Diff.function(x0, y1i[0])
  15. ni[1] = h * function_Diff.function(x0 + h, y1i[1])
  16. ni[2] = h * function_Diff.function(x0 + 2 * h, y1i[2])
  17. ni[3] = h * function_Diff.function(x0 + 3 * h, y1i[3])
  18. for (i in 3..iteration) {
  19.  
  20. delta_yi_exp[i] = (1f / 24f) * (55 * ni[i] - 59 * ni[i - 1] + 37 * ni[i - 2] - 9 * ni[i - 3])
  21. ni[i + 1] = h * function_Diff.function(x0 + i * h, y1i[i - 1])
  22. delta_yi_inter[i] = (1f / 24f) * (9 * ni[i + 1] + 19 * ni[i] - 5 * ni[i - 1] + ni[i - 2])
  23. yi_exp[i] = y1i[i] + delta_yi_exp[i]
  24.  
  25. }
  26. for (j in 3..iteration) {
  27. if (Math.abs(delta_yi_inter[j] - delta_yi_exp[j]) > maxpogr_adams)
  28. maxpogr_adams = Math.abs(delta_yi_inter[j] - delta_yi_exp[j])
  29. }
  30. if (maxpogr_adams > eps)
  31. { h / 2f}
  32. kol_iter_Adams++
  33. } while (maxpogr_adams > eps)
  34. for(i in 3..iteration)
  35. {
  36. println(yi_exp[i]+kol_iter_Adams)
  37. }
  38.  
  39. }
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement