Example of pde solver.
MGL code:
new re 128 'exp(-48*(x+0.7)^2)':new im 128 pde a 'p^2+q^2-x-1+i*0.5*(z+x)*(z>-x)' re im 0.01 30 transpose a subplot 1 1 0 '<_':title 'PDE solver' axis:xlabel '\i x':ylabel '\i z' crange 0 1:dens a 'wyrRk' fplot '-x' 'k|' text 0 0.95 'Equation: ik_0\partial_zu + \Delta u + x\cdot u + i \frac{x+z}{2}\cdot u = 0\n{}absorption: (x+z)/2 for x+z>0'
C++ code:
void smgl_pde(mglGraph *gr) // PDE sample { mglData a,re(128),im(128); gr->Fill(re,"exp(-48*(x+0.7)^2)"); a = gr->PDE("p^2+q^2-x-1+i*0.5*(z+x)*(z>-x)", re, im, 0.01, 30); a.Transpose("yxz"); if(big!=3) {gr->SubPlot(1,1,0,"<_"); gr->Title("PDE solver"); } gr->SetRange('c',0,1); gr->Dens(a,"wyrRk"); gr->Axis(); gr->Label('x', "\\i x"); gr->Label('y', "\\i z"); gr->FPlot("-x", "k|"); gr->Puts(mglPoint(0, 0.95), "Equation: ik_0\\partial_zu + \\Delta u + x\\cdot u + i \\frac{x+z}{2}\\cdot u = 0\nabsorption: (x+z)/2 for x+z>0"); }