Solution of the Poisson equation
u_{xx} + u_{yy} = 1 with boundary condition u = 0on a domain which has the shape of Maryland (triangles show the mesh which was used for computation with the finite element method) |
heat_pwlin([-1 0 1],[0 1 0],0:.02:1);
U(x,t) = g(t^{-1/2}x)We found that
g(x) = ½·π^{-1/2}·∫_{0}^{x}exp(-p^{2}/4)dp + ½ = ½·erf(x/2) + ½The "error function" erf(x) is defined as π^{-1/2}·∫_{0}^{x}exp(-p^{2})dp, this function is available in Matlab and many other programming languages. In Matlab we can plot the solution U(x,t) for x∈[-5,5], t∈[0,2] as follows:
[X,T]=ndgrid(-5:.1:5,0:.1:2); U = erf(T.^-.5.*X/2)/2 + 1/2; colorcurves(X,T,U);
u_{t} - x·u_{x} = u, u(x,0) = exp(-x^{2}).Here c(x,t,u)=-x, f(x,t,u)=u, u_{0}(x)=exp(-x^{2}). We use for x_{0} the values -3,-2.9,...,2.9,3. We want to find the solution u(x,t) for 0≤t≤1 so we use t-values 0,.1,...,.9,1:
c = @(x,t,u) -x; f = @(x,t,u) u; u0 = @(x) exp(-x^2);This generates a graph of the characteristics, and a graph of the solution which you can rotate with the mouse.
[X,v] = quasilin(c,f,u0,-3:.1:3,0:.1:1);