Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var maxpogr_adams: Float
- var kol_iter_Adams = 0
- var ni:FloatArray
- var delta_yi_exp:FloatArray
- var delta_yi_inter:FloatArray
- var yi_exp:FloatArray
- do {
- maxpogr_adams=0f
- h = (y0 - x0) / this.iteration
- ni = FloatArray(iteration + 2)
- delta_yi_exp = FloatArray(iteration + 1)
- delta_yi_inter = FloatArray(iteration + 1)
- yi_exp = FloatArray(iteration + 1)
- ni[0] = h * function_Diff.function(x0, y1i[0])
- ni[1] = h * function_Diff.function(x0 + h, y1i[1])
- ni[2] = h * function_Diff.function(x0 + 2 * h, y1i[2])
- ni[3] = h * function_Diff.function(x0 + 3 * h, y1i[3])
- for (i in 3..iteration) {
- delta_yi_exp[i] = (1f / 24f) * (55 * ni[i] - 59 * ni[i - 1] + 37 * ni[i - 2] - 9 * ni[i - 3])
- ni[i + 1] = h * function_Diff.function(x0 + i * h, y1i[i - 1])
- delta_yi_inter[i] = (1f / 24f) * (9 * ni[i + 1] + 19 * ni[i] - 5 * ni[i - 1] + ni[i - 2])
- yi_exp[i] = y1i[i] + delta_yi_exp[i]
- }
- for (j in 3..iteration) {
- if (Math.abs(delta_yi_inter[j] - delta_yi_exp[j]) > maxpogr_adams)
- maxpogr_adams = Math.abs(delta_yi_inter[j] - delta_yi_exp[j])
- }
- if (maxpogr_adams > eps)
- { h / 2f}
- kol_iter_Adams++
- } while (maxpogr_adams > eps)
- for(i in 3..iteration)
- {
- println(yi_exp[i]+kol_iter_Adams)
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement