Skip to main content

differential equations - Solving eigenvalue BVP with an interface


I have a boundary-value problem, that is defined over two adjacent regions with an interface in the middle, that contains an eigenvalue λ. The boundary conditions and the equations are homogeneous (as expected a linear stability analysis), but could depend on x.


For a simple example: y(x)+5y(x)+λ4y(x)=0,x[x1,x2]z(x)λ4z(x)=0,x[x2,x3]



With some boundary conditions, say y(x1)=y(x1)=0,z(x3)=z(x3)=0, and some continuity/jump conditions at the interface: y(x2)=z(x2)y(x2)=z(x2)y(x2)+y(x2)=2z(x2)+z(x2)z(x2)3y(x2)=z(x2)z(x2)


Here is some code with those equations and conditions:


x1 = -5; x2 = 1; x3 = 2;
eq1 = y''''[x] + 5 y''[x] + λ^4 y[x] == 0;
eq2 = z''''[x] - λ^4 z[x] == 0;
matchconds = {y[x2] == z[x2], y'[x2] + y'''[x2] == -2 z'[x2] + z[x2] - z'''[x2],
y''[x2] == z''[x2], 3 y'''[x2] == -z'[x2] + z'''[x2]};
bcs1 = {y'[x1] == 0, y''[x1] == 0};
bcs2 = {z'[x3] == 0, z'''[x3] == 0};


These equations are actually somewhat amenable to finding analytic results, which may be useful to compare fully numerical solutions with, but in general the coefficients of y and z can depend on x. Here is a code for finding some roots via DSolve:


ysub = DSolve[eq1, y, x][[1]];
zsub = DSolve[eq2, z, x, GeneratedParameters -> (C[# + 4] &)][[1]];
coefmat = Transpose[Table[Coefficient[Join[bcs1, bcs2, matchconds] /. ysub /. zsub /.
Equal -> Subtract, ii], {ii, Array[C, 8]}]];
detRoots = {λ, 0} /. (FindRoot[Det[coefmat], {λ, #}] & /@ {1.3, 1.5, 2, 4}) //Chop;

Note, I plan on self-answering this using my package which calculates the Evans function, but I'm interested in other methods.



Answer



In general, for a linear homogeneous equation of this type we can write: dydx=Ay(λ,x)y,dzdx=Az(λ,x)z,By(x1)=0,Fy(x2)+Gz(x2)=0,Cz(x3)=0.



for some matrices Ay,Az,B,C,F,G, which may all involve the eigenvalue λ (and Ay and Az may be functions of x).


The boundary condition at x=x1 gives us two conditions on the four entries of y there, so we can find two linearly independent solutions that satisfy the boundary conditions. In this example, y1(x1)=[1,0,0,0] and y2(x1)=[0,0,0,1]. We can then integrate both of these solutions across to the matching point x2, and then the general solution is given by y=k1y1+k2y2 (due to linearity).


The same procedure starting at x=x3 gives us a general solution for z=k3z1+k4z2.


For the simpler case without the interface conditions (where Ay=Az, we would then require that the two solutions match at a matching point (which could be chosen arbitrarily), i.e. y(xm)=z(xm), which could be written as N(xm,λ)k=0, where the matrix N is given by N(xm,λ)=[y1,y2,z1,z2]. Non-trivial solutions (i.e. eigenvalues) therefore require |N(xm,λ)|=0. The Evans function D(λ) is a (complex) analytic function whose roots are eigenvalues of the original equation, which is independent of the location of the matching point, D(λ)=exp(xmx1trA(s,λ)ds)|N(xm,λ)|.


For the interface case as described here, we need to satisfy the interface conditions instead, leading to ˆN=[Fy1,Fy2,Gz1,Gy2], and therefore |ˆN|=0.


I have a package that implements all this, including using the compound matrix method to help make the differential equations less stiff, at the cost of converting to more equations. So let us load the package:


Needs["PacletManager`"]
PacletInstall["CompoundMatrixMethod",
"Site" -> "http://raw.githubusercontent.com/paclets/Repository/master"]
Needs["CompoundMatrixMethod`"]


Convert the system of ODEs into the matrix form, which gives all the matrices:


sys = ToMatrixSystem[{eq1, eq2}, {bcs1, bcs2, matchconds}, {y,z}, {x, x1, x2, x3}, λ];

Then the function Evans can be evaluated for a given value of λ with this system:


Evans[1, sys]
-0.170854

And a quick plot:


Plot[Evans[λ, sys], {λ, 0, 5}]


enter image description here


Note that even though there is a zero of the analytic determinant at λ=1.58114, this is because there are repeated roots of the equation for y and not an actual eigenvalue. Note that the Evans function is continuous here (goes down to ~-75).


And then we can find the eigenvalues via FindRoot:


λ /. FindRoot[Evans[λ, sys], {λ, #}] & /@ {1, 1.3, 1.4, 5}

Comments

Popular posts from this blog

functions - Get leading series expansion term?

Given a function f[x] , I would like to have a function leadingSeries that returns just the leading term in the series around x=0 . For example: leadingSeries[(1/x + 2)/(4 + 1/x^2 + x)] x and leadingSeries[(1/x + 2 + (1 - 1/x^3)/4)/(4 + x)] -(1/(16 x^3)) Is there such a function in Mathematica? Or maybe one can implement it efficiently? EDIT I finally went with the following implementation, based on Carl Woll 's answer: lds[ex_,x_]:=( (ex/.x->(x+O[x]^2))/.SeriesData[U_,Z_,L_List,Mi_,Ma_,De_]:>SeriesData[U,Z,{L[[1]]},Mi,Mi+1,De]//Quiet//Normal) The advantage is, that this one also properly works with functions whose leading term is a constant: lds[Exp[x],x] 1 Answer Update 1 Updated to eliminate SeriesData and to not return additional terms Perhaps you could use: leadingSeries[expr_, x_] := Normal[expr /. x->(x+O[x]^2) /. a_List :> Take[a, 1]] Then for your examples: leadingSeries[(1/x + 2)/(4 + 1/x^2 + x), x] leadingSeries[Exp[x], x] leadingSeries[(1/x + 2 + (1 - 1/x...

mathematical optimization - Minimizing using indices, error: Part::pkspec1: The expression cannot be used as a part specification

I want to use Minimize where the variables to minimize are indices pointing into an array. Here a MWE that hopefully shows what my problem is. vars = u@# & /@ Range[3]; cons = Flatten@ { Table[(u[j] != #) & /@ vars[[j + 1 ;; -1]], {j, 1, 3 - 1}], 1 vec1 = {1, 2, 3}; vec2 = {1, 2, 3}; Minimize[{Total@((vec1[[#]] - vec2[[u[#]]])^2 & /@ Range[1, 3]), cons}, vars, Integers] The error I get: Part::pkspec1: The expression u[1] cannot be used as a part specification. >> Answer Ok, it seems that one can get around Mathematica trying to evaluate vec2[[u[1]]] too early by using the function Indexed[vec2,u[1]] . The working MWE would then look like the following: vars = u@# & /@ Range[3]; cons = Flatten@{ Table[(u[j] != #) & /@ vars[[j + 1 ;; -1]], {j, 1, 3 - 1}], 1 vec1 = {1, 2, 3}; vec2 = {1, 2, 3}; NMinimize[ {Total@((vec1[[#]] - Indexed[vec2, u[#]])^2 & /@ R...

plotting - Plot 4D data with color as 4th dimension

I have a list of 4D data (x position, y position, amplitude, wavelength). I want to plot x, y, and amplitude on a 3D plot and have the color of the points correspond to the wavelength. I have seen many examples using functions to define color but my wavelength cannot be expressed by an analytic function. Is there a simple way to do this? Answer Here a another possible way to visualize 4D data: data = Flatten[Table[{x, y, x^2 + y^2, Sin[x - y]}, {x, -Pi, Pi,Pi/10}, {y,-Pi,Pi, Pi/10}], 1]; You can use the function Point along with VertexColors . Now the points are places using the first three elements and the color is determined by the fourth. In this case I used Hue, but you can use whatever you prefer. Graphics3D[ Point[data[[All, 1 ;; 3]], VertexColors -> Hue /@ data[[All, 4]]], Axes -> True, BoxRatios -> {1, 1, 1/GoldenRatio}]