Skip to main content
edited tags
Link
user21
  • 40.7k
  • 8
  • 114
  • 170
added 128 characters in body
Source Link

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.

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];

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.

Source Link

How to solve the partial differential equations?

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];