Solving for eigenvalues of an equation system in ApproxFun.jl

I’m trying to solve an eigenvalue problem for a system of equations using ApproxFun; however I’m getting an implementation error ERROR: Implement Conversion from Chebyshev{Interval{:closed,:closed,Int64},Float64} to ApproxFunBase.UnsetSpace. I suspect that I’m just misformulating something as its the first time I’ve used the package - any tips? Not-working MWE below:

using ApproxFun

d = Interval(0,1000)
μ = 1e9
ρ = 1000.0

D = Derivative(d)
ω = 1.0

Bu = lneumann(d)
Bl = rdirichlet(d)

B = [Bu 0;
     Bl 0]

I = ones(d)

L = [0 I/μ;
     ρ*ω^2*I+D*μ*D 0]

λ, v = ApproxFun.eigs(B, L, 500,tolerance=1E-10)

You’ve defined I to be Fun, that is, its equivalent to Fun(1, d), so ApproxFun doesn’t understand what you want. It’s also probably a bad idea to overwrite I anyways. So I would do:

E = Operator(I,d)

L = [0 E/μ;
            ρ*ω^2*I+D*μ*D 0]

That said, you are trying to compute over a domain of size 1000 and so you’ll probably need 20_000 discretization size before you see anything, which may be too high for eigs which uses dense generalized eigenvalue solver. Using inverse iteration would be better.

1 Like

Thanks - for this type of problem you can normally have a good guess for the eigenvalue you want so that should help - is there some out-of-the-box support for inverse iteration in ApproxFun or is it implement yourself?

It’s pretty easy to implement, something like

μ = 0.1 # guess of eigenvalue
u = Fun(1, d) # initial guess of eigenvector
v = Fun(1, d) 
for _=1:100
   u,v = [B; L - μ*I] \ [0,0,u,v]
   n = norm(u)+norm(v)
   u /= n
   v /= n
1 Like