dummy-link

SincFun

Sinc numerical methods in Julia

Readme

SincFun.jl

Build Status

This package is a work in progress with the goal of implementing fast algorithms relating to cardinal Sinc expansions of functions and solutions to equations such as ODEs and integral equations, among others. Requires current master of SpecialFunctions.jl for sinint and cosint.

The basic usage of the package is like so:

Pkg.clone("https://github.com/MikaelSlevinsky/SincFun.jl.git")
using SincFun

We use the sincfun constructor on a function, potentially with the domain and precision specified as well. Without specification, the domain is [-1,1] with double precision.

f = x-> sin(x);
sf = sincfun(f)
sfc = cumsum(sf)
g = x-> cos(-1)-cos(x);
sg = sincfun(g)
norm(sfc-sg)
f = x-> x*exp(x)*cospi(5x)/(1+x^2);
sf = sincfun(f)
roots(sf)
norm(sf[roots(sf)])

The constructor also allows other domains and precisions and can also incorporate singularities.

f = x-> exp(x);g = x-> f(x)./(1.-x.^2).^(4//5).*log(1.+x);

sf = sincfun(f,Finite(-1.0,1.0,-0.8,-0.8,1.0,0.0));
x = linspace(-0.999,0.999,101);
println(norm(g.(x)-sf[x])," ",sum(sf)," ",length(sf))

sf = sincfun(f,Finite(big(-1.0),big(1.0),BigFloat("-0.8"),BigFloat("-0.8"),big(1.0),big(0.0)));
x = linspace(BigFloat("-0.999"),BigFloat("0.999"),101);
println(norm(g.(x)-sf[x])," ",sum(sf)," ",length(sf))

There is also preliminary support for the Hilbert transform:

sf = sincfun(x->x/(x^2+1)^2,Infinite1());
sg = sincfun(x->(1-x^2)/2/(x^2+1)^2,Infinite1());
sh=hilbert(sf);
x = linspace(-5.0,5.0,1001);
println(norm(sg[x]-sh[x]))

First Commit

09/18/2014

Last Touched

8 days ago

Commits

54 commits

Used By: