
| Current Path : /home/cgabriel/20_dev/10_dev2017/1310__algorithms/Julia/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : //home/cgabriel/20_dev/10_dev2017/1310__algorithms/Julia/laplace.jl |
function laplace_iter(u, dx2, dy2, Niter, N)
uout = copy(u)
for iter = 1:Niter
for i = 2:N-1
for j = 2:N-1
uout[i, j] = ((u[i-1,j]+u[i+1,j])*dy2 +
(u[i,j-1]+u[i,j+1])*dx2 ) * (1./(2*(dx2+dy2)))
end
end
u, uout = uout, u
end
return u
end
function laplace()
N = 150
u = zeros(N, N)
u[1,:] = 1
Niter = 2^10
dx2 = dy2 = 0.1 * 0.1
u = laplace_iter(u, dx2, dy2, Niter, N)
end