@@ -99,6 +99,53 @@ Base._range(a::T, step::T, ::Nothing, len::Integer) where {T <: AbstractFloat} =
99
99
@test norm ((λ[1 : 4 ] - λtrue ). / λ[1 : 4 ]) < 1e-5
100
100
end
101
101
102
+ @testset " Schrödinger with linear + Dirac potential with Robin boundary conditions" begin
103
+ #
104
+ # [-𝒟² + V] u = λu, u(-1) = u(1) + u'(1) = 0,
105
+ #
106
+ # where V = x + 100δ(x-0.25).
107
+ #
108
+ d = Segment (- 1 .. 0.25 )∪ Segment (0.25 .. 1 )
109
+ S = PiecewiseSpace (Ultraspherical .(0.5 , d. domains))
110
+ NS = PiecewiseSpace (NormalizedUltraspherical .(0.5 , d. domains))
111
+ V = Fun (identity, S)
112
+ L = - Derivative (S, 2 ) + V
113
+ C = Conversion (domainspace (L), rangespace (L))
114
+ B4 = zeros (Operator{ApproxFun. prectype (S)}, 1 , 2 )
115
+ B4[1 , 1 ] = - Evaluation (component (S, 1 ), rightendpoint, 1 ) - 100 * 0.5 * Evaluation (component (S, 1 ), rightendpoint)
116
+ B4[1 , 2 ] = Evaluation (component (S, 2 ), leftendpoint, 1 ) - 100 * 0.5 * Evaluation (component (S, 2 ), leftendpoint)
117
+ B4 = ApproxFun. InterlaceOperator (B4, PiecewiseSpace, ApproxFun. ArraySpace)
118
+ B = [Evaluation (S, - 1 ); Evaluation (S, 1 ) + Evaluation (S, 1 , 1 ); continuity (S, 0 ); B4]
119
+ QS = QuotientSpace (B)
120
+ Q = Conversion (QS, S)
121
+ D1 = Conversion (S, NS)
122
+ D2 = Conversion (NS, S)
123
+ R = D1* Q
124
+ P = cache (PartialInverseOperator (C, (0 , bandwidth (L, 1 ) + bandwidth (R, 1 ) + bandwidth (C, 2 ))))
125
+ A = R' D1* P* L* D2* R
126
+ B = R' R
127
+
128
+ n = 100
129
+ SA = Symmetric (A[1 : n,1 : n], :L )
130
+ SB = Symmetric (B[1 : n,1 : n], :L )
131
+
132
+ k = 3
133
+
134
+ λ, Q = eigen (SA, SB);
135
+ u_QS = Fun (QS, Q[:, k])
136
+ u_S = Fun (u_QS, S)
137
+ u = Fun (u_S, PiecewiseSpace (Chebyshev .(d. domains)))
138
+ u /= sign (u' (- 1 ))
139
+ u1, u2 = components (u)
140
+
141
+ @test norm (u (- 1 )) < 100 eps ()
142
+ @test u (1 ) ≈ - u' (1 )
143
+ @test u1 (0.25 ) ≈ u2 (0.25 )
144
+ @test u2' (0.25 ) - u1' (0.25 ) ≈ 100 * u (0.25 )
145
+ @test - u1'' + component (V, 1 )* u1 ≈ λ[k]* u1
146
+ @test - u2'' + component (V, 2 )* u2 ≈ λ[k]* u2
147
+ end
148
+
102
149
@testset " BigFloat negative Laplacian with Dirichlet boundary conditions" begin
103
150
#
104
151
# -𝒟² u = λu, u(±1) = 0.
0 commit comments