2
$\begingroup$

I am trying to get Mathematica to verify my analytic solution to the following problem: $$ \Delta u + u = 0 \quad\quad\text{on }\ D=[-3,3]\times[-3,3] $$ $$ u(x,y) = \sin(\frac{\pi x}{6}) \quad\quad\text{on }\ \partial D $$ However, it is telling me "General solution is not available for the given linear pde". Is there an error in the following code?

eqn = Laplacian[u[x, y], {x, y}] + u[x, y] == 0;
bc = {u[-3, y] == -1, u[3, y] == 1, u[x, -3] == Sin[(\[Pi]x)/6], 
   u[x, 3] == Sin[(\[Pi]x)/6]};
sol = DSolveValue[{eqn, bc}, u[x, y], {x, y}] // FullSimplify

If there aren't any obvious reasons, can someone explain why Mathematica can't handle this PDE? Further, are there any other Mathematica functions that can be used to find a symbolic solution?

Note, I don't want to find a numerical approximation. Thanks!

EDIT: I also tried breaking this problem up into $4$ separate problems that each solve the PDE, one non-homogeneous BC, and three homogeneous BC. However, since the BCs at the corners aren't zero this didn't exactly give the right solution.

$\endgroup$
11
  • $\begingroup$ Maple 2021 fails with it too. eqn = Laplacian[u[x, y], {x, y}] + u[x, y] == 0; bc = {u[-3, y] == -1, u[3, y] == 1, u[x, -3] == Sin[(Pi*x)/6], u[x, 3] == Sin[(Pi*x)/6]}; sol = NDSolve[{eqn, bc}, u[x, y], {x, -3, 3}, {y, -3, 3}];Plot3D[u[x, y] /. sol, {x, -3, 3}, {y, -3, 3}] works for me in 12.3.1 on Windows 10. $\endgroup$
    – user64494
    Commented Dec 9, 2021 at 6:00
  • 1
    $\begingroup$ First negclecting bc, Mathematica gives an analytical solution: U = DSolveValue[{eqn(*,bc*)}, u, {x, y}] // FullSimplify depending on five parameters .Perhaps it's possible to adapt your boundary conditions in the next step? $\endgroup$ Commented Dec 9, 2021 at 7:42
  • $\begingroup$ DSolveValue[eqn, u[x, y], {x, y}] produces "DSolve::lpde: General solution is not available for the given linear partial differential equation. Trying to build a special solution." and E^(-x Sqrt[C[ 5]]) (E^(2 x Sqrt[C[5]]) C[1] + C[2]) (C[4] Cos[y Sqrt[1 + C[5]]] + C[3] Sin[y Sqrt[1 + C[5]]]). $\endgroup$
    – user64494
    Commented Dec 9, 2021 at 8:46
  • $\begingroup$ BTW, FullSimplify does nothing in the above. $\endgroup$
    – user64494
    Commented Dec 9, 2021 at 8:52
  • 1
    $\begingroup$ @joseph If you try to verify your(!) analytical solution, you might substitude your solution into the eqn and bc!?! $\endgroup$ Commented Dec 9, 2021 at 14:31

1 Answer 1

4
$\begingroup$

I am unsure whether the question is still relevant, but found an analytical solution, derived with the help of Greenfunction:

First it's necessary to transform the pde {Laplacian[u[x, y], {x, y}] + u[x, y] == 0 to homogenuous boundaryconditions

pde=Laplacian[u[x, y], {x, y}] + u[x, y] /.u -> Function[{x, y}, Sin[Pi x/6] +v[x, y]] // Collect[#, Sin[__], Simplify] &

$$v^{(0,2)}(x,y)+v^{(2,0)}(x,y)+v(x,y)+\left(1-\frac{\pi ^2}{36}\right) \sin \left(\frac{\pi x}{6}\right)=0 $$

Homogenuous boundarycondition v[x,y]==0 on the boundary of rect

In the next step we try to solve pde using GreenFunction. That means we are looking for a solution of $$v^{(0,2)}(x,y)+v^{(2,0)}(x,y)+v(x,y)=\delta (x-\xi ) \delta (y-\eta )$$

The documentation shows a similar example. Unfortunately Mathematica at present is only able to solve the problem in a rectangular region with one corner {0,0} (see GreenFunction for Helmholtz equation in arbitrary Rectangle region doesn't evaluate)

That's why we have to modify Greenfunction for our purpose:

green = Block[{gre, rechteck = rect},
gre = GreenFunction[{Laplacian[v [x , y ], {x , y }] + v [x, y],DirichletCondition[v [x, y] == 0, True]}, v , 
Element[{x, y},TranslationTransform[{ 3, 3}][rechteck]], {\[Xi], \[Eta]}]  ;
Function[{x, y, \[Xi], \[Eta]},gre[x - 3, y - 3, \[Xi] - 3, \[Eta] - 3] //
Evaluate] ] 

greenfunction gre[x, y, \[Xi], \[Eta]]::

$$-\frac{1}{9} \underset{K[1]=1}{\overset{\infty }{\sum }}\underset{K[2]=1}{\overset{\infty }{\sum }}\frac{\sin \left(\frac{1}{6} \pi (x-3) K[1]\right) \sin \left(\frac{1}{6} \pi (\xi -3) K[1]\right) \sin \left(\frac{1}{6} \pi (y-3) K[2]\right) \sin \left(\frac{1}{6} \pi (\eta -3) K[2]\right)}{\frac{1}{36} \pi ^2 K[1]^2+\frac{1}{36} \pi ^2 K[2]^2-1}$$

Function[{x,y, \[Xi], \[Eta]},-(1/9) Inactive[Sum][(Sin[1/6 \[Pi] (-3 + x)K[1]] Sin[1/6 \[Pi] (-3 + \[Xi])K[1]] Sin[1/6 \[Pi] (-3 + y) K[2]] Sin[1/6 \[Pi] (-3 + \[Eta]) K[2]])/(-1 + 1/36\[Pi]^2 K[1]^2 + 1/36 \[Pi]^2 K[2]^2), {K[1], 1, \[Infinity]}, {K[2], 1, \[Infinity]}]]

The analytical solution u[x,y] follows to

nn=5 ;  
Integrate [green[x,y, \[Xi], \[Eta]] (-(1 - 1/36 \[Pi]^2) Sin[(\[Pi] \[Xi])/6]) /.Infinity -> nn// Activate, Element[{\[Xi], \[Eta]}, rect]] 
Plot3D[%% + Sin[Pi x/6], Element[{x, y}, rect]]

enter image description here

$$\frac{128}{25} \left(1-\frac{\pi ^2}{36}\right) \left(\frac{15 \left(\frac{5 \sin \left(\frac{\pi x}{3}\right)}{5 \pi ^2-36}-\frac{2 \sin \left(\frac{2 \pi x}{3}\right)}{17 \pi ^2-36}\right) \cos \left(\frac{\pi y}{6}\right)}{\pi ^2}+\left(\frac{25 \sin \left(\frac{\pi x}{3}\right)}{36 \pi ^2-13 \pi ^4}+\frac{10 \sin \left(\frac{2 \pi x}{3}\right)}{\pi ^2 \left(25 \pi ^2-36\right)}\right) \cos \left(\frac{\pi y}{2}\right)+\frac{3 \left(\frac{5 \sin \left(\frac{\pi x}{3}\right)}{29 \pi ^2-36}-\frac{2 \sin \left(\frac{2 \pi x}{3}\right)}{41 \pi ^2-36}\right) \cos \left(\frac{5 \pi y}{6}\right)}{\pi ^2}\right)$$

The analytical solution agrees very well with the numerical solution

numU = NDSolveValue[{Laplacian[u[x, y], {x, y}] + u[x, y] == 0,DirichletCondition[u[x, y] == Sin[(Pi x)/6], True]}, u,Element[{x, y}, rect]]`
Plot3D[numU[x, y], Element[{x, y}, rect]]

enter image description here

$\endgroup$
12
  • $\begingroup$ if the system is underdetermined, we need more BCs, or? $\endgroup$
    – ABCDEMMM
    Commented Dec 12, 2021 at 13:24
  • 1
    $\begingroup$ @ABCDEMMM The system is welldefined with boundary conditions defined on the edge of the rectangle! Why do you expect underdetermined system? $\endgroup$ Commented Dec 12, 2021 at 13:27
  • $\begingroup$ First, I do not expect underdetermined system. I test the original model using NDsolve, we can find: NDSolveValue::underdet: There are more dependent variables, {u[x,-3],u[x,3],u[x,y],(u^(0,2))[x,y]}, than equations, so the system is underdetermined. $\endgroup$
    – ABCDEMMM
    Commented Dec 12, 2021 at 13:38
  • $\begingroup$ @ABCDEMMM Look at the end of my answer, here you might find a numerical solution $\endgroup$ Commented Dec 12, 2021 at 14:06
  • $\begingroup$ Thanks! I found it! $\endgroup$
    – ABCDEMMM
    Commented Dec 12, 2021 at 14:07

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.