In [ ]:
using BasisFunctions
using FrameFun
using DomainSets
using Plots;gr()
using StaticArrays
In [ ]:
B = FourierBasis(61,-1,1)
D = Interval(-0.5,0.5)
f1 = x->cos(3*x)
F1 = Fun(f1,B,D)
You can evaluate the fun like an ordinary function:
In [ ]:
F1(0.5)
In [ ]:
f1(0.5)
In [ ]:
plot(F1,layout=2)
plot!(F1,f1,subplot=2)
In [ ]:
In [ ]:
B2 = ChebyshevBasis(130)
D = Interval()/2
f2 = x->cos(80*x)
F2 = Fun(f2, B2, D)
In [ ]:
F2(0.1)
In [ ]:
f2(0.1)
In [ ]:
plot(F2, layout=2, plot_ext=true)
plot!(F2,f2, subplot=2)
In [ ]:
In [ ]:
f3 = x->cos(10*x.^2)
B = FourierBasis(41,-1,1)
D = Interval(-1.0,-0.5)∪Interval(-0.2,0.5)
F3 = Fun(f3,B,D)
In [ ]:
l = @layout [Plots.grid(1,1); Plots.grid(1,2)]
plot(F3, layout=l)
plot!(F3, subplot=2, plot_ext=true)
plot!(F3,f3, subplot=3)
In [ ]:
In [ ]:
B = instantiate(FourierBasis,61,BigFloat)
D = Interval(0.,0.5)
fh = x->x
Fh = Fun(fh,B,D)
In [ ]:
pt = 3//10
abs(Fh(pt)-fh(pt))
In [ ]:
plot(Fh, layout=2)
plot!(Fh,fh, subplot=2)
In [ ]:
In [ ]:
D = Interval(0.,.5)^2
In [ ]:
B = FourierBasis(100)⊗FourierBasis(100)
f = (x,y)->exp(y*2*x)
F = Fun(f,B,D)
In [ ]:
plot(F)
In [ ]:
plot(F,f)
In [ ]:
C = disk() \ disk(0.3,SVector(0.2, 0.5))
In [ ]:
plot(C)
In [ ]:
B = FourierBasis(41,-1.3,1.3) ⊗ FourierBasis(41,-1.3,1.3)
fC(x,y) = exp(y+x)
F = Fun(fC,B,C)
In [ ]:
F(0,0.4)
In [ ]:
fC(0, 0.4)
In [ ]:
plot(F)
In [ ]:
heatmap(F,fC)
In [ ]:
Like, for example, the Mandelbrot and a Julia set (Douady rabbit)
In [ ]:
plot(mandelbrot(),layout=2)
plot!(juliaset(),subplot=2)
In [ ]:
D=FrameFun.mandelbrot()
B = FourierBasis(31,-1.0,0.35) ⊗ FourierBasis(31,-0.65,0.65)
fm(x,y) = cos(10*x*y)
F = Fun(fm, B, D)
In [ ]:
heatmap(F)
In [ ]:
contourf(F,fm)
In [ ]: