Skip to main content
added 1217 characters in body
Source Link

I'm quite new to Mathematica and to Stack Exchange so I apologise if this question has already been answered.

I've recently been trying to solve a partial differential equation to find the eigenvalues and eigenfunctions with NDEigensystem. I'm trying to enter multiple boundary conditions into NDEigensystem but I keep getting the following error:

NDEigensystem::dvlen: The function u[-x,y] does not have the same number of arguments as independent variables (3).

The following is my code.

keyhole = ImplicitRegion[x^2 + y^2 >= 1, {{x, -1/2, 1/2}, {y, 0.0001, 50}}];

NDEigensystem[{-y^2 (D[u[x, y], {x, 2}] + D[u[x, y], {y, 2}]), u[-1/2, y] == u[1/2, y], DirichletCondition[u[x, y] ==  u[-x, y], x^2 + y^2 == 1]},u[x, y], {x, y} \[Element] keyhole, 2]

I believe the error may be due to a syntax error with the DirichletCondition option or because I have too many boundary conditions.

I would really appreciate your input on what I'm doing wrong currently.

Thank you for your help.

Update Based on @user21's comments, I was able to implement PeriodicBoundaryCondition to get the boundary conditions that I wanted. However, I am now encountering a new problem when I specify the domain keyhole. Whenever I set 0.0001<=y <= ymax, and ymax >= 100, I get the following error message:

Eigensystem::herm: The matrix SparseArray[Automatic,<<2>>,{1,{{<<1>>},{<<1>>}},{(lots of numbers here)}] is not Hermitian or real and symmetric

Is there a way that I can modify my code to allow me to increase the domain where the eigenfunction gets solved?

Thank you again for all your help. My updated code is as follows.

keyhole = ImplicitRegion[x^2 + y^2 >= 1, {{x, -1/2, 1/2}, {y, 0.0001,100}}];
test = NDEigensystem[{-y^2 (D[u[x, y], {x, 2}] + D[u[x, y], {y, 2}]),PeriodicBoundaryCondition[u[x, y], x == -1/2,TranslationTransform[{1, 0}]],PeriodicBoundaryCondition[u[x, y], x^2 + y^2 == 1, Function[x, {{-1, 0}, {0, 1}}.x]]}, u[x, y], {x, y} \[Element] keyhole, 4];
Table[Plot3D[test[[2]][[i]], {x, y} \[Element] keyhole, PlotRange -> All,MeshStyle -> None, PlotLabel -> test[[1]][[i]], AxesLabel -> {"x", "y", ""}], {i, 1, 4}]

I'm quite new to Mathematica and to Stack Exchange so I apologise if this question has already been answered.

I've recently been trying to solve a partial differential equation to find the eigenvalues and eigenfunctions with NDEigensystem. I'm trying to enter multiple boundary conditions into NDEigensystem but I keep getting the following error:

NDEigensystem::dvlen: The function u[-x,y] does not have the same number of arguments as independent variables (3).

The following is my code.

keyhole = ImplicitRegion[x^2 + y^2 >= 1, {{x, -1/2, 1/2}, {y, 0.0001, 50}}];

NDEigensystem[{-y^2 (D[u[x, y], {x, 2}] + D[u[x, y], {y, 2}]), u[-1/2, y] == u[1/2, y], DirichletCondition[u[x, y] ==  u[-x, y], x^2 + y^2 == 1]},u[x, y], {x, y} \[Element] keyhole, 2]

I believe the error may be due to a syntax error with the DirichletCondition option or because I have too many boundary conditions.

I would really appreciate your input on what I'm doing wrong currently.

Thank you for your help.

I'm quite new to Mathematica and to Stack Exchange so I apologise if this question has already been answered.

I've recently been trying to solve a partial differential equation to find the eigenvalues and eigenfunctions with NDEigensystem. I'm trying to enter multiple boundary conditions into NDEigensystem but I keep getting the following error:

NDEigensystem::dvlen: The function u[-x,y] does not have the same number of arguments as independent variables (3).

The following is my code.

keyhole = ImplicitRegion[x^2 + y^2 >= 1, {{x, -1/2, 1/2}, {y, 0.0001, 50}}];

NDEigensystem[{-y^2 (D[u[x, y], {x, 2}] + D[u[x, y], {y, 2}]), u[-1/2, y] == u[1/2, y], DirichletCondition[u[x, y] ==  u[-x, y], x^2 + y^2 == 1]},u[x, y], {x, y} \[Element] keyhole, 2]

I believe the error may be due to a syntax error with the DirichletCondition option or because I have too many boundary conditions.

I would really appreciate your input on what I'm doing wrong currently.

Thank you for your help.

Update Based on @user21's comments, I was able to implement PeriodicBoundaryCondition to get the boundary conditions that I wanted. However, I am now encountering a new problem when I specify the domain keyhole. Whenever I set 0.0001<=y <= ymax, and ymax >= 100, I get the following error message:

Eigensystem::herm: The matrix SparseArray[Automatic,<<2>>,{1,{{<<1>>},{<<1>>}},{(lots of numbers here)}] is not Hermitian or real and symmetric

Is there a way that I can modify my code to allow me to increase the domain where the eigenfunction gets solved?

Thank you again for all your help. My updated code is as follows.

keyhole = ImplicitRegion[x^2 + y^2 >= 1, {{x, -1/2, 1/2}, {y, 0.0001,100}}];
test = NDEigensystem[{-y^2 (D[u[x, y], {x, 2}] + D[u[x, y], {y, 2}]),PeriodicBoundaryCondition[u[x, y], x == -1/2,TranslationTransform[{1, 0}]],PeriodicBoundaryCondition[u[x, y], x^2 + y^2 == 1, Function[x, {{-1, 0}, {0, 1}}.x]]}, u[x, y], {x, y} \[Element] keyhole, 4];
Table[Plot3D[test[[2]][[i]], {x, y} \[Element] keyhole, PlotRange -> All,MeshStyle -> None, PlotLabel -> test[[1]][[i]], AxesLabel -> {"x", "y", ""}], {i, 1, 4}]
edited tags
Link
user21
  • 40.7k
  • 8
  • 114
  • 170

Using multiplymultiple boundary conditions with NDEigensystem

Source Link
Loading