Not sure whether this is the right place to ask since technically my question concerns SingularIntegralEquations.jl, but that package seems to be related enough to ApproxFun.jl that I'll go ahead anyway.
In the code of SingularIntegralEquations it says
# stieltjesintegral is an indefinite integral of stieltjes
# normalized so that there is no constant term
Can someone elaborate on that normalisation condition?
d/dx[(1-x)^a *(1+x)^b P_n^(a,b)] = C (1-x)^{a-1} (1+x)^{b-1} P_{n+1}^(a-1,b-1)
. Roughly speaking, for functions that vanish at ±1, derivatives and Stieltjes transforms commute, so provided a,b > 0
we can use this to write the integral of a Stieltjes transforms in terms of the integral of the integrand.
n = 0
case is special, and dictates the normalisation constant (as the construction for other n
will automatically decay something like O(z^(-n))
)
julia> f = exp(x) * sqrt(1-x^2);
julia> z = 10_000; stieltjesintegral(f,z) - log(z) * sum(f)
-4.264886882765495e-5
julia> x = Fun(1..2);
julia> f = exp(x) * sqrt((x-1)*(2-x));
julia> z = 100_000; stieltjesintegral(f,z) - log(z) * sum(f)
-2.8356239955229512e-5
stieltjes(f,z) = log(z) *sum(f) + o(1)
.
logkernel
(whose normalization is imposed by the actual definition):julia> logkernel(f, z) -log(abs(z))/π * sum(f)
-9.026071512430178e-6
Hi i was playing with modified example from Quantum states.jl
Using ApproxFun
fc1 = Fun(1, 0..1); fc2 = Fun(2, 1..2); fc3 = Fun(3, 2..3)
fc= fc1+fc2+fc3
D = Derivative(); sp = space(fc); x= Fun(sp);
B = [Dirichlet(sp); continuity(sp,0:1)]
λ, v = ApproxFun.eigs(B, -D^2 + fc, 500,tolerance=1E-10)
#returns result
λ, v = ApproxFun.eigs(B, -D^2 - 1/x*D + fc, 500,tolerance=1E-10)
# says Not implemented but if fc=fc1+fc2 it manages to return result
Is 1/x*D kind of a problematic composition?
eigs
is quite stale and needs to be rewritten, but that's low priority for me. I'll accept any PRs.
λ, v = ApproxFun.eigs(B, L, x, 500,tolerance=1E-10)
x= Fun(0..1); sx=space(x);
a=Fun(0..pi); sa=space(a);
fa= DefiniteIntegral(x*a,sx)
# i expect fa= a here
but i get MethodError. Are integrals of two arguments possible?
to practice your guiding i wrote
function Hankel(fx::Fun, spx,spa::Space)
spxa= spx ⊗ spa
fx2= Fun((x,a)-> fx(x), spxa)
fj= Fun((x,a) -> besselj0(x*a), spxa)
fa2= (DefiniteIntegral(dmx1) ⊗ I)*(fx2*fj*x)
fa= Fun(a->fa2(0,a), spa)
end
from the definition. It seems to work. Thank you!
Is this the style ApproxFun is expected to be used?
Is this the style ApproxFun is expected to be used?
In Julia, capital letters are only used when it returns a special type of the same name. So this would be better as lower case. Also, there is support for Green's functions in https://github.com/JuliaApproximation/SingularIntegralEquations.jl including Helmholtz / hankel kernels
when i blind try
spx= Space(0..1); spa= Space(0..π); spxa= spx ⊗ spa
Q2= DefiniteIntegral(spx.domain) ⊗ I
Q1= ApproxFun.SpaceOperator(Q2, spxa, spa )
x=Fun((x,a)->x,spxa); a=Fun((x,a)->a,spxa)
(Q2*(x*a))(0,1) #=0.5
(Q1*(x*a))(1) #=0.5*pi/2
it seems to work up to scaling cofficient
I'm quite sure Fun
used to work on intervals in the complex domain. But now
f(x) = cos(x)
Fun(f, Interval(1.0+1.0im, 2.0+2.0im))
throws the error
ERROR: MethodError: no method matching isless(::Complex{Float64}, ::Complex{Float64})
Closest candidates are:
isless(::Missing, ::Any) at missing.jl:66
isless(::InfiniteArrays.OrientedInfinity{Bool}, ::Number) at /.julia/packages/InfiniteArrays/Z4yap/src/Infinity.jl:145
isless(::Number, ::InfiniteArrays.OrientedInfinity{Bool}) at /.julia/packages/InfiniteArrays/Z4yap/src/Infinity.jl:144
...
Stacktrace:
[1] <(::Complex{Float64}, ::Complex{Float64}) at ./operators.jl:260
[2] >(::Complex{Float64}, ::Complex{Float64}) at ./operators.jl:286
[3] isempty(::Interval{:closed,:closed,Complex{Float64}}) at /.julia/packages/IntervalSets/xr34V/src/IntervalSets.jl:153