src/examples/compiler/hehf2
raw| 1 | Let |
| 2 | epsilon = 1e-6 |
| 3 | k = 8 |
| 4 | Omega = [-20, 20]^3 |
| 5 | r = x -> sqrt(x_0^2 + x_1^2 + x_2^2) |
| 6 | g = x -> exp(-2*r(x)) |
| 7 | v = x -> -2/r(x) |
| 8 | In |
| 9 | nu = F v |
| 10 | phi = F g |
| 11 | lambda = -1.0 |
| 12 | for i in [0,13] |
| 13 | phi = phi * ||phi||^-1 |
| 14 | V = nu - del^-2 4 * pi * phi^2 |
| 15 | psi = -2 * (-2*lambda - del^2)^-1 V * phi |
| 16 | lambda = lambda + <V*phi|psi - phi> / <psi|psi> |
| 17 | phi = psi |
| 18 | print "iter", i, "norm", ||phi||, "eval",lambda |
| 19 | end |
| 20 | End |
| 21 | |
| 22 | |
| 23 |