-
-
Save vassvik/66eed2f45d524901c56265996c4f8339 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b: 1x1x1 = 1 elements, 1 non-zero, 0 zeros | |
1 | |
x: 3x3x3 = 27 elements, 6 non-zeros, 21 zeros | |
0 0 0 | |
0 1 0 | |
0 0 0 | |
0 1 0 | |
1 0 1 | |
0 1 0 | |
0 0 0 | |
0 1 0 | |
0 0 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b: 3x3x3 = 27 elements, 7 non-zeros, 20 zeros | |
0 0 0 | |
0 1 0 | |
0 0 0 | |
0 1 0 | |
1 6 1 | |
0 1 0 | |
0 0 0 | |
0 1 0 | |
0 0 0 | |
x: 5x5x5 = 125 elements, 19 non-zeros, 106 zeros | |
0 0 0 0 0 | |
0 0 0 0 0 | |
0 0 1 0 0 | |
0 0 0 0 0 | |
0 0 0 0 0 | |
0 0 0 0 0 | |
0 0 2 0 0 | |
0 2 0 2 0 | |
0 0 2 0 0 | |
0 0 0 0 0 | |
0 0 1 0 0 | |
0 2 0 2 0 | |
1 0 6 0 1 | |
0 2 0 2 0 | |
0 0 1 0 0 | |
0 0 0 0 0 | |
0 0 2 0 0 | |
0 2 0 2 0 | |
0 0 2 0 0 | |
0 0 0 0 0 | |
0 0 0 0 0 | |
0 0 0 0 0 | |
0 0 1 0 0 | |
0 0 0 0 0 | |
0 0 0 0 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b: 5x5x5 = 125 elements, 25 non-zero, 100 zeros | |
0 0 0 0 0 | |
0 0 0 0 0 | |
0 0 1 0 0 | |
0 0 0 0 0 | |
0 0 0 0 0 | |
0 0 0 0 0 | |
0 0 2 0 0 | |
0 2 6 2 0 | |
0 0 2 0 0 | |
0 0 0 0 0 | |
0 0 1 0 0 | |
0 2 6 2 0 | |
1 6 42 6 1 | |
0 2 6 2 0 | |
0 0 1 0 0 | |
0 0 0 0 0 | |
0 0 2 0 0 | |
0 2 6 2 0 | |
0 0 2 0 0 | |
0 0 0 0 0 | |
0 0 0 0 0 | |
0 0 0 0 0 | |
0 0 1 0 0 | |
0 0 0 0 0 | |
0 0 0 0 0 | |
x: 7x7x7 = 343 elements, 44 non-zeros, 299 zeros | |
0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 1 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 3 0 0 0 | |
0 0 3 0 3 0 0 | |
0 0 0 3 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 3 0 0 0 | |
0 0 6 0 6 0 0 | |
0 3 0 15 0 3 0 | |
0 0 6 0 6 0 0 | |
0 0 0 3 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 1 0 0 0 | |
0 0 3 0 3 0 0 | |
0 3 0 15 0 3 0 | |
1 0 15 0 15 0 1 | |
0 3 0 15 0 3 0 | |
0 0 3 0 3 0 0 | |
0 0 0 1 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 3 0 0 0 | |
0 0 6 0 6 0 0 | |
0 3 0 15 0 3 0 | |
0 0 6 0 6 0 0 | |
0 0 0 3 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 3 0 0 0 | |
0 0 3 0 3 0 0 | |
0 0 0 3 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 1 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b: 7x7x7 = 343 elements, 63 non-zeros, 280 zeros | |
0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 1 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 3 0 0 0 | |
0 0 3 6 3 0 0 | |
0 0 0 3 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 3 0 0 0 | |
0 0 6 12 6 0 0 | |
0 3 12 51 12 3 0 | |
0 0 6 12 6 0 0 | |
0 0 0 3 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 1 0 0 0 | |
0 0 3 6 3 0 0 | |
0 3 12 51 12 3 0 | |
1 6 51 252 51 6 1 | |
0 0 12 51 12 3 0 | |
0 0 0 6 3 0 0 | |
0 0 0 1 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 3 0 0 0 | |
0 0 6 12 6 0 0 | |
0 3 12 51 12 3 0 | |
0 0 6 12 6 0 0 | |
0 0 0 3 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 3 0 0 0 | |
0 0 3 6 3 0 0 | |
0 0 0 3 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 1 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 | |
x: 9x9x9 = 729 elements, 85 non-zeros, 644 zeros | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 1 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 4 0 0 0 0 | |
0 0 0 4 0 4 0 0 0 | |
0 0 0 0 4 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 6 0 0 0 0 | |
0 0 0 12 0 12 0 0 0 | |
0 0 6 0 28 0 6 0 0 | |
0 0 0 12 0 12 0 0 0 | |
0 0 0 0 6 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 4 0 0 0 0 | |
0 0 0 12 0 12 0 0 0 | |
0 0 12 0 48 0 12 0 0 | |
0 4 0 48 0 48 0 4 0 | |
0 0 12 0 48 0 12 0 0 | |
0 0 0 12 0 12 0 0 0 | |
0 0 0 0 4 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 1 0 0 0 0 | |
0 0 0 4 0 4 0 0 0 | |
0 0 6 0 28 0 6 0 0 | |
0 4 0 48 0 48 0 4 0 | |
1 0 28 0 90 0 28 0 1 | |
0 4 0 48 0 48 0 4 0 | |
0 0 6 0 28 0 6 0 0 | |
0 0 0 4 0 4 0 0 0 | |
0 0 0 0 1 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 4 0 0 0 0 | |
0 0 0 12 0 12 0 0 0 | |
0 0 12 0 48 0 12 0 0 | |
0 4 0 48 0 48 0 4 0 | |
0 0 12 0 48 0 12 0 0 | |
0 0 0 12 0 12 0 0 0 | |
0 0 0 0 4 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 6 0 0 0 0 | |
0 0 0 12 0 12 0 0 0 | |
0 0 6 0 28 0 6 0 0 | |
0 0 0 12 0 12 0 0 0 | |
0 0 0 0 6 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 4 0 0 0 0 | |
0 0 0 4 0 4 0 0 0 | |
0 0 0 0 4 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 1 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package recurse | |
import "core:fmt" | |
PRINT :: true; | |
main :: proc() { | |
pow :: proc(x, n: int) -> int { | |
if n == 0 do return 1; | |
y := x; | |
for i in 0..n-2 do y *= x; | |
return y; | |
} | |
print :: proc(i, n: int, values_x, values_b: ^map[string]int) { | |
get_index :: proc(i: int) -> string { | |
if i == 0 do return "{i}"; | |
return fmt.tprintf("{i%s%d}", i < 0 ? "-" : "+", abs(i)); | |
} | |
if n > 0 { | |
values_b[get_index(i)] += int(pow(2, n)); | |
when PRINT do fmt.printf("(b_%s + ", get_index(i)); | |
print(i-1, n-1, values_x, values_b); | |
when PRINT do fmt.printf(" + "); | |
print(i+1, n-1, values_x, values_b); | |
when PRINT do fmt.printf(")/2"); | |
} else { | |
values_b[get_index(i)] += int(pow(2, n)); | |
values_x[get_index(i-1)] += int(pow(2, n)); | |
values_x[get_index(i+1)] += int(pow(2, n)); | |
when PRINT do fmt.printf("(b_%s + x_%s + x_%s)/2", get_index(i), get_index(i-1), get_index(i+1)); | |
} | |
} | |
print3 :: proc(i, j, k, n: int, values_x, values_b: ^map[string]int) { | |
get_index :: proc(i, j, k: int) -> string { | |
@static bx, by, bz, buf: [32]u8; | |
x := i == 0 ? "[i]" : fmt.bprintf(bx[:], "[i%s%d]", i < 0 ? "-" : "+", abs(i)); | |
y := j == 0 ? "[j]" : fmt.bprintf(by[:], "[j%s%d]", j < 0 ? "-" : "+", abs(j)); | |
z := k == 0 ? "[k]" : fmt.bprintf(bz[:], "[k%s%d]", k < 0 ? "-" : "+", abs(k)); | |
return fmt.bprintf(buf[:], "%s%s%s", z, y, x); | |
} | |
if n > 0 { | |
values_b[get_index(i, j, k)] += int(pow(6, n)); | |
when PRINT do fmt.printf("(div%s + ", get_index(i, j, k)); | |
print3(i-1, j, k, n-1, values_x, values_b); | |
when PRINT do fmt.printf(" + "); | |
print3(i+1, j, k, n-1, values_x, values_b); | |
when PRINT do fmt.printf(" + "); | |
print3(i, j-1, k, n-1, values_x, values_b); | |
when PRINT do fmt.printf(" + "); | |
print3(i, j+1, k, n-1, values_x, values_b); | |
when PRINT do fmt.printf(" + "); | |
print3(i, j, k-1, n-1, values_x, values_b); | |
when PRINT do fmt.printf(" + "); | |
print3(i, j, k+1, n-1, values_x, values_b); | |
when PRINT do fmt.printf(")/6"); | |
} else { | |
values_b[get_index(i, j, k)] += int(pow(6, n)); | |
values_x[get_index(i-1, j, k)] += int(pow(6, n)); | |
values_x[get_index(i+1, j, k)] += int(pow(6, n)); | |
values_x[get_index(i, j-1, k)] += int(pow(6, n)); | |
values_x[get_index(i, j+1, k)] += int(pow(6, n)); | |
values_x[get_index(i, j, k-1)] += int(pow(6, n)); | |
values_x[get_index(i, j, k+1)] += int(pow(6, n)); | |
when PRINT { | |
fmt.printf("(div%s + p%s + p%s + p%s + p%s + p%s + p%s)/6", | |
get_index(i, j, k), | |
get_index(i-1, j, k), | |
get_index(i+1, j, k), | |
get_index(i, j-1, k), | |
get_index(i, j+1, k), | |
get_index(i, j, k-1), | |
get_index(i, j, k+1)); | |
} | |
} | |
} | |
for i in 0..3 { | |
values_x: map[string]int; | |
values_b: map[string]int; | |
//print(0, i, &values_x, &values_b); | |
print3(0, 0, 0, i, &values_x, &values_b); | |
fmt.println(); | |
fmt.println("b:", len(values_b), values_b); | |
fmt.println("x:", len(values_x), values_x); | |
fmt.println(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "core:math/rand" | |
import "core:fmt" | |
main :: proc() { | |
r: rand.Rand; | |
rand.init(&r, 42); | |
M :: 4; | |
N :: M+2*4; | |
p: [N][N][N]f32; | |
div: [N][N][N]f32; | |
for k in 0..N-1 { | |
for j in 0..N-1 { | |
for i in 0..N-1 { | |
p[k][j][i] = rand.float32(&r); | |
div[k][j][i] = rand.float32(&r); | |
} | |
} | |
} | |
iterative_solutions: [4][M][M][M]f32; | |
iterative: { | |
p1, p2 := p, p; | |
for z in 0..3 { | |
for k in 1..N-2 { | |
for j in 1..N-2 { | |
for i in 1..N-2 { | |
p2[k][j][i] = (div[k][j][i] + p1[k][j][i-1] + p1[k][j][i+1] + p1[k][j-1][i] + p1[k][j+1][i] + p1[k-1][j][i] + p1[k+1][j][i]) / 6.0; | |
} | |
} | |
} | |
p1, p2 = p2, p1; | |
for k in 4..N-5 { | |
for j in 4..N-5 { | |
for i in 4..N-5 { | |
iterative_solutions[z][k-4][j-4][i-4] = p1[k][j][i]; | |
} | |
} | |
} | |
} | |
} | |
FLATTEN :: true; | |
explicit_solutions: [4][M][M][M]f32; | |
explicit: { | |
for k in 4..N-5 { | |
for j in 4..N-5 { | |
for i in 4..N-5 { | |
when FLATTEN { | |
x := f32(0.0); | |
x += 1*div[k ][j ][i ]; | |
x += 1*p[k-1][j ][i ]; | |
x += 1*p[k ][j-1][i ]; | |
x += 1*p[k ][j ][i-1]; | |
x += 1*p[k ][j ][i+1]; | |
x += 1*p[k ][j+1][i ]; | |
x += 1*p[k+1][j ][i ]; | |
x /= 6.0; | |
} else { | |
x := (div[k][j][i] + p[k][j][i-1] + p[k][j][i+1] + p[k][j-1][i] + p[k][j+1][i] + p[k-1][j][i] + p[k+1][j][i])/6; | |
} | |
explicit_solutions[0][k-4][j-4][i-4] = x; | |
} | |
} | |
} | |
for k in 4..N-5 { | |
for j in 4..N-5 { | |
for i in 4..N-5 { | |
when FLATTEN { | |
x := f32(0.0); | |
x += 1*div[k-1][j ][i ]; | |
x += 6*div[k ][j ][i ]; | |
x += 1*div[k ][j ][i-1]; | |
x += 1*div[k ][j ][i+1]; | |
x += 1*div[k ][j-1][i ]; | |
x += 1*div[k ][j+1][i ]; | |
x += 1*div[k+1][j ][i ]; | |
x += 1*p[k-2][j ][i ]; | |
x += 2*p[k-1][j-1][i ]; | |
x += 2*p[k-1][j ][i-1]; | |
x += 2*p[k-1][j ][i+1]; | |
x += 2*p[k-1][j+1][i ]; | |
x += 1*p[k ][j-2][i ]; | |
x += 2*p[k ][j-1][i-1]; | |
x += 2*p[k ][j-1][i+1]; | |
x += 1*p[k ][j ][i-2]; | |
x += 6*p[k ][j ][i ]; | |
x += 1*p[k ][j ][i+2]; | |
x += 2*p[k ][j+1][i-1]; | |
x += 2*p[k ][j+1][i+1]; | |
x += 1*p[k ][j+2][i ]; | |
x += 2*p[k+1][j-1][i ]; | |
x += 2*p[k+1][j ][i-1]; | |
x += 2*p[k+1][j ][i+1]; | |
x += 2*p[k+1][j+1][i ]; | |
x += 1*p[k+2][j ][i ]; | |
x /= 6.0*6.0; | |
} else { | |
x := (div[k][j][i] + (div[k][j][i-1] + p[k][j][i-2] + p[k][j][i] + p[k][j-1][i-1] + p[k][j+1][i-1] + p[k-1][j][i-1] + p[k+1][j][i-1])/6 + (div[k][j][i+1] + p[k][j][i] + p[k][j][i+2] + p[k][j-1][i+1] + p[k][j+1][i+1] + p[k-1][j][i+1] + p[k+1][j][i+1])/6 + (div[k][j-1][i] + p[k][j-1][i-1] + p[k][j-1][i+1] + p[k][j-2][i] + p[k][j][i] + p[k-1][j-1][i] + p[k+1][j-1][i])/6 + (div[k][j+1][i] + p[k][j+1][i-1] + p[k][j+1][i+1] + p[k][j][i] + p[k][j+2][i] + p[k-1][j+1][i] + p[k+1][j+1][i])/6 + (div[k-1][j][i] + p[k-1][j][i-1] + p[k-1][j][i+1] + p[k-1][j-1][i] + p[k-1][j+1][i] + p[k-2][j][i] + p[k][j][i])/6 + (div[k+1][j][i] + p[k+1][j][i-1] + p[k+1][j][i+1] + p[k+1][j-1][i] + p[k+1][j+1][i] + p[k][j][i] + p[k+2][j][i])/6)/6; | |
} | |
explicit_solutions[1][k-4][j-4][i-4] = x; | |
} | |
} | |
} | |
for k in 4..N-5 { | |
for j in 4..N-5 { | |
for i in 4..N-5 { | |
when FLATTEN { | |
x := f32(0.0); | |
x += 1*div[k-2][j ][i ]; | |
x += 2*div[k-1][j-1][i ]; | |
x += 2*div[k-1][j ][i-1]; | |
x += 6*div[k-1][j ][i ]; | |
x += 2*div[k-1][j ][i+1]; | |
x += 2*div[k-1][j+1][i ]; | |
x += 1*div[k ][j-2][i ]; | |
x += 2*div[k ][j-1][i-1]; | |
x += 6*div[k ][j-1][i ]; | |
x += 2*div[k ][j-1][i+1]; | |
x += 1*div[k ][j ][i-2]; | |
x += 6*div[k ][j ][i-1]; | |
x += 42*div[k ][j ][i ]; | |
x += 6*div[k ][j ][i+1]; | |
x += 1*div[k ][j ][i+2]; | |
x += 2*div[k ][j+1][i-1]; | |
x += 6*div[k ][j+1][i ]; | |
x += 2*div[k ][j+1][i+1]; | |
x += 1*div[k ][j+2][i ]; | |
x += 2*div[k+1][j-1][i ]; | |
x += 2*div[k+1][j ][i-1]; | |
x += 6*div[k+1][j ][i ]; | |
x += 2*div[k+1][j ][i+1]; | |
x += 2*div[k+1][j+1][i ]; | |
x += 1*div[k+2][j ][i ]; | |
x += 1*p[k-3][j ][i ]; | |
x += 3*p[k-2][j-1][i ]; | |
x += 3*p[k-2][j ][i-1]; | |
x += 3*p[k-2][j ][i+1]; | |
x += 3*p[k-2][j+1][i ]; | |
x += 3*p[k-1][j-2][i ]; | |
x += 6*p[k-1][j-1][i-1]; | |
x += 6*p[k-1][j-1][i+1]; | |
x += 3*p[k-1][j ][i-2]; | |
x += 15*p[k-1][j ][i ]; | |
x += 3*p[k-1][j ][i+2]; | |
x += 6*p[k-1][j+1][i-1]; | |
x += 6*p[k-1][j+1][i+1]; | |
x += 3*p[k-1][j+2][i ]; | |
x += 1*p[k ][j-3][i ]; | |
x += 3*p[k ][j-2][i-1]; | |
x += 3*p[k ][j-2][i+1]; | |
x += 3*p[k ][j-1][i-2]; | |
x += 15*p[k ][j-1][i ]; | |
x += 3*p[k ][j-1][i+2]; | |
x += 1*p[k ][j ][i-3]; | |
x += 15*p[k ][j ][i-1]; | |
x += 15*p[k ][j ][i+1]; | |
x += 1*p[k ][j ][i+3]; | |
x += 3*p[k ][j+1][i-2]; | |
x += 15*p[k ][j+1][i ]; | |
x += 3*p[k ][j+1][i+2]; | |
x += 3*p[k ][j+2][i-1]; | |
x += 3*p[k ][j+2][i+1]; | |
x += 1*p[k ][j+3][i ]; | |
x += 3*p[k+1][j-2][i ]; | |
x += 6*p[k+1][j-1][i-1]; | |
x += 6*p[k+1][j-1][i+1]; | |
x += 3*p[k+1][j ][i-2]; | |
x += 15*p[k+1][j ][i ]; | |
x += 3*p[k+1][j ][i+2]; | |
x += 6*p[k+1][j+1][i-1]; | |
x += 6*p[k+1][j+1][i+1]; | |
x += 3*p[k+1][j+2][i ]; | |
x += 3*p[k+2][j-1][i ]; | |
x += 3*p[k+2][j ][i-1]; | |
x += 3*p[k+2][j ][i+1]; | |
x += 3*p[k+2][j+1][i ]; | |
x += 1*p[k+3][j ][i ]; | |
x /= 6.0*6.0*6.0; | |
} else { | |
x := (div[k][j][i] + (div[k][j][i-1] + (div[k][j][i-2] + p[k][j][i-3] + p[k][j][i-1] + p[k][j-1][i-2] + p[k][j+1][i-2] + p[k-1][j][i-2] + p[k+1][j][i-2])/6 + (div[k][j][i] + p[k][j][i-1] + p[k][j][i+1] + p[k][j-1][i] + p[k][j+1][i] + p[k-1][j][i] + p[k+1][j][i])/6 + (div[k][j-1][i-1] + p[k][j-1][i-2] + p[k][j-1][i] + p[k][j-2][i-1] + p[k][j][i-1] + p[k-1][j-1][i-1] + p[k+1][j-1][i-1])/6 + (div[k][j+1][i-1] + p[k][j+1][i-2] + p[k][j+1][i] + p[k][j][i-1] + p[k][j+2][i-1] + p[k-1][j+1][i-1] + p[k+1][j+1][i-1])/6 + (div[k-1][j][i-1] + p[k-1][j][i-2] + p[k-1][j][i] + p[k-1][j-1][i-1] + p[k-1][j+1][i-1] + p[k-2][j][i-1] + p[k][j][i-1])/6 + (div[k+1][j][i-1] + p[k+1][j][i-2] + p[k+1][j][i] + p[k+1][j-1][i-1] + p[k+1][j+1][i-1] + p[k][j][i-1] + p[k+2][j][i-1])/6)/6 + (div[k][j][i+1] + (div[k][j][i] + p[k][j][i-1] + p[k][j][i+1] + p[k][j-1][i] + p[k][j+1][i] + p[k-1][j][i] + p[k+1][j][i])/6 + (div[k][j][i+2] + p[k][j][i+1] + p[k][j][i+3] + p[k][j-1][i+2] + p[k][j+1][i+2] + p[k-1][j][i+2] + p[k+1][j][i+2])/6 + (div[k][j-1][i+1] + p[k][j-1][i] + p[k][j-1][i+2] + p[k][j-2][i+1] + p[k][j][i+1] + p[k-1][j-1][i+1] + p[k+1][j-1][i+1])/6 + (div[k][j+1][i+1] + p[k][j+1][i] + p[k][j+1][i+2] + p[k][j][i+1] + p[k][j+2][i+1] + p[k-1][j+1][i+1] + p[k+1][j+1][i+1])/6 + (div[k-1][j][i+1] + p[k-1][j][i] + p[k-1][j][i+2] + p[k-1][j-1][i+1] + p[k-1][j+1][i+1] + p[k-2][j][i+1] + p[k][j][i+1])/6 + (div[k+1][j][i+1] + p[k+1][j][i] + p[k+1][j][i+2] + p[k+1][j-1][i+1] + p[k+1][j+1][i+1] + p[k][j][i+1] + p[k+2][j][i+1])/6)/6 + (div[k][j-1][i] + (div[k][j-1][i-1] + p[k][j-1][i-2] + p[k][j-1][i] + p[k][j-2][i-1] + p[k][j][i-1] + p[k-1][j-1][i-1] + p[k+1][j-1][i-1])/6 + (div[k][j-1][i+1] + p[k][j-1][i] + p[k][j-1][i+2] + p[k][j-2][i+1] + p[k][j][i+1] + p[k-1][j-1][i+1] + p[k+1][j-1][i+1])/6 + (div[k][j-2][i] + p[k][j-2][i-1] + p[k][j-2][i+1] + p[k][j-3][i] + p[k][j-1][i] + p[k-1][j-2][i] + p[k+1][j-2][i])/6 + (div[k][j][i] + p[k][j][i-1] + p[k][j][i+1] + p[k][j-1][i] + p[k][j+1][i] + p[k-1][j][i] + p[k+1][j][i])/6 + (div[k-1][j-1][i] + p[k-1][j-1][i-1] + p[k-1][j-1][i+1] + p[k-1][j-2][i] + p[k-1][j][i] + p[k-2][j-1][i] + p[k][j-1][i])/6 + (div[k+1][j-1][i] + p[k+1][j-1][i-1] + p[k+1][j-1][i+1] + p[k+1][j-2][i] + p[k+1][j][i] + p[k][j-1][i] + p[k+2][j-1][i])/6)/6 + (div[k][j+1][i] + (div[k][j+1][i-1] + p[k][j+1][i-2] + p[k][j+1][i] + p[k][j][i-1] + p[k][j+2][i-1] + p[k-1][j+1][i-1] + p[k+1][j+1][i-1])/6 + (div[k][j+1][i+1] + p[k][j+1][i] + p[k][j+1][i+2] + p[k][j][i+1] + p[k][j+2][i+1] + p[k-1][j+1][i+1] + p[k+1][j+1][i+1])/6 + (div[k][j][i] + p[k][j][i-1] + p[k][j][i+1] + p[k][j-1][i] + p[k][j+1][i] + p[k-1][j][i] + p[k+1][j][i])/6 + (div[k][j+2][i] + p[k][j+2][i-1] + p[k][j+2][i+1] + p[k][j+1][i] + p[k][j+3][i] + p[k-1][j+2][i] + p[k+1][j+2][i])/6 + (div[k-1][j+1][i] + p[k-1][j+1][i-1] + p[k-1][j+1][i+1] + p[k-1][j][i] + p[k-1][j+2][i] + p[k-2][j+1][i] + p[k][j+1][i])/6 + (div[k+1][j+1][i] + p[k+1][j+1][i-1] + p[k+1][j+1][i+1] + p[k+1][j][i] + p[k+1][j+2][i] + p[k][j+1][i] + p[k+2][j+1][i])/6)/6 + (div[k-1][j][i] + (div[k-1][j][i-1] + p[k-1][j][i-2] + p[k-1][j][i] + p[k-1][j-1][i-1] + p[k-1][j+1][i-1] + p[k-2][j][i-1] + p[k][j][i-1])/6 + (div[k-1][j][i+1] + p[k-1][j][i] + p[k-1][j][i+2] + p[k-1][j-1][i+1] + p[k-1][j+1][i+1] + p[k-2][j][i+1] + p[k][j][i+1])/6 + (div[k-1][j-1][i] + p[k-1][j-1][i-1] + p[k-1][j-1][i+1] + p[k-1][j-2][i] + p[k-1][j][i] + p[k-2][j-1][i] + p[k][j-1][i])/6 + (div[k-1][j+1][i] + p[k-1][j+1][i-1] + p[k-1][j+1][i+1] + p[k-1][j][i] + p[k-1][j+2][i] + p[k-2][j+1][i] + p[k][j+1][i])/6 + (div[k-2][j][i] + p[k-2][j][i-1] + p[k-2][j][i+1] + p[k-2][j-1][i] + p[k-2][j+1][i] + p[k-3][j][i] + p[k-1][j][i])/6 + (div[k][j][i] + p[k][j][i-1] + p[k][j][i+1] + p[k][j-1][i] + p[k][j+1][i] + p[k-1][j][i] + p[k+1][j][i])/6)/6 + (div[k+1][j][i] + (div[k+1][j][i-1] + p[k+1][j][i-2] + p[k+1][j][i] + p[k+1][j-1][i-1] + p[k+1][j+1][i-1] + p[k][j][i-1] + p[k+2][j][i-1])/6 + (div[k+1][j][i+1] + p[k+1][j][i] + p[k+1][j][i+2] + p[k+1][j-1][i+1] + p[k+1][j+1][i+1] + p[k][j][i+1] + p[k+2][j][i+1])/6 + (div[k+1][j-1][i] + p[k+1][j-1][i-1] + p[k+1][j-1][i+1] + p[k+1][j-2][i] + p[k+1][j][i] + p[k][j-1][i] + p[k+2][j-1][i])/6 + (div[k+1][j+1][i] + p[k+1][j+1][i-1] + p[k+1][j+1][i+1] + p[k+1][j][i] + p[k+1][j+2][i] + p[k][j+1][i] + p[k+2][j+1][i])/6 + (div[k][j][i] + p[k][j][i-1] + p[k][j][i+1] + p[k][j-1][i] + p[k][j+1][i] + p[k-1][j][i] + p[k+1][j][i])/6 + (div[k+2][j][i] + p[k+2][j][i-1] + p[k+2][j][i+1] + p[k+2][j-1][i] + p[k+2][j+1][i] + p[k+1][j][i] + p[k+3][j][i])/6)/6)/6; | |
} | |
explicit_solutions[2][k-4][j-4][i-4] = x; | |
} | |
} | |
} | |
for k in 4..N-5 { | |
for j in 4..N-5 { | |
for i in 4..N-5 { | |
when FLATTEN { | |
x := f32(0.0); | |
x += 1*div[k-3][j ][i ]; | |
x += 3*div[k-2][j-1][i ]; | |
x += 3*div[k-2][j ][i-1]; | |
x += 6*div[k-2][j ][i ]; | |
x += 3*div[k-2][j ][i+1]; | |
x += 3*div[k-2][j+1][i ]; | |
x += 3*div[k-1][j-2][i ]; | |
x += 6*div[k-1][j-1][i-1]; | |
x += 12*div[k-1][j-1][i ]; | |
x += 6*div[k-1][j-1][i+1]; | |
x += 3*div[k-1][j ][i-2]; | |
x += 12*div[k-1][j ][i-1]; | |
x += 51*div[k-1][j ][i ]; | |
x += 12*div[k-1][j ][i+1]; | |
x += 3*div[k-1][j ][i+2]; | |
x += 6*div[k-1][j+1][i-1]; | |
x += 12*div[k-1][j+1][i ]; | |
x += 6*div[k-1][j+1][i+1]; | |
x += 3*div[k-1][j+2][i ]; | |
x += 1*div[k ][j-3][i ]; | |
x += 3*div[k ][j-2][i-1]; | |
x += 6*div[k ][j-2][i ]; | |
x += 3*div[k ][j-2][i+1]; | |
x += 3*div[k ][j-1][i-2]; | |
x += 12*div[k ][j-1][i-1]; | |
x += 51*div[k ][j-1][i ]; | |
x += 12*div[k ][j-1][i+1]; | |
x += 3*div[k ][j-1][i+2]; | |
x += 1*div[k ][j ][i-3]; | |
x += 6*div[k ][j ][i-2]; | |
x += 51*div[k ][j ][i-1]; | |
x += 252*div[k ][j ][i ]; | |
x += 51*div[k ][j ][i+1]; | |
x += 6*div[k ][j ][i+2]; | |
x += 1*div[k ][j ][i+3]; | |
x += 3*div[k ][j+1][i-2]; | |
x += 12*div[k ][j+1][i-1]; | |
x += 51*div[k ][j+1][i ]; | |
x += 12*div[k ][j+1][i+1]; | |
x += 3*div[k ][j+1][i+2]; | |
x += 3*div[k ][j+2][i-1]; | |
x += 6*div[k ][j+2][i ]; | |
x += 3*div[k ][j+2][i+1]; | |
x += 1*div[k ][j+3][i ]; | |
x += 3*div[k+1][j-2][i ]; | |
x += 6*div[k+1][j-1][i-1]; | |
x += 12*div[k+1][j-1][i ]; | |
x += 6*div[k+1][j-1][i+1]; | |
x += 3*div[k+1][j ][i-2]; | |
x += 12*div[k+1][j ][i-1]; | |
x += 51*div[k+1][j ][i ]; | |
x += 12*div[k+1][j ][i+1]; | |
x += 3*div[k+1][j ][i+2]; | |
x += 6*div[k+1][j+1][i-1]; | |
x += 12*div[k+1][j+1][i ]; | |
x += 6*div[k+1][j+1][i+1]; | |
x += 3*div[k+1][j+2][i ]; | |
x += 3*div[k+2][j-1][i ]; | |
x += 3*div[k+2][j ][i-1]; | |
x += 6*div[k+2][j ][i ]; | |
x += 3*div[k+2][j ][i+1]; | |
x += 3*div[k+2][j+1][i ]; | |
x += 1*div[k+3][j ][i ]; | |
x += 1*p[k-4][j ][i ]; | |
x += 4*p[k-3][j-1][i ]; | |
x += 4*p[k-3][j ][i-1]; | |
x += 4*p[k-3][j ][i+1]; | |
x += 4*p[k-3][j+1][i ]; | |
x += 6*p[k-2][j-2][i ]; | |
x += 12*p[k-2][j-1][i-1]; | |
x += 12*p[k-2][j-1][i+1]; | |
x += 6*p[k-2][j ][i-2]; | |
x += 28*p[k-2][j ][i ]; | |
x += 6*p[k-2][j ][i+2]; | |
x += 12*p[k-2][j+1][i-1]; | |
x += 12*p[k-2][j+1][i+1]; | |
x += 6*p[k-2][j+2][i ]; | |
x += 4*p[k-1][j-3][i ]; | |
x += 12*p[k-1][j-2][i-1]; | |
x += 12*p[k-1][j-2][i+1]; | |
x += 12*p[k-1][j-1][i-2]; | |
x += 48*p[k-1][j-1][i ]; | |
x += 12*p[k-1][j-1][i+2]; | |
x += 4*p[k-1][j ][i-3]; | |
x += 48*p[k-1][j ][i-1]; | |
x += 48*p[k-1][j ][i+1]; | |
x += 4*p[k-1][j ][i+3]; | |
x += 12*p[k-1][j+1][i-2]; | |
x += 48*p[k-1][j+1][i ]; | |
x += 12*p[k-1][j+1][i+2]; | |
x += 12*p[k-1][j+2][i-1]; | |
x += 12*p[k-1][j+2][i+1]; | |
x += 4*p[k-1][j+3][i ]; | |
x += 1*p[k ][j-4][i ]; | |
x += 4*p[k ][j-3][i-1]; | |
x += 4*p[k ][j-3][i+1]; | |
x += 6*p[k ][j-2][i-2]; | |
x += 28*p[k ][j-2][i ]; | |
x += 6*p[k ][j-2][i+2]; | |
x += 4*p[k ][j-1][i-3]; | |
x += 48*p[k ][j-1][i-1]; | |
x += 48*p[k ][j-1][i+1]; | |
x += 4*p[k ][j-1][i+3]; | |
x += 1*p[k ][j ][i-4]; | |
x += 28*p[k ][j ][i-2]; | |
x += 90*p[k ][j ][i ]; | |
x += 28*p[k ][j ][i+2]; | |
x += 1*p[k ][j ][i+4]; | |
x += 4*p[k ][j+1][i-3]; | |
x += 48*p[k ][j+1][i-1]; | |
x += 48*p[k ][j+1][i+1]; | |
x += 4*p[k ][j+1][i+3]; | |
x += 6*p[k ][j+2][i-2]; | |
x += 28*p[k ][j+2][i ]; | |
x += 6*p[k ][j+2][i+2]; | |
x += 4*p[k ][j+3][i-1]; | |
x += 4*p[k ][j+3][i+1]; | |
x += 1*p[k ][j+4][i ]; | |
x += 4*p[k+1][j-3][i ]; | |
x += 12*p[k+1][j-2][i-1]; | |
x += 12*p[k+1][j-2][i+1]; | |
x += 12*p[k+1][j-1][i-2]; | |
x += 48*p[k+1][j-1][i ]; | |
x += 12*p[k+1][j-1][i+2]; | |
x += 4*p[k+1][j ][i-3]; | |
x += 48*p[k+1][j ][i-1]; | |
x += 48*p[k+1][j ][i+1]; | |
x += 4*p[k+1][j ][i+3]; | |
x += 12*p[k+1][j+1][i-2]; | |
x += 48*p[k+1][j+1][i ]; | |
x += 12*p[k+1][j+1][i+2]; | |
x += 12*p[k+1][j+2][i-1]; | |
x += 12*p[k+1][j+2][i+1]; | |
x += 4*p[k+1][j+3][i ]; | |
x += 6*p[k+2][j-2][i ]; | |
x += 12*p[k+2][j-1][i-1]; | |
x += 12*p[k+2][j-1][i+1]; | |
x += 6*p[k+2][j ][i-2]; | |
x += 28*p[k+2][j ][i ]; | |
x += 6*p[k+2][j ][i+2]; | |
x += 12*p[k+2][j+1][i-1]; | |
x += 12*p[k+2][j+1][i+1]; | |
x += 6*p[k+2][j+2][i ]; | |
x += 4*p[k+3][j-1][i ]; | |
x += 4*p[k+3][j ][i-1]; | |
x += 4*p[k+3][j ][i+1]; | |
x += 4*p[k+3][j+1][i ]; | |
x += 1*p[k+4][j ][i ]; | |
x /= 6.0*6.0*6.0*6.0; | |
} else { | |
x := (div[k][j][i] + (div[k][j][i-1] + (div[k][j][i-2] + (div[k][j][i-3] + p[k][j][i-4] + p[k][j][i-2] + p[k][j-1][i-3] + p[k][j+1][i-3] + p[k-1][j][i-3] + p[k+1][j][i-3])/6 + (div[k][j][i-1] + p[k][j][i-2] + p[k][j][i] + p[k][j-1][i-1] + p[k][j+1][i-1] + p[k-1][j][i-1] + p[k+1][j][i-1])/6 + (div[k][j-1][i-2] + p[k][j-1][i-3] + p[k][j-1][i-1] + p[k][j-2][i-2] + p[k][j][i-2] + p[k-1][j-1][i-2] + p[k+1][j-1][i-2])/6 + (div[k][j+1][i-2] + p[k][j+1][i-3] + p[k][j+1][i-1] + p[k][j][i-2] + p[k][j+2][i-2] + p[k-1][j+1][i-2] + p[k+1][j+1][i-2])/6 + (div[k-1][j][i-2] + p[k-1][j][i-3] + p[k-1][j][i-1] + p[k-1][j-1][i-2] + p[k-1][j+1][i-2] + p[k-2][j][i-2] + p[k][j][i-2])/6 + (div[k+1][j][i-2] + p[k+1][j][i-3] + p[k+1][j][i-1] + p[k+1][j-1][i-2] + p[k+1][j+1][i-2] + p[k][j][i-2] + p[k+2][j][i-2])/6)/6 + (div[k][j][i] + (div[k][j][i-1] + p[k][j][i-2] + p[k][j][i] + p[k][j-1][i-1] + p[k][j+1][i-1] + p[k-1][j][i-1] + p[k+1][j][i-1])/6 + (div[k][j][i+1] + p[k][j][i] + p[k][j][i+2] + p[k][j-1][i+1] + p[k][j+1][i+1] + p[k-1][j][i+1] + p[k+1][j][i+1])/6 + (div[k][j-1][i] + p[k][j-1][i-1] + p[k][j-1][i+1] + p[k][j-2][i] + p[k][j][i] + p[k-1][j-1][i] + p[k+1][j-1][i])/6 + (div[k][j+1][i] + p[k][j+1][i-1] + p[k][j+1][i+1] + p[k][j][i] + p[k][j+2][i] + p[k-1][j+1][i] + p[k+1][j+1][i])/6 + (div[k-1][j][i] + p[k-1][j][i-1] + p[k-1][j][i+1] + p[k-1][j-1][i] + p[k-1][j+1][i] + p[k-2][j][i] + p[k][j][i])/6 + (div[k+1][j][i] + p[k+1][j][i-1] + p[k+1][j][i+1] + p[k+1][j-1][i] + p[k+1][j+1][i] + p[k][j][i] + p[k+2][j][i])/6)/6 + (div[k][j-1][i-1] + (div[k][j-1][i-2] + p[k][j-1][i-3] + p[k][j-1][i-1] + p[k][j-2][i-2] + p[k][j][i-2] + p[k-1][j-1][i-2] + p[k+1][j-1][i-2])/6 + (div[k][j-1][i] + p[k][j-1][i-1] + p[k][j-1][i+1] + p[k][j-2][i] + p[k][j][i] + p[k-1][j-1][i] + p[k+1][j-1][i])/6 + (div[k][j-2][i-1] + p[k][j-2][i-2] + p[k][j-2][i] + p[k][j-3][i-1] + p[k][j-1][i-1] + p[k-1][j-2][i-1] + p[k+1][j-2][i-1])/6 + (div[k][j][i-1] + p[k][j][i-2] + p[k][j][i] + p[k][j-1][i-1] + p[k][j+1][i-1] + p[k-1][j][i-1] + p[k+1][j][i-1])/6 + (div[k-1][j-1][i-1] + p[k-1][j-1][i-2] + p[k-1][j-1][i] + p[k-1][j-2][i-1] + p[k-1][j][i-1] + p[k-2][j-1][i-1] + p[k][j-1][i-1])/6 + (div[k+1][j-1][i-1] + p[k+1][j-1][i-2] + p[k+1][j-1][i] + p[k+1][j-2][i-1] + p[k+1][j][i-1] + p[k][j-1][i-1] + p[k+2][j-1][i-1])/6)/6 + (div[k][j+1][i-1] + (div[k][j+1][i-2] + p[k][j+1][i-3] + p[k][j+1][i-1] + p[k][j][i-2] + p[k][j+2][i-2] + p[k-1][j+1][i-2] + p[k+1][j+1][i-2])/6 + (div[k][j+1][i] + p[k][j+1][i-1] + p[k][j+1][i+1] + p[k][j][i] + p[k][j+2][i] + p[k-1][j+1][i] + p[k+1][j+1][i])/6 + (div[k][j][i-1] + p[k][j][i-2] + p[k][j][i] + p[k][j-1][i-1] + p[k][j+1][i-1] + p[k-1][j][i-1] + p[k+1][j][i-1])/6 + (div[k][j+2][i-1] + p[k][j+2][i-2] + p[k][j+2][i] + p[k][j+1][i-1] + p[k][j+3][i-1] + p[k-1][j+2][i-1] + p[k+1][j+2][i-1])/6 + (div[k-1][j+1][i-1] + p[k-1][j+1][i-2] + p[k-1][j+1][i] + p[k-1][j][i-1] + p[k-1][j+2][i-1] + p[k-2][j+1][i-1] + p[k][j+1][i-1])/6 + (div[k+1][j+1][i-1] + p[k+1][j+1][i-2] + p[k+1][j+1][i] + p[k+1][j][i-1] + p[k+1][j+2][i-1] + p[k][j+1][i-1] + p[k+2][j+1][i-1])/6)/6 + (div[k-1][j][i-1] + (div[k-1][j][i-2] + p[k-1][j][i-3] + p[k-1][j][i-1] + p[k-1][j-1][i-2] + p[k-1][j+1][i-2] + p[k-2][j][i-2] + p[k][j][i-2])/6 + (div[k-1][j][i] + p[k-1][j][i-1] + p[k-1][j][i+1] + p[k-1][j-1][i] + p[k-1][j+1][i] + p[k-2][j][i] + p[k][j][i])/6 + (div[k-1][j-1][i-1] + p[k-1][j-1][i-2] + p[k-1][j-1][i] + p[k-1][j-2][i-1] + p[k-1][j][i-1] + p[k-2][j-1][i-1] + p[k][j-1][i-1])/6 + (div[k-1][j+1][i-1] + p[k-1][j+1][i-2] + p[k-1][j+1][i] + p[k-1][j][i-1] + p[k-1][j+2][i-1] + p[k-2][j+1][i-1] + p[k][j+1][i-1])/6 + (div[k-2][j][i-1] + p[k-2][j][i-2] + p[k-2][j][i] + p[k-2][j-1][i-1] + p[k-2][j+1][i-1] + p[k-3][j][i-1] + p[k-1][j][i-1])/6 + (div[k][j][i-1] + p[k][j][i-2] + p[k][j][i] + p[k][j-1][i-1] + p[k][j+1][i-1] + p[k-1][j][i-1] + p[k+1][j][i-1])/6)/6 + (div[k+1][j][i-1] + (div[k+1][j][i-2] + p[k+1][j][i-3] + p[k+1][j][i-1] + p[k+1][j-1][i-2] + p[k+1][j+1][i-2] + p[k][j][i-2] + p[k+2][j][i-2])/6 + (div[k+1][j][i] + p[k+1][j][i-1] + p[k+1][j][i+1] + p[k+1][j-1][i] + p[k+1][j+1][i] + p[k][j][i] + p[k+2][j][i])/6 + (div[k+1][j-1][i-1] + p[k+1][j-1][i-2] + p[k+1][j-1][i] + p[k+1][j-2][i-1] + p[k+1][j][i-1] + p[k][j-1][i-1] + p[k+2][j-1][i-1])/6 + (div[k+1][j+1][i-1] + p[k+1][j+1][i-2] + p[k+1][j+1][i] + p[k+1][j][i-1] + p[k+1][j+2][i-1] + p[k][j+1][i-1] + p[k+2][j+1][i-1])/6 + (div[k][j][i-1] + p[k][j][i-2] + p[k][j][i] + p[k][j-1][i-1] + p[k][j+1][i-1] + p[k-1][j][i-1] + p[k+1][j][i-1])/6 + (div[k+2][j][i-1] + p[k+2][j][i-2] + p[k+2][j][i] + p[k+2][j-1][i-1] + p[k+2][j+1][i-1] + p[k+1][j][i-1] + p[k+3][j][i-1])/6)/6)/6 + (div[k][j][i+1] + (div[k][j][i] + (div[k][j][i-1] + p[k][j][i-2] + p[k][j][i] + p[k][j-1][i-1] + p[k][j+1][i-1] + p[k-1][j][i-1] + p[k+1][j][i-1])/6 + (div[k][j][i+1] + p[k][j][i] + p[k][j][i+2] + p[k][j-1][i+1] + p[k][j+1][i+1] + p[k-1][j][i+1] + p[k+1][j][i+1])/6 + (div[k][j-1][i] + p[k][j-1][i-1] + p[k][j-1][i+1] + p[k][j-2][i] + p[k][j][i] + p[k-1][j-1][i] + p[k+1][j-1][i])/6 + (div[k][j+1][i] + p[k][j+1][i-1] + p[k][j+1][i+1] + p[k][j][i] + p[k][j+2][i] + p[k-1][j+1][i] + p[k+1][j+1][i])/6 + (div[k-1][j][i] + p[k-1][j][i-1] + p[k-1][j][i+1] + p[k-1][j-1][i] + p[k-1][j+1][i] + p[k-2][j][i] + p[k][j][i])/6 + (div[k+1][j][i] + p[k+1][j][i-1] + p[k+1][j][i+1] + p[k+1][j-1][i] + p[k+1][j+1][i] + p[k][j][i] + p[k+2][j][i])/6)/6 + (div[k][j][i+2] + (div[k][j][i+1] + p[k][j][i] + p[k][j][i+2] + p[k][j-1][i+1] + p[k][j+1][i+1] + p[k-1][j][i+1] + p[k+1][j][i+1])/6 + (div[k][j][i+3] + p[k][j][i+2] + p[k][j][i+4] + p[k][j-1][i+3] + p[k][j+1][i+3] + p[k-1][j][i+3] + p[k+1][j][i+3])/6 + (div[k][j-1][i+2] + p[k][j-1][i+1] + p[k][j-1][i+3] + p[k][j-2][i+2] + p[k][j][i+2] + p[k-1][j-1][i+2] + p[k+1][j-1][i+2])/6 + (div[k][j+1][i+2] + p[k][j+1][i+1] + p[k][j+1][i+3] + p[k][j][i+2] + p[k][j+2][i+2] + p[k-1][j+1][i+2] + p[k+1][j+1][i+2])/6 + (div[k-1][j][i+2] + p[k-1][j][i+1] + p[k-1][j][i+3] + p[k-1][j-1][i+2] + p[k-1][j+1][i+2] + p[k-2][j][i+2] + p[k][j][i+2])/6 + (div[k+1][j][i+2] + p[k+1][j][i+1] + p[k+1][j][i+3] + p[k+1][j-1][i+2] + p[k+1][j+1][i+2] + p[k][j][i+2] + p[k+2][j][i+2])/6)/6 + (div[k][j-1][i+1] + (div[k][j-1][i] + p[k][j-1][i-1] + p[k][j-1][i+1] + p[k][j-2][i] + p[k][j][i] + p[k-1][j-1][i] + p[k+1][j-1][i])/6 + (div[k][j-1][i+2] + p[k][j-1][i+1] + p[k][j-1][i+3] + p[k][j-2][i+2] + p[k][j][i+2] + p[k-1][j-1][i+2] + p[k+1][j-1][i+2])/6 + (div[k][j-2][i+1] + p[k][j-2][i] + p[k][j-2][i+2] + p[k][j-3][i+1] + p[k][j-1][i+1] + p[k-1][j-2][i+1] + p[k+1][j-2][i+1])/6 + (div[k][j][i+1] + p[k][j][i] + p[k][j][i+2] + p[k][j-1][i+1] + p[k][j+1][i+1] + p[k-1][j][i+1] + p[k+1][j][i+1])/6 + (div[k-1][j-1][i+1] + p[k-1][j-1][i] + p[k-1][j-1][i+2] + p[k-1][j-2][i+1] + p[k-1][j][i+1] + p[k-2][j-1][i+1] + p[k][j-1][i+1])/6 + (div[k+1][j-1][i+1] + p[k+1][j-1][i] + p[k+1][j-1][i+2] + p[k+1][j-2][i+1] + p[k+1][j][i+1] + p[k][j-1][i+1] + p[k+2][j-1][i+1])/6)/6 + (div[k][j+1][i+1] + (div[k][j+1][i] + p[k][j+1][i-1] + p[k][j+1][i+1] + p[k][j][i] + p[k][j+2][i] + p[k-1][j+1][i] + p[k+1][j+1][i])/6 + (div[k][j+1][i+2] + p[k][j+1][i+1] + p[k][j+1][i+3] + p[k][j][i+2] + p[k][j+2][i+2] + p[k-1][j+1][i+2] + p[k+1][j+1][i+2])/6 + (div[k][j][i+1] + p[k][j][i] + p[k][j][i+2] + p[k][j-1][i+1] + p[k][j+1][i+1] + p[k-1][j][i+1] + p[k+1][j][i+1])/6 + (div[k][j+2][i+1] + p[k][j+2][i] + p[k][j+2][i+2] + p[k][j+1][i+1] + p[k][j+3][i+1] + p[k-1][j+2][i+1] + p[k+1][j+2][i+1])/6 + (div[k-1][j+1][i+1] + p[k-1][j+1][i] + p[k-1][j+1][i+2] + p[k-1][j][i+1] + p[k-1][j+2][i+1] + p[k-2][j+1][i+1] + p[k][j+1][i+1])/6 + (div[k+1][j+1][i+1] + p[k+1][j+1][i] + p[k+1][j+1][i+2] + p[k+1][j][i+1] + p[k+1][j+2][i+1] + p[k][j+1][i+1] + p[k+2][j+1][i+1])/6)/6 + (div[k-1][j][i+1] + (div[k-1][j][i] + p[k-1][j][i-1] + p[k-1][j][i+1] + p[k-1][j-1][i] + p[k-1][j+1][i] + p[k-2][j][i] + p[k][j][i])/6 + (div[k-1][j][i+2] + p[k-1][j][i+1] + p[k-1][j][i+3] + p[k-1][j-1][i+2] + p[k-1][j+1][i+2] + p[k-2][j][i+2] + p[k][j][i+2])/6 + (div[k-1][j-1][i+1] + p[k-1][j-1][i] + p[k-1][j-1][i+2] + p[k-1][j-2][i+1] + p[k-1][j][i+1] + p[k-2][j-1][i+1] + p[k][j-1][i+1])/6 + (div[k-1][j+1][i+1] + p[k-1][j+1][i] + p[k-1][j+1][i+2] + p[k-1][j][i+1] + p[k-1][j+2][i+1] + p[k-2][j+1][i+1] + p[k][j+1][i+1])/6 + (div[k-2][j][i+1] + p[k-2][j][i] + p[k-2][j][i+2] + p[k-2][j-1][i+1] + p[k-2][j+1][i+1] + p[k-3][j][i+1] + p[k-1][j][i+1])/6 + (div[k][j][i+1] + p[k][j][i] + p[k][j][i+2] + p[k][j-1][i+1] + p[k][j+1][i+1] + p[k-1][j][i+1] + p[k+1][j][i+1])/6)/6 + (div[k+1][j][i+1] + (div[k+1][j][i] + p[k+1][j][i-1] + p[k+1][j][i+1] + p[k+1][j-1][i] + p[k+1][j+1][i] + p[k][j][i] + p[k+2][j][i])/6 + (div[k+1][j][i+2] + p[k+1][j][i+1] + p[k+1][j][i+3] + p[k+1][j-1][i+2] + p[k+1][j+1][i+2] + p[k][j][i+2] + p[k+2][j][i+2])/6 + (div[k+1][j-1][i+1] + p[k+1][j-1][i] + p[k+1][j-1][i+2] + p[k+1][j-2][i+1] + p[k+1][j][i+1] + p[k][j-1][i+1] + p[k+2][j-1][i+1])/6 + (div[k+1][j+1][i+1] + p[k+1][j+1][i] + p[k+1][j+1][i+2] + p[k+1][j][i+1] + p[k+1][j+2][i+1] + p[k][j+1][i+1] + p[k+2][j+1][i+1])/6 + (div[k][j][i+1] + p[k][j][i] + p[k][j][i+2] + p[k][j-1][i+1] + p[k][j+1][i+1] + p[k-1][j][i+1] + p[k+1][j][i+1])/6 + (div[k+2][j][i+1] + p[k+2][j][i] + p[k+2][j][i+2] + p[k+2][j-1][i+1] + p[k+2][j+1][i+1] + p[k+1][j][i+1] + p[k+3][j][i+1])/6)/6)/6 + (div[k][j-1][i] + (div[k][j-1][i-1] + (div[k][j-1][i-2] + p[k][j-1][i-3] + p[k][j-1][i-1] + p[k][j-2][i-2] + p[k][j][i-2] + p[k-1][j-1][i-2] + p[k+1][j-1][i-2])/6 + (div[k][j-1][i] + p[k][j-1][i-1] + p[k][j-1][i+1] + p[k][j-2][i] + p[k][j][i] + p[k-1][j-1][i] + p[k+1][j-1][i])/6 + (div[k][j-2][i-1] + p[k][j-2][i-2] + p[k][j-2][i] + p[k][j-3][i-1] + p[k][j-1][i-1] + p[k-1][j-2][i-1] + p[k+1][j-2][i-1])/6 + (div[k][j][i-1] + p[k][j][i-2] + p[k][j][i] + p[k][j-1][i-1] + p[k][j+1][i-1] + p[k-1][j][i-1] + p[k+1][j][i-1])/6 + (div[k-1][j-1][i-1] + p[k-1][j-1][i-2] + p[k-1][j-1][i] + p[k-1][j-2][i-1] + p[k-1][j][i-1] + p[k-2][j-1][i-1] + p[k][j-1][i-1])/6 + (div[k+1][j-1][i-1] + p[k+1][j-1][i-2] + p[k+1][j-1][i] + p[k+1][j-2][i-1] + p[k+1][j][i-1] + p[k][j-1][i-1] + p[k+2][j-1][i-1])/6)/6 + (div[k][j-1][i+1] + (div[k][j-1][i] + p[k][j-1][i-1] + p[k][j-1][i+1] + p[k][j-2][i] + p[k][j][i] + p[k-1][j-1][i] + p[k+1][j-1][i])/6 + (div[k][j-1][i+2] + p[k][j-1][i+1] + p[k][j-1][i+3] + p[k][j-2][i+2] + p[k][j][i+2] + p[k-1][j-1][i+2] + p[k+1][j-1][i+2])/6 + (div[k][j-2][i+1] + p[k][j-2][i] + p[k][j-2][i+2] + p[k][j-3][i+1] + p[k][j-1][i+1] + p[k-1][j-2][i+1] + p[k+1][j-2][i+1])/6 + (div[k][j][i+1] + p[k][j][i] + p[k][j][i+2] + p[k][j-1][i+1] + p[k][j+1][i+1] + p[k-1][j][i+1] + p[k+1][j][i+1])/6 + (div[k-1][j-1][i+1] + p[k-1][j-1][i] + p[k-1][j-1][i+2] + p[k-1][j-2][i+1] + p[k-1][j][i+1] + p[k-2][j-1][i+1] + p[k][j-1][i+1])/6 + (div[k+1][j-1][i+1] + p[k+1][j-1][i] + p[k+1][j-1][i+2] + p[k+1][j-2][i+1] + p[k+1][j][i+1] + p[k][j-1][i+1] + p[k+2][j-1][i+1])/6)/6 + (div[k][j-2][i] + (div[k][j-2][i-1] + p[k][j-2][i-2] + p[k][j-2][i] + p[k][j-3][i-1] + p[k][j-1][i-1] + p[k-1][j-2][i-1] + p[k+1][j-2][i-1])/6 + (div[k][j-2][i+1] + p[k][j-2][i] + p[k][j-2][i+2] + p[k][j-3][i+1] + p[k][j-1][i+1] + p[k-1][j-2][i+1] + p[k+1][j-2][i+1])/6 + (div[k][j-3][i] + p[k][j-3][i-1] + p[k][j-3][i+1] + p[k][j-4][i] + p[k][j-2][i] + p[k-1][j-3][i] + p[k+1][j-3][i])/6 + (div[k][j-1][i] + p[k][j-1][i-1] + p[k][j-1][i+1] + p[k][j-2][i] + p[k][j][i] + p[k-1][j-1][i] + p[k+1][j-1][i])/6 + (div[k-1][j-2][i] + p[k-1][j-2][i-1] + p[k-1][j-2][i+1] + p[k-1][j-3][i] + p[k-1][j-1][i] + p[k-2][j-2][i] + p[k][j-2][i])/6 + (div[k+1][j-2][i] + p[k+1][j-2][i-1] + p[k+1][j-2][i+1] + p[k+1][j-3][i] + p[k+1][j-1][i] + p[k][j-2][i] + p[k+2][j-2][i])/6)/6 + (div[k][j][i] + (div[k][j][i-1] + p[k][j][i-2] + p[k][j][i] + p[k][j-1][i-1] + p[k][j+1][i-1] + p[k-1][j][i-1] + p[k+1][j][i-1])/6 + (div[k][j][i+1] + p[k][j][i] + p[k][j][i+2] + p[k][j-1][i+1] + p[k][j+1][i+1] + p[k-1][j][i+1] + p[k+1][j][i+1])/6 + (div[k][j-1][i] + p[k][j-1][i-1] + p[k][j-1][i+1] + p[k][j-2][i] + p[k][j][i] + p[k-1][j-1][i] + p[k+1][j-1][i])/6 + (div[k][j+1][i] + p[k][j+1][i-1] + p[k][j+1][i+1] + p[k][j][i] + p[k][j+2][i] + p[k-1][j+1][i] + p[k+1][j+1][i])/6 + (div[k-1][j][i] + p[k-1][j][i-1] + p[k-1][j][i+1] + p[k-1][j-1][i] + p[k-1][j+1][i] + p[k-2][j][i] + p[k][j][i])/6 + (div[k+1][j][i] + p[k+1][j][i-1] + p[k+1][j][i+1] + p[k+1][j-1][i] + p[k+1][j+1][i] + p[k][j][i] + p[k+2][j][i])/6)/6 + (div[k-1][j-1][i] + (div[k-1][j-1][i-1] + p[k-1][j-1][i-2] + p[k-1][j-1][i] + p[k-1][j-2][i-1] + p[k-1][j][i-1] + p[k-2][j-1][i-1] + p[k][j-1][i-1])/6 + (div[k-1][j-1][i+1] + p[k-1][j-1][i] + p[k-1][j-1][i+2] + p[k-1][j-2][i+1] + p[k-1][j][i+1] + p[k-2][j-1][i+1] + p[k][j-1][i+1])/6 + (div[k-1][j-2][i] + p[k-1][j-2][i-1] + p[k-1][j-2][i+1] + p[k-1][j-3][i] + p[k-1][j-1][i] + p[k-2][j-2][i] + p[k][j-2][i])/6 + (div[k-1][j][i] + p[k-1][j][i-1] + p[k-1][j][i+1] + p[k-1][j-1][i] + p[k-1][j+1][i] + p[k-2][j][i] + p[k][j][i])/6 + (div[k-2][j-1][i] + p[k-2][j-1][i-1] + p[k-2][j-1][i+1] + p[k-2][j-2][i] + p[k-2][j][i] + p[k-3][j-1][i] + p[k-1][j-1][i])/6 + (div[k][j-1][i] + p[k][j-1][i-1] + p[k][j-1][i+1] + p[k][j-2][i] + p[k][j][i] + p[k-1][j-1][i] + p[k+1][j-1][i])/6)/6 + (div[k+1][j-1][i] + (div[k+1][j-1][i-1] + p[k+1][j-1][i-2] + p[k+1][j-1][i] + p[k+1][j-2][i-1] + p[k+1][j][i-1] + p[k][j-1][i-1] + p[k+2][j-1][i-1])/6 + (div[k+1][j-1][i+1] + p[k+1][j-1][i] + p[k+1][j-1][i+2] + p[k+1][j-2][i+1] + p[k+1][j][i+1] + p[k][j-1][i+1] + p[k+2][j-1][i+1])/6 + (div[k+1][j-2][i] + p[k+1][j-2][i-1] + p[k+1][j-2][i+1] + p[k+1][j-3][i] + p[k+1][j-1][i] + p[k][j-2][i] + p[k+2][j-2][i])/6 + (div[k+1][j][i] + p[k+1][j][i-1] + p[k+1][j][i+1] + p[k+1][j-1][i] + p[k+1][j+1][i] + p[k][j][i] + p[k+2][j][i])/6 + (div[k][j-1][i] + p[k][j-1][i-1] + p[k][j-1][i+1] + p[k][j-2][i] + p[k][j][i] + p[k-1][j-1][i] + p[k+1][j-1][i])/6 + (div[k+2][j-1][i] + p[k+2][j-1][i-1] + p[k+2][j-1][i+1] + p[k+2][j-2][i] + p[k+2][j][i] + p[k+1][j-1][i] + p[k+3][j-1][i])/6)/6)/6 + (div[k][j+1][i] + (div[k][j+1][i-1] + (div[k][j+1][i-2] + p[k][j+1][i-3] + p[k][j+1][i-1] + p[k][j][i-2] + p[k][j+2][i-2] + p[k-1][j+1][i-2] + p[k+1][j+1][i-2])/6 + (div[k][j+1][i] + p[k][j+1][i-1] + p[k][j+1][i+1] + p[k][j][i] + p[k][j+2][i] + p[k-1][j+1][i] + p[k+1][j+1][i])/6 + (div[k][j][i-1] + p[k][j][i-2] + p[k][j][i] + p[k][j-1][i-1] + p[k][j+1][i-1] + p[k-1][j][i-1] + p[k+1][j][i-1])/6 + (div[k][j+2][i-1] + p[k][j+2][i-2] + p[k][j+2][i] + p[k][j+1][i-1] + p[k][j+3][i-1] + p[k-1][j+2][i-1] + p[k+1][j+2][i-1])/6 + (div[k-1][j+1][i-1] + p[k-1][j+1][i-2] + p[k-1][j+1][i] + p[k-1][j][i-1] + p[k-1][j+2][i-1] + p[k-2][j+1][i-1] + p[k][j+1][i-1])/6 + (div[k+1][j+1][i-1] + p[k+1][j+1][i-2] + p[k+1][j+1][i] + p[k+1][j][i-1] + p[k+1][j+2][i-1] + p[k][j+1][i-1] + p[k+2][j+1][i-1])/6)/6 + (div[k][j+1][i+1] + (div[k][j+1][i] + p[k][j+1][i-1] + p[k][j+1][i+1] + p[k][j][i] + p[k][j+2][i] + p[k-1][j+1][i] + p[k+1][j+1][i])/6 + (div[k][j+1][i+2] + p[k][j+1][i+1] + p[k][j+1][i+3] + p[k][j][i+2] + p[k][j+2][i+2] + p[k-1][j+1][i+2] + p[k+1][j+1][i+2])/6 + (div[k][j][i+1] + p[k][j][i] + p[k][j][i+2] + p[k][j-1][i+1] + p[k][j+1][i+1] + p[k-1][j][i+1] + p[k+1][j][i+1])/6 + (div[k][j+2][i+1] + p[k][j+2][i] + p[k][j+2][i+2] + p[k][j+1][i+1] + p[k][j+3][i+1] + p[k-1][j+2][i+1] + p[k+1][j+2][i+1])/6 + (div[k-1][j+1][i+1] + p[k-1][j+1][i] + p[k-1][j+1][i+2] + p[k-1][j][i+1] + p[k-1][j+2][i+1] + p[k-2][j+1][i+1] + p[k][j+1][i+1])/6 + (div[k+1][j+1][i+1] + p[k+1][j+1][i] + p[k+1][j+1][i+2] + p[k+1][j][i+1] + p[k+1][j+2][i+1] + p[k][j+1][i+1] + p[k+2][j+1][i+1])/6)/6 + (div[k][j][i] + (div[k][j][i-1] + p[k][j][i-2] + p[k][j][i] + p[k][j-1][i-1] + p[k][j+1][i-1] + p[k-1][j][i-1] + p[k+1][j][i-1])/6 + (div[k][j][i+1] + p[k][j][i] + p[k][j][i+2] + p[k][j-1][i+1] + p[k][j+1][i+1] + p[k-1][j][i+1] + p[k+1][j][i+1])/6 + (div[k][j-1][i] + p[k][j-1][i-1] + p[k][j-1][i+1] + p[k][j-2][i] + p[k][j][i] + p[k-1][j-1][i] + p[k+1][j-1][i])/6 + (div[k][j+1][i] + p[k][j+1][i-1] + p[k][j+1][i+1] + p[k][j][i] + p[k][j+2][i] + p[k-1][j+1][i] + p[k+1][j+1][i])/6 + (div[k-1][j][i] + p[k-1][j][i-1] + p[k-1][j][i+1] + p[k-1][j-1][i] + p[k-1][j+1][i] + p[k-2][j][i] + p[k][j][i])/6 + (div[k+1][j][i] + p[k+1][j][i-1] + p[k+1][j][i+1] + p[k+1][j-1][i] + p[k+1][j+1][i] + p[k][j][i] + p[k+2][j][i])/6)/6 + (div[k][j+2][i] + (div[k][j+2][i-1] + p[k][j+2][i-2] + p[k][j+2][i] + p[k][j+1][i-1] + p[k][j+3][i-1] + p[k-1][j+2][i-1] + p[k+1][j+2][i-1])/6 + (div[k][j+2][i+1] + p[k][j+2][i] + p[k][j+2][i+2] + p[k][j+1][i+1] + p[k][j+3][i+1] + p[k-1][j+2][i+1] + p[k+1][j+2][i+1])/6 + (div[k][j+1][i] + p[k][j+1][i-1] + p[k][j+1][i+1] + p[k][j][i] + p[k][j+2][i] + p[k-1][j+1][i] + p[k+1][j+1][i])/6 + (div[k][j+3][i] + p[k][j+3][i-1] + p[k][j+3][i+1] + p[k][j+2][i] + p[k][j+4][i] + p[k-1][j+3][i] + p[k+1][j+3][i])/6 + (div[k-1][j+2][i] + p[k-1][j+2][i-1] + p[k-1][j+2][i+1] + p[k-1][j+1][i] + p[k-1][j+3][i] + p[k-2][j+2][i] + p[k][j+2][i])/6 + (div[k+1][j+2][i] + p[k+1][j+2][i-1] + p[k+1][j+2][i+1] + p[k+1][j+1][i] + p[k+1][j+3][i] + p[k][j+2][i] + p[k+2][j+2][i])/6)/6 + (div[k-1][j+1][i] + (div[k-1][j+1][i-1] + p[k-1][j+1][i-2] + p[k-1][j+1][i] + p[k-1][j][i-1] + p[k-1][j+2][i-1] + p[k-2][j+1][i-1] + p[k][j+1][i-1])/6 + (div[k-1][j+1][i+1] + p[k-1][j+1][i] + p[k-1][j+1][i+2] + p[k-1][j][i+1] + p[k-1][j+2][i+1] + p[k-2][j+1][i+1] + p[k][j+1][i+1])/6 + (div[k-1][j][i] + p[k-1][j][i-1] + p[k-1][j][i+1] + p[k-1][j-1][i] + p[k-1][j+1][i] + p[k-2][j][i] + p[k][j][i])/6 + (div[k-1][j+2][i] + p[k-1][j+2][i-1] + p[k-1][j+2][i+1] + p[k-1][j+1][i] + p[k-1][j+3][i] + p[k-2][j+2][i] + p[k][j+2][i])/6 + (div[k-2][j+1][i] + p[k-2][j+1][i-1] + p[k-2][j+1][i+1] + p[k-2][j][i] + p[k-2][j+2][i] + p[k-3][j+1][i] + p[k-1][j+1][i])/6 + (div[k][j+1][i] + p[k][j+1][i-1] + p[k][j+1][i+1] + p[k][j][i] + p[k][j+2][i] + p[k-1][j+1][i] + p[k+1][j+1][i])/6)/6 + (div[k+1][j+1][i] + (div[k+1][j+1][i-1] + p[k+1][j+1][i-2] + p[k+1][j+1][i] + p[k+1][j][i-1] + p[k+1][j+2][i-1] + p[k][j+1][i-1] + p[k+2][j+1][i-1])/6 + (div[k+1][j+1][i+1] + p[k+1][j+1][i] + p[k+1][j+1][i+2] + p[k+1][j][i+1] + p[k+1][j+2][i+1] + p[k][j+1][i+1] + p[k+2][j+1][i+1])/6 + (div[k+1][j][i] + p[k+1][j][i-1] + p[k+1][j][i+1] + p[k+1][j-1][i] + p[k+1][j+1][i] + p[k][j][i] + p[k+2][j][i])/6 + (div[k+1][j+2][i] + p[k+1][j+2][i-1] + p[k+1][j+2][i+1] + p[k+1][j+1][i] + p[k+1][j+3][i] + p[k][j+2][i] + p[k+2][j+2][i])/6 + (div[k][j+1][i] + p[k][j+1][i-1] + p[k][j+1][i+1] + p[k][j][i] + p[k][j+2][i] + p[k-1][j+1][i] + p[k+1][j+1][i])/6 + (div[k+2][j+1][i] + p[k+2][j+1][i-1] + p[k+2][j+1][i+1] + p[k+2][j][i] + p[k+2][j+2][i] + p[k+1][j+1][i] + p[k+3][j+1][i])/6)/6)/6 + (div[k-1][j][i] + (div[k-1][j][i-1] + (div[k-1][j][i-2] + p[k-1][j][i-3] + p[k-1][j][i-1] + p[k-1][j-1][i-2] + p[k-1][j+1][i-2] + p[k-2][j][i-2] + p[k][j][i-2])/6 + (div[k-1][j][i] + p[k-1][j][i-1] + p[k-1][j][i+1] + p[k-1][j-1][i] + p[k-1][j+1][i] + p[k-2][j][i] + p[k][j][i])/6 + (div[k-1][j-1][i-1] + p[k-1][j-1][i-2] + p[k-1][j-1][i] + p[k-1][j-2][i-1] + p[k-1][j][i-1] + p[k-2][j-1][i-1] + p[k][j-1][i-1])/6 + (div[k-1][j+1][i-1] + p[k-1][j+1][i-2] + p[k-1][j+1][i] + p[k-1][j][i-1] + p[k-1][j+2][i-1] + p[k-2][j+1][i-1] + p[k][j+1][i-1])/6 + (div[k-2][j][i-1] + p[k-2][j][i-2] + p[k-2][j][i] + p[k-2][j-1][i-1] + p[k-2][j+1][i-1] + p[k-3][j][i-1] + p[k-1][j][i-1])/6 + (div[k][j][i-1] + p[k][j][i-2] + p[k][j][i] + p[k][j-1][i-1] + p[k][j+1][i-1] + p[k-1][j][i-1] + p[k+1][j][i-1])/6)/6 + (div[k-1][j][i+1] + (div[k-1][j][i] + p[k-1][j][i-1] + p[k-1][j][i+1] + p[k-1][j-1][i] + p[k-1][j+1][i] + p[k-2][j][i] + p[k][j][i])/6 + (div[k-1][j][i+2] + p[k-1][j][i+1] + p[k-1][j][i+3] + p[k-1][j-1][i+2] + p[k-1][j+1][i+2] + p[k-2][j][i+2] + p[k][j][i+2])/6 + (div[k-1][j-1][i+1] + p[k-1][j-1][i] + p[k-1][j-1][i+2] + p[k-1][j-2][i+1] + p[k-1][j][i+1] + p[k-2][j-1][i+1] + p[k][j-1][i+1])/6 + (div[k-1][j+1][i+1] + p[k-1][j+1][i] + p[k-1][j+1][i+2] + p[k-1][j][i+1] + p[k-1][j+2][i+1] + p[k-2][j+1][i+1] + p[k][j+1][i+1])/6 + (div[k-2][j][i+1] + p[k-2][j][i] + p[k-2][j][i+2] + p[k-2][j-1][i+1] + p[k-2][j+1][i+1] + p[k-3][j][i+1] + p[k-1][j][i+1])/6 + (div[k][j][i+1] + p[k][j][i] + p[k][j][i+2] + p[k][j-1][i+1] + p[k][j+1][i+1] + p[k-1][j][i+1] + p[k+1][j][i+1])/6)/6 + (div[k-1][j-1][i] + (div[k-1][j-1][i-1] + p[k-1][j-1][i-2] + p[k-1][j-1][i] + p[k-1][j-2][i-1] + p[k-1][j][i-1] + p[k-2][j-1][i-1] + p[k][j-1][i-1])/6 + (div[k-1][j-1][i+1] + p[k-1][j-1][i] + p[k-1][j-1][i+2] + p[k-1][j-2][i+1] + p[k-1][j][i+1] + p[k-2][j-1][i+1] + p[k][j-1][i+1])/6 + (div[k-1][j-2][i] + p[k-1][j-2][i-1] + p[k-1][j-2][i+1] + p[k-1][j-3][i] + p[k-1][j-1][i] + p[k-2][j-2][i] + p[k][j-2][i])/6 + (div[k-1][j][i] + p[k-1][j][i-1] + p[k-1][j][i+1] + p[k-1][j-1][i] + p[k-1][j+1][i] + p[k-2][j][i] + p[k][j][i])/6 + (div[k-2][j-1][i] + p[k-2][j-1][i-1] + p[k-2][j-1][i+1] + p[k-2][j-2][i] + p[k-2][j][i] + p[k-3][j-1][i] + p[k-1][j-1][i])/6 + (div[k][j-1][i] + p[k][j-1][i-1] + p[k][j-1][i+1] + p[k][j-2][i] + p[k][j][i] + p[k-1][j-1][i] + p[k+1][j-1][i])/6)/6 + (div[k-1][j+1][i] + (div[k-1][j+1][i-1] + p[k-1][j+1][i-2] + p[k-1][j+1][i] + p[k-1][j][i-1] + p[k-1][j+2][i-1] + p[k-2][j+1][i-1] + p[k][j+1][i-1])/6 + (div[k-1][j+1][i+1] + p[k-1][j+1][i] + p[k-1][j+1][i+2] + p[k-1][j][i+1] + p[k-1][j+2][i+1] + p[k-2][j+1][i+1] + p[k][j+1][i+1])/6 + (div[k-1][j][i] + p[k-1][j][i-1] + p[k-1][j][i+1] + p[k-1][j-1][i] + p[k-1][j+1][i] + p[k-2][j][i] + p[k][j][i])/6 + (div[k-1][j+2][i] + p[k-1][j+2][i-1] + p[k-1][j+2][i+1] + p[k-1][j+1][i] + p[k-1][j+3][i] + p[k-2][j+2][i] + p[k][j+2][i])/6 + (div[k-2][j+1][i] + p[k-2][j+1][i-1] + p[k-2][j+1][i+1] + p[k-2][j][i] + p[k-2][j+2][i] + p[k-3][j+1][i] + p[k-1][j+1][i])/6 + (div[k][j+1][i] + p[k][j+1][i-1] + p[k][j+1][i+1] + p[k][j][i] + p[k][j+2][i] + p[k-1][j+1][i] + p[k+1][j+1][i])/6)/6 + (div[k-2][j][i] + (div[k-2][j][i-1] + p[k-2][j][i-2] + p[k-2][j][i] + p[k-2][j-1][i-1] + p[k-2][j+1][i-1] + p[k-3][j][i-1] + p[k-1][j][i-1])/6 + (div[k-2][j][i+1] + p[k-2][j][i] + p[k-2][j][i+2] + p[k-2][j-1][i+1] + p[k-2][j+1][i+1] + p[k-3][j][i+1] + p[k-1][j][i+1])/6 + (div[k-2][j-1][i] + p[k-2][j-1][i-1] + p[k-2][j-1][i+1] + p[k-2][j-2][i] + p[k-2][j][i] + p[k-3][j-1][i] + p[k-1][j-1][i])/6 + (div[k-2][j+1][i] + p[k-2][j+1][i-1] + p[k-2][j+1][i+1] + p[k-2][j][i] + p[k-2][j+2][i] + p[k-3][j+1][i] + p[k-1][j+1][i])/6 + (div[k-3][j][i] + p[k-3][j][i-1] + p[k-3][j][i+1] + p[k-3][j-1][i] + p[k-3][j+1][i] + p[k-4][j][i] + p[k-2][j][i])/6 + (div[k-1][j][i] + p[k-1][j][i-1] + p[k-1][j][i+1] + p[k-1][j-1][i] + p[k-1][j+1][i] + p[k-2][j][i] + p[k][j][i])/6)/6 + (div[k][j][i] + (div[k][j][i-1] + p[k][j][i-2] + p[k][j][i] + p[k][j-1][i-1] + p[k][j+1][i-1] + p[k-1][j][i-1] + p[k+1][j][i-1])/6 + (div[k][j][i+1] + p[k][j][i] + p[k][j][i+2] + p[k][j-1][i+1] + p[k][j+1][i+1] + p[k-1][j][i+1] + p[k+1][j][i+1])/6 + (div[k][j-1][i] + p[k][j-1][i-1] + p[k][j-1][i+1] + p[k][j-2][i] + p[k][j][i] + p[k-1][j-1][i] + p[k+1][j-1][i])/6 + (div[k][j+1][i] + p[k][j+1][i-1] + p[k][j+1][i+1] + p[k][j][i] + p[k][j+2][i] + p[k-1][j+1][i] + p[k+1][j+1][i])/6 + (div[k-1][j][i] + p[k-1][j][i-1] + p[k-1][j][i+1] + p[k-1][j-1][i] + p[k-1][j+1][i] + p[k-2][j][i] + p[k][j][i])/6 + (div[k+1][j][i] + p[k+1][j][i-1] + p[k+1][j][i+1] + p[k+1][j-1][i] + p[k+1][j+1][i] + p[k][j][i] + p[k+2][j][i])/6)/6)/6 + (div[k+1][j][i] + (div[k+1][j][i-1] + (div[k+1][j][i-2] + p[k+1][j][i-3] + p[k+1][j][i-1] + p[k+1][j-1][i-2] + p[k+1][j+1][i-2] + p[k][j][i-2] + p[k+2][j][i-2])/6 + (div[k+1][j][i] + p[k+1][j][i-1] + p[k+1][j][i+1] + p[k+1][j-1][i] + p[k+1][j+1][i] + p[k][j][i] + p[k+2][j][i])/6 + (div[k+1][j-1][i-1] + p[k+1][j-1][i-2] + p[k+1][j-1][i] + p[k+1][j-2][i-1] + p[k+1][j][i-1] + p[k][j-1][i-1] + p[k+2][j-1][i-1])/6 + (div[k+1][j+1][i-1] + p[k+1][j+1][i-2] + p[k+1][j+1][i] + p[k+1][j][i-1] + p[k+1][j+2][i-1] + p[k][j+1][i-1] + p[k+2][j+1][i-1])/6 + (div[k][j][i-1] + p[k][j][i-2] + p[k][j][i] + p[k][j-1][i-1] + p[k][j+1][i-1] + p[k-1][j][i-1] + p[k+1][j][i-1])/6 + (div[k+2][j][i-1] + p[k+2][j][i-2] + p[k+2][j][i] + p[k+2][j-1][i-1] + p[k+2][j+1][i-1] + p[k+1][j][i-1] + p[k+3][j][i-1])/6)/6 + (div[k+1][j][i+1] + (div[k+1][j][i] + p[k+1][j][i-1] + p[k+1][j][i+1] + p[k+1][j-1][i] + p[k+1][j+1][i] + p[k][j][i] + p[k+2][j][i])/6 + (div[k+1][j][i+2] + p[k+1][j][i+1] + p[k+1][j][i+3] + p[k+1][j-1][i+2] + p[k+1][j+1][i+2] + p[k][j][i+2] + p[k+2][j][i+2])/6 + (div[k+1][j-1][i+1] + p[k+1][j-1][i] + p[k+1][j-1][i+2] + p[k+1][j-2][i+1] + p[k+1][j][i+1] + p[k][j-1][i+1] + p[k+2][j-1][i+1])/6 + (div[k+1][j+1][i+1] + p[k+1][j+1][i] + p[k+1][j+1][i+2] + p[k+1][j][i+1] + p[k+1][j+2][i+1] + p[k][j+1][i+1] + p[k+2][j+1][i+1])/6 + (div[k][j][i+1] + p[k][j][i] + p[k][j][i+2] + p[k][j-1][i+1] + p[k][j+1][i+1] + p[k-1][j][i+1] + p[k+1][j][i+1])/6 + (div[k+2][j][i+1] + p[k+2][j][i] + p[k+2][j][i+2] + p[k+2][j-1][i+1] + p[k+2][j+1][i+1] + p[k+1][j][i+1] + p[k+3][j][i+1])/6)/6 + (div[k+1][j-1][i] + (div[k+1][j-1][i-1] + p[k+1][j-1][i-2] + p[k+1][j-1][i] + p[k+1][j-2][i-1] + p[k+1][j][i-1] + p[k][j-1][i-1] + p[k+2][j-1][i-1])/6 + (div[k+1][j-1][i+1] + p[k+1][j-1][i] + p[k+1][j-1][i+2] + p[k+1][j-2][i+1] + p[k+1][j][i+1] + p[k][j-1][i+1] + p[k+2][j-1][i+1])/6 + (div[k+1][j-2][i] + p[k+1][j-2][i-1] + p[k+1][j-2][i+1] + p[k+1][j-3][i] + p[k+1][j-1][i] + p[k][j-2][i] + p[k+2][j-2][i])/6 + (div[k+1][j][i] + p[k+1][j][i-1] + p[k+1][j][i+1] + p[k+1][j-1][i] + p[k+1][j+1][i] + p[k][j][i] + p[k+2][j][i])/6 + (div[k][j-1][i] + p[k][j-1][i-1] + p[k][j-1][i+1] + p[k][j-2][i] + p[k][j][i] + p[k-1][j-1][i] + p[k+1][j-1][i])/6 + (div[k+2][j-1][i] + p[k+2][j-1][i-1] + p[k+2][j-1][i+1] + p[k+2][j-2][i] + p[k+2][j][i] + p[k+1][j-1][i] + p[k+3][j-1][i])/6)/6 + (div[k+1][j+1][i] + (div[k+1][j+1][i-1] + p[k+1][j+1][i-2] + p[k+1][j+1][i] + p[k+1][j][i-1] + p[k+1][j+2][i-1] + p[k][j+1][i-1] + p[k+2][j+1][i-1])/6 + (div[k+1][j+1][i+1] + p[k+1][j+1][i] + p[k+1][j+1][i+2] + p[k+1][j][i+1] + p[k+1][j+2][i+1] + p[k][j+1][i+1] + p[k+2][j+1][i+1])/6 + (div[k+1][j][i] + p[k+1][j][i-1] + p[k+1][j][i+1] + p[k+1][j-1][i] + p[k+1][j+1][i] + p[k][j][i] + p[k+2][j][i])/6 + (div[k+1][j+2][i] + p[k+1][j+2][i-1] + p[k+1][j+2][i+1] + p[k+1][j+1][i] + p[k+1][j+3][i] + p[k][j+2][i] + p[k+2][j+2][i])/6 + (div[k][j+1][i] + p[k][j+1][i-1] + p[k][j+1][i+1] + p[k][j][i] + p[k][j+2][i] + p[k-1][j+1][i] + p[k+1][j+1][i])/6 + (div[k+2][j+1][i] + p[k+2][j+1][i-1] + p[k+2][j+1][i+1] + p[k+2][j][i] + p[k+2][j+2][i] + p[k+1][j+1][i] + p[k+3][j+1][i])/6)/6 + (div[k][j][i] + (div[k][j][i-1] + p[k][j][i-2] + p[k][j][i] + p[k][j-1][i-1] + p[k][j+1][i-1] + p[k-1][j][i-1] + p[k+1][j][i-1])/6 + (div[k][j][i+1] + p[k][j][i] + p[k][j][i+2] + p[k][j-1][i+1] + p[k][j+1][i+1] + p[k-1][j][i+1] + p[k+1][j][i+1])/6 + (div[k][j-1][i] + p[k][j-1][i-1] + p[k][j-1][i+1] + p[k][j-2][i] + p[k][j][i] + p[k-1][j-1][i] + p[k+1][j-1][i])/6 + (div[k][j+1][i] + p[k][j+1][i-1] + p[k][j+1][i+1] + p[k][j][i] + p[k][j+2][i] + p[k-1][j+1][i] + p[k+1][j+1][i])/6 + (div[k-1][j][i] + p[k-1][j][i-1] + p[k-1][j][i+1] + p[k-1][j-1][i] + p[k-1][j+1][i] + p[k-2][j][i] + p[k][j][i])/6 + (div[k+1][j][i] + p[k+1][j][i-1] + p[k+1][j][i+1] + p[k+1][j-1][i] + p[k+1][j+1][i] + p[k][j][i] + p[k+2][j][i])/6)/6 + (div[k+2][j][i] + (div[k+2][j][i-1] + p[k+2][j][i-2] + p[k+2][j][i] + p[k+2][j-1][i-1] + p[k+2][j+1][i-1] + p[k+1][j][i-1] + p[k+3][j][i-1])/6 + (div[k+2][j][i+1] + p[k+2][j][i] + p[k+2][j][i+2] + p[k+2][j-1][i+1] + p[k+2][j+1][i+1] + p[k+1][j][i+1] + p[k+3][j][i+1])/6 + (div[k+2][j-1][i] + p[k+2][j-1][i-1] + p[k+2][j-1][i+1] + p[k+2][j-2][i] + p[k+2][j][i] + p[k+1][j-1][i] + p[k+3][j-1][i])/6 + (div[k+2][j+1][i] + p[k+2][j+1][i-1] + p[k+2][j+1][i+1] + p[k+2][j][i] + p[k+2][j+2][i] + p[k+1][j+1][i] + p[k+3][j+1][i])/6 + (div[k+1][j][i] + p[k+1][j][i-1] + p[k+1][j][i+1] + p[k+1][j-1][i] + p[k+1][j+1][i] + p[k][j][i] + p[k+2][j][i])/6 + (div[k+3][j][i] + p[k+3][j][i-1] + p[k+3][j][i+1] + p[k+3][j-1][i] + p[k+3][j+1][i] + p[k+2][j][i] + p[k+4][j][i])/6)/6)/6)/6; | |
} | |
explicit_solutions[3][k-4][j-4][i-4] = x; | |
} | |
} | |
} | |
} | |
compare: { | |
for z in 0..3 { | |
for k in 0..M-1 { | |
for j in 0..M-1 { | |
for i in 0..M-1 { | |
assert(abs(iterative_solutions[z][k][j][i] - explicit_solutions[z][k][j][i]) < 1.0e-6); | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment