@@ -35,13 +35,14 @@ Scomplement = Legendre(-Lx/2..0);
3535# and those of even orders are even functions
3636# Using this, for the odd solutions, we negate the even-order coefficients to construct the odd image in `-Lx/2..0`
3737function oddimage (f, Scomplement)
38- coeffs = [(- 1 )^ isodd (m) * c for (m,c) in enumerate (coefficients (f))]
39- Fun (Scomplement, coeffs)
40- end ;
38+ coeffs = [(- 1 )^ isodd (m) * c for (m,c) in enumerate (coefficients (f))]
39+ Fun (Scomplement, coeffs)
40+ end
4141voddimage = oddimage .(vodd, Scomplement);
4242
4343# Construct the functions over the entire domain `-Lx/2..Lx/2` as piecewise sums over the two half domains `-Lx/2..0` and `0..Lx/2`
44- voddfull = voddimage .+ vodd;
44+ # The eigenfunctions `vodd` are normalized on the half-domain, so we normalize the sum by dividing it by `√2`
45+ voddfull = (voddimage .+ vodd). /√ 2 ;
4546
4647# Even solutions, with a Neumann condition at `0` representing the symmetry of the function
4748B = [lneumann (S); rdirichlet (S)];
@@ -51,16 +52,16 @@ Seig = ApproxFun.SymmetricEigensystem(H, B);
5152
5253# For the even solutions, we negate the odd-order coefficients to construct the even image in `-Lx/2..0`
5354function evenimage (f, Scomplement)
54- coeffs = [(- 1 )^ iseven (m) * c for (m,c) in enumerate (coefficients (f))]
55- Fun (Scomplement, coeffs)
56- end ;
55+ coeffs = [(- 1 )^ iseven (m) * c for (m,c) in enumerate (coefficients (f))]
56+ Fun (Scomplement, coeffs)
57+ end
5758vevenimage = evenimage .(veven, Scomplement);
58- vevenfull = vevenimage .+ veven;
59+ vevenfull = ( vevenimage .+ veven) . /√ 2 ;
5960
6061# We interlace the eigenvalues and eigenvectors to obtain the entire spectrum
6162function interlace (a:: AbstractVector , b:: AbstractVector )
62- vec (permutedims ([a b]))
63- end ;
63+ vec (permutedims ([a b]))
64+ end
6465λ = interlace (λeven, λodd);
6566v = interlace (vevenfull, voddfull);
6667
0 commit comments