2
$\begingroup$

equation is

enter image description here

and the symbol solution is $u[x,y]=e^x \sin(\pi y)$ mathematica code

    sol = NDSolveValue[{-Inactive[Laplacian][
    u[x, y], {x, y}] == (Pi^2 - 1)*E^x*Sin[Pi*y] - 
    NeumannValue[-u[x, y], x == 0] + 
    NeumannValue[E^2*(1 + 2*y)*Sin[Pi*y] - 2*y*u[x, y], 
    x == 2] - NeumannValue[(-Pi)*E^x - 2*x*u[x, y], y == 0] +
    NeumannValue[(-Pi)*E^x - x^2*u[x, y], y == 1]}, 
    u, {x, 0, 2}, {y, 0, 1}];
    sol[x, y] /. {x -> 0.5, y -> 0.5}(*is negative, but the u[x,y]=E^x Sin[Pi y]=E^0.5*)
    ContourPlot[sol[x, y], {x, 0, 2}, {y, 0, 1}, ContourStyle -> None, 
    PlotLegends -> Automatic];

but the numerical solution at $(0.5,0.5)$ is $u(0.5,0.5)=-3.24478$, is not equal $e^{0.5}$, and I don't know how wrong it is.

$\endgroup$
0

2 Answers 2

2
$\begingroup$

Check the Neumann-conditions!

Try

U = NDSolveValue[{- 
     Laplacian[u[x, y], {x, y}] == (Pi^2 - 1)*E^x*Sin[Pi*y]
     + NeumannValue[-u[x, y], x == 0] + 
     NeumannValue[E^2*(1 + 2*y)*Sin[Pi*y] - 2*y*u[x, y], x == 2]
     + NeumannValue[(-Pi)*E^x - 2*x*u[x, y], y == 0] + 
     NeumannValue[(-Pi)*E^x - x^2*u[x, y], y == 1]}, 
  u, {x, 0, 2}, {y, 0, 1}]

which gives

{Exp[.5],U[0.5,0.5]} (*{1.64872, 1.64872}*) 
$\endgroup$
-1
$\begingroup$

The inhomogenuous equation $$ \Delta_{x,y}\left(-e^x \ \sin (\pi y) +g(x,y)\right) == \ e^x \ \sin (\pi y) $$ results in the homogenous equation. $$\Delta_{x,y} g(x,y)==0$$

Reformulate the other equations for $g$ as boundary values for the Laplace equation.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.