diff --git a/.gitignore b/.gitignore index a1e6a26..745deb1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -examples/.ipynb_checkpoints/Manipulate SIEs-checkpoint.ipynb +examples/.ipynb_checkpoints/*.ipynb src/CUDA/**/*.ptx deps/**/*.o deps/**/*.dll diff --git a/examples/Scatteraux.jl b/examples/Scatteraux.jl index 5291a05..a47fe34 100644 --- a/examples/Scatteraux.jl +++ b/examples/Scatteraux.jl @@ -17,6 +17,26 @@ if !isdefined(:scatteraux_loaded) end + function logheatmap(A::AbstractMatrix,ϵ;kwds...) + ltϵ = log10(ϵ) + LGABSAt = [isinf(log10(abs(A[j,i]))) ? ltϵ : max(log10(abs(A[j,i])),ltϵ) for i=1:size(A,2),j=1:size(A,1)] + heatmap(flipdim(LGABSAt,1);kwds...) + end + + function oscillate(u,T,glp) + push!(glp,u) + yield() + fps = 15 + MLen = round(Int,T*fps) + t = inv(fps) + for k=1:MLen + u = u*exp(-im*2π*t) + push!(glp,u) + yield() + end + u + end + function makegif(x,y,u,L;plotfunction=Main.Plots.PyPlot.contourf,seconds=1,cmap="seismic",vert=1) tm=string(time_ns()) dr = pwd()*"/"*tm*"mov" diff --git a/examples/Time Evolution PDSIES.ipynb b/examples/Time Evolution PDSIES.ipynb new file mode 100644 index 0000000..b7e2d4e --- /dev/null +++ b/examples/Time Evolution PDSIES.ipynb @@ -0,0 +1,5932 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "
\n", + " \n", + " \n", + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "WARNING: New definition \n", + " writemime(Base.IO, Base.Multimedia.MIME, Reactive.Signal) at /Users/Mikael/.julia/v0.4/Interact/src/IJulia/setup.jl:99\n", + "is ambiguous with: \n", + " writemime(Base.IO, Base.Multimedia.MIME{:text/plain}, Any) at replutil.jl:4.\n", + "To fix, define \n", + " writemime(Base.IO, Base.Multimedia.MIME{:text/plain}, Reactive.Signal)\n", + "before the new definition.\n" + ] + } + ], + "source": [ + "using ApproxFun, SingularIntegralEquations, Plots,Interact,Reactive; gadfly();" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Benjamin-Ono equation with periodic boundary conditions $$u_t+uu_x+H\\{u_{xx}\\}=0$$" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[Plots.jl] Initializing backend: gadfly\n" + ] + }, + { + "data": { + "image/svg+xml": [ + "\n", + "\n", + "\n", + " \n", + "\n", + "\n", + " \n", + " -5\n", + " 0\n", + " 5\n", + " \n", + " \n", + " \n", + " y1\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + " \n", + " -1.0\n", + " -0.5\n", + " 0.0\n", + " 0.5\n", + " 1.0\n", + " \n", + "\n", + "\n", + " \n", + " \n", + "\n", + "\n", + "\n" + ], + "text/html": [ + "\n", + "\n", + "\n", + " \n", + "\n", + "\n", + " \n", + " -20\n", + " -15\n", + " -10\n", + " -5\n", + " 0\n", + " 5\n", + " 10\n", + " 15\n", + " 20\n", + " -15.0\n", + " -14.5\n", + " -14.0\n", + " -13.5\n", + " -13.0\n", + " -12.5\n", + " -12.0\n", + " -11.5\n", + " -11.0\n", + " -10.5\n", + " -10.0\n", + " -9.5\n", + " -9.0\n", + " -8.5\n", + " -8.0\n", + " -7.5\n", + " -7.0\n", + " -6.5\n", + " -6.0\n", + " -5.5\n", + " -5.0\n", + " -4.5\n", + " -4.0\n", + " -3.5\n", + " -3.0\n", + " -2.5\n", + " -2.0\n", + " -1.5\n", + " -1.0\n", + " -0.5\n", + " 0.0\n", + " 0.5\n", + " 1.0\n", + " 1.5\n", + " 2.0\n", + " 2.5\n", + " 3.0\n", + " 3.5\n", + " 4.0\n", + " 4.5\n", + " 5.0\n", + " 5.5\n", + " 6.0\n", + " 6.5\n", + " 7.0\n", + " 7.5\n", + " 8.0\n", + " 8.5\n", + " 9.0\n", + " 9.5\n", + " 10.0\n", + " 10.5\n", + " 11.0\n", + " 11.5\n", + " 12.0\n", + " 12.5\n", + " 13.0\n", + " 13.5\n", + " 14.0\n", + " 14.5\n", + " 15.0\n", + " -20\n", + " -10\n", + " 0\n", + " 10\n", + " 20\n", + " -15\n", + " -14\n", + " -13\n", + " -12\n", + " -11\n", + " -10\n", + " -9\n", + " -8\n", + " -7\n", + " -6\n", + " -5\n", + " -4\n", + " -3\n", + " -2\n", + " -1\n", + " 0\n", + " 1\n", + " 2\n", + " 3\n", + " 4\n", + " 5\n", + " 6\n", + " 7\n", + " 8\n", + " 9\n", + " 10\n", + " 11\n", + " 12\n", + " 13\n", + " 14\n", + " 15\n", + " \n", + " \n", + " \n", + " y1\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + " \n", + " -3.5\n", + " -3.0\n", + " -2.5\n", + " -2.0\n", + " -1.5\n", + " -1.0\n", + " -0.5\n", + " 0.0\n", + " 0.5\n", + " 1.0\n", + " 1.5\n", + " 2.0\n", + " 2.5\n", + " 3.0\n", + " 3.5\n", + " -3.0\n", + " -2.9\n", + " -2.8\n", + " -2.7\n", + " -2.6\n", + " -2.5\n", + " -2.4\n", + " -2.3\n", + " -2.2\n", + " -2.1\n", + " -2.0\n", + " -1.9\n", + " -1.8\n", + " -1.7\n", + " -1.6\n", + " -1.5\n", + " -1.4\n", + " -1.3\n", + " -1.2\n", + " -1.1\n", + " -1.0\n", + " -0.9\n", + " -0.8\n", + " -0.7\n", + " -0.6\n", + " -0.5\n", + " -0.4\n", + " -0.3\n", + " -0.2\n", + " -0.1\n", + " 0.0\n", + " 0.1\n", + " 0.2\n", + " 0.3\n", + " 0.4\n", + " 0.5\n", + " 0.6\n", + " 0.7\n", + " 0.8\n", + " 0.9\n", + " 1.0\n", + " 1.1\n", + " 1.2\n", + " 1.3\n", + " 1.4\n", + " 1.5\n", + " 1.6\n", + " 1.7\n", + " 1.8\n", + " 1.9\n", + " 2.0\n", + " 2.1\n", + " 2.2\n", + " 2.3\n", + " 2.4\n", + " 2.5\n", + " 2.6\n", + " 2.7\n", + " 2.8\n", + " 2.9\n", + " 3.0\n", + " -4\n", + " -2\n", + " 0\n", + " 2\n", + " 4\n", + " -3.0\n", + " -2.8\n", + " -2.6\n", + " -2.4\n", + " -2.2\n", + " -2.0\n", + " -1.8\n", + " -1.6\n", + " -1.4\n", + " -1.2\n", + " -1.0\n", + " -0.8\n", + " -0.6\n", + " -0.4\n", + " -0.2\n", + " 0.0\n", + " 0.2\n", + " 0.4\n", + " 0.6\n", + " 0.8\n", + " 1.0\n", + " 1.2\n", + " 1.4\n", + " 1.6\n", + " 1.8\n", + " 2.0\n", + " 2.2\n", + " 2.4\n", + " 2.6\n", + " 2.8\n", + " 3.0\n", + " \n", + "\n", + "\n", + " \n", + " \n", + "\n", + "\n", + "\n", + "\n", + "\n" + ], + "text/plain": [ + "Signal{Gadfly.Plot}(Gadfly.Plot([Gadfly.Layer(nothing,Dict{Symbol,Any}(:y=>[4.21324e-18,-1.48478e-12,-3.40575e-12,-6.18602e-12,-1.02387e-11,-1.5994e-11,-2.39481e-11,-3.47214e-11,-4.9113e-11,-6.81445e-11 … 9.30946e-11,6.81445e-11,4.9113e-11,3.47215e-11,2.39482e-11,1.5994e-11,1.02387e-11,6.18603e-12,3.40576e-12,1.48479e-12],:x=>[-5.0,-4.97647,-4.95294,-4.92941,-4.90588,-4.88235,-4.85882,-4.83529,-4.81176,-4.78824 … 4.76471,4.78824,4.81176,4.83529,4.85882,4.88235,4.90588,4.92941,4.95294,4.97647]),Gadfly.StatisticElement[],Gadfly.Geom.LineGeometry(Gadfly.Stat.Identity(),true,2,symbol(\"\")),Gadfly.Theme(RGBA{Float64}(0.0,0.6056031366372086,0.9786801302529567,1.0),0.9mm,0.2645502645502646mm,Any[],nothing,nothing,1.0,nothing,5.0mm,RGB{U8}(0.816,0.816,0.878),[0.5mm,0.5mm],RGB{U8}(0.627,0.627,0.627),0.2mm,\"'PT Sans Caption','Helvetica Neue','Helvetica',sans-serif\",2.822222222222222mm,RGB{U8}(0.424,0.376,0.42),\"'PT Sans','Helvetica Neue','Helvetica',sans-serif\",3.880555555555555mm,RGB{U8}(0.337,0.29,0.333),\"'PT Sans Caption','Helvetica Neue','Helvetica',sans-serif\",2.822222222222222mm,RGB{U8}(0.298,0.251,0.294),\"'PT Sans','Helvetica Neue','Helvetica',sans-serif\",3.880555555555555mm,RGB{U8}(0.212,0.165,0.208),\"'PT Sans','Helvetica Neue','Helvetica',sans-serif\",2.822222222222222mm,RGB{U8}(0.298,0.251,0.294),40,-0.05mm,1.0mm,3.0mm,Gadfly.default_stroke_color,0.3mm,Gadfly.default_discrete_highlight_color,Gadfly.default_continuous_highlight_color,(anonymous function),1.0,Gadfly.default_middle_color,0.6mm,:left,:square,:right,RGB{Float64}(0.0,0.6056031366372086,0.9786801302529567),[Compose.circle,Gadfly.square,Gadfly.diamond,Gadfly.cross,Gadfly.xcross,Gadfly.utriangle,Gadfly.dtriangle,Gadfly.star1,Gadfly.star2,Gadfly.hexagon,Gadfly.octagon],2.0mm,1000,10.0,0.5,0.2,4),0)],0x0 DataFrames.DataFrame\n", + ",Data(\n", + " titles=Dict{Symbol,AbstractString}()\n", + ")\n", + ",Gadfly.ScaleElement[Gadfly.Scale.ContinuousScale([:x,:xmin,:xmax,:xintercept,:xviewmin,:xviewmax],Gadfly.Scale.ContinuousScaleTransform(identity,identity,Gadfly.Scale.identity_formatter),-5,5,2,10,nothing,nothing,true),Gadfly.Scale.ContinuousScale([:y,:ymin,:ymax,:yintercept,:middle,:upper_fence,:lower_fence,:upper_hinge,:lower_hinge,:yviewmin,:yviewmax],Gadfly.Scale.ContinuousScaleTransform(identity,identity,Gadfly.Scale.identity_formatter),-1.0,1.0,2,10,nothing,nothing,true)],Gadfly.StatisticElement[],Gadfly.Coord.Cartesian([:x,:xmin,:xmax,:xintercept],[:y,:ymin,:ymax,:yintercept,:middle,:lower_hinge,:upper_hinge,:lower_fence,:upper_fence,:outliers],-5,5,-1.0,1.0,false,false,false,nothing,false),Gadfly.GuideElement[Gadfly.Guide.ManualColorKey{ColorTypes.Color{T,N}}(\"\",AbstractString[\"y1\"],ColorTypes.Color[RGB{Float64}(0.0,0.6056031366372086,0.9786801302529567)]),Gadfly.Guide.XLabel(\"\",:auto),Gadfly.Guide.YLabel(\"\",:auto),Gadfly.Guide.Title(\"\")],Gadfly.Theme(LCHab{Float32}(70.0f0,60.0f0,240.0f0),0.9mm,0.3mm,nothing,nothing,nothing,1.0,RGBA{U8}(1.0,1.0,1.0,1.0),1.0mm,RGB{U8}(0.816,0.816,0.878),[0.5mm,0.5mm],RGB{U8}(0.627,0.627,0.627),0.2mm,\"Helvetica\",2.822222222222222mm,RGBA{U8}(0.0,0.0,0.0,1.0),\"Helvetica\",3.880555555555555mm,RGBA{U8}(0.0,0.0,0.0,1.0),\"'PT Sans Caption','Helvetica Neue','Helvetica',sans-serif\",2.822222222222222mm,RGB{U8}(0.298,0.251,0.294),\"Helvetica\",3.880555555555555mm,RGBA{U8}(0.0,0.0,0.0,1.0),\"Helvetica\",2.822222222222222mm,RGBA{U8}(0.0,0.0,0.0,1.0),40,-0.05mm,1.0mm,3.0mm,Gadfly.default_stroke_color,0.3mm,Gadfly.default_discrete_highlight_color,Gadfly.default_continuous_highlight_color,Gadfly.default_lowlight_color,0.6,Gadfly.default_middle_color,0.6mm,:left,:square,:right,nothing,[Compose.circle,Gadfly.square,Gadfly.diamond,Gadfly.cross,Gadfly.xcross,Gadfly.utriangle,Gadfly.dtriangle,Gadfly.star1,Gadfly.star2,Gadfly.hexagon,Gadfly.octagon],2.0mm,1000,10.0,0.5,0.2,4),Dict{Any,Any}()), nactions=1)" + ] + }, + "execution_count": 2, + "metadata": { + "comm_id": "ecd8b24e-d687-4a10-b802-ab17b9884b7b", + "reactive": true + }, + "output_type": "execute_result" + } + ], + "source": [ + "a,b = -5,5\n", + "u0,t=Fun(x->sinpi(x)*exp(-x^2),Laurent(PeriodicInterval(a,b))),0.0\n", + "sp=space(u0);D=Derivative(sp);H=Hilbert(sp)\n", + "L = -H*D^2\n", + "N(u,t) = -u*u'\n", + "x=Signal(u0);map(y->plot(real(y);xlims=(a,b),ylims=(-1.,1.)).o,x)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "u0,t=ETDRK4(L,N,u0,t,0.01,200,x,1e-8);" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Here is a 1-periodic wave solution" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "image/svg+xml": [ + "\n", + "\n", + "\n", + " \n", + "\n", + "\n", + " \n", + " -20\n", + " 0\n", + " 20\n", + " \n", + " \n", + " \n", + " y1\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + " \n", + " 0.0\n", + " 0.5\n", + " 1.0\n", + " 1.5\n", + " 2.0\n", + " \n", + "\n", + "\n", + " \n", + " \n", + "\n", + "\n", + "\n" + ], + "text/html": [ + "\n", + "\n", + "\n", + " \n", + "\n", + "\n", + " \n", + " -140\n", + " -120\n", + " -100\n", + " -80\n", + " -60\n", + " -40\n", + " -20\n", + " 0\n", + " 20\n", + " 40\n", + " 60\n", + " 80\n", + " 100\n", + " 120\n", + " 140\n", + " -96\n", + " -94\n", + " -92\n", + " -90\n", + " -88\n", + " -86\n", + " -84\n", + " -82\n", + " -80\n", + " -78\n", + " -76\n", + " -74\n", + " -72\n", + " -70\n", + " -68\n", + " -66\n", + " -64\n", + " -62\n", + " -60\n", + " -58\n", + " -56\n", + " -54\n", + " -52\n", + " -50\n", + " -48\n", + " -46\n", + " -44\n", + " -42\n", + " -40\n", + " -38\n", + " -36\n", + " -34\n", + " -32\n", + " -30\n", + " -28\n", + " -26\n", + " -24\n", + " -22\n", + " -20\n", + " -18\n", + " -16\n", + " -14\n", + " -12\n", + " -10\n", + " -8\n", + " -6\n", + " -4\n", + " -2\n", + " 0\n", + " 2\n", + " 4\n", + " 6\n", + " 8\n", + " 10\n", + " 12\n", + " 14\n", + " 16\n", + " 18\n", + " 20\n", + " 22\n", + " 24\n", + " 26\n", + " 28\n", + " 30\n", + " 32\n", + " 34\n", + " 36\n", + " 38\n", + " 40\n", + " 42\n", + " 44\n", + " 46\n", + " 48\n", + " 50\n", + " 52\n", + " 54\n", + " 56\n", + " 58\n", + " 60\n", + " 62\n", + " 64\n", + " 66\n", + " 68\n", + " 70\n", + " 72\n", + " 74\n", + " 76\n", + " 78\n", + " 80\n", + " 82\n", + " 84\n", + " 86\n", + " 88\n", + " 90\n", + " 92\n", + " 94\n", + " 96\n", + " -100\n", + " -50\n", + " 0\n", + " 50\n", + " 100\n", + " -95\n", + " -90\n", + " -85\n", + " -80\n", + " -75\n", + " -70\n", + " -65\n", + " -60\n", + " -55\n", + " -50\n", + " -45\n", + " -40\n", + " -35\n", + " -30\n", + " -25\n", + " -20\n", + " -15\n", + " -10\n", + " -5\n", + " 0\n", + " 5\n", + " 10\n", + " 15\n", + " 20\n", + " 25\n", + " 30\n", + " 35\n", + " 40\n", + " 45\n", + " 50\n", + " 55\n", + " 60\n", + " 65\n", + " 70\n", + " 75\n", + " 80\n", + " 85\n", + " 90\n", + " 95\n", + " \n", + " \n", + " \n", + " y1\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + " \n", + " -2.5\n", + " -2.0\n", + " -1.5\n", + " -1.0\n", + " -0.5\n", + " 0.0\n", + " 0.5\n", + " 1.0\n", + " 1.5\n", + " 2.0\n", + " 2.5\n", + " 3.0\n", + " 3.5\n", + " 4.0\n", + " 4.5\n", + " -2.0\n", + " -1.9\n", + " -1.8\n", + " -1.7\n", + " -1.6\n", + " -1.5\n", + " -1.4\n", + " -1.3\n", + " -1.2\n", + " -1.1\n", + " -1.0\n", + " -0.9\n", + " -0.8\n", + " -0.7\n", + " -0.6\n", + " -0.5\n", + " -0.4\n", + " -0.3\n", + " -0.2\n", + " -0.1\n", + " 0.0\n", + " 0.1\n", + " 0.2\n", + " 0.3\n", + " 0.4\n", + " 0.5\n", + " 0.6\n", + " 0.7\n", + " 0.8\n", + " 0.9\n", + " 1.0\n", + " 1.1\n", + " 1.2\n", + " 1.3\n", + " 1.4\n", + " 1.5\n", + " 1.6\n", + " 1.7\n", + " 1.8\n", + " 1.9\n", + " 2.0\n", + " 2.1\n", + " 2.2\n", + " 2.3\n", + " 2.4\n", + " 2.5\n", + " 2.6\n", + " 2.7\n", + " 2.8\n", + " 2.9\n", + " 3.0\n", + " 3.1\n", + " 3.2\n", + " 3.3\n", + " 3.4\n", + " 3.5\n", + " 3.6\n", + " 3.7\n", + " 3.8\n", + " 3.9\n", + " 4.0\n", + " -2\n", + " 0\n", + " 2\n", + " 4\n", + " -2.0\n", + " -1.8\n", + " -1.6\n", + " -1.4\n", + " -1.2\n", + " -1.0\n", + " -0.8\n", + " -0.6\n", + " -0.4\n", + " -0.2\n", + " 0.0\n", + " 0.2\n", + " 0.4\n", + " 0.6\n", + " 0.8\n", + " 1.0\n", + " 1.2\n", + " 1.4\n", + " 1.6\n", + " 1.8\n", + " 2.0\n", + " 2.2\n", + " 2.4\n", + " 2.6\n", + " 2.8\n", + " 3.0\n", + " 3.2\n", + " 3.4\n", + " 3.6\n", + " 3.8\n", + " 4.0\n", + " \n", + "\n", + "\n", + " \n", + " \n", + "\n", + "\n", + "\n", + "\n", + "\n" + ], + "text/plain": [ + "Signal{Gadfly.Plot}(Gadfly.Plot([Gadfly.Layer(nothing,Dict{Symbol,Any}(:y=>[0.666667,0.666837,0.667347,0.668199,0.669393,0.670932,0.672817,0.675052,0.67764,0.680585 … 0.683892,0.680585,0.67764,0.675052,0.672817,0.670932,0.669393,0.668199,0.667347,0.666837],:x=>[-31.4159,-31.3377,-31.2594,-31.1812,-31.1029,-31.0247,-30.9464,-30.8682,-30.79,-30.7117 … 30.6335,30.7117,30.79,30.8682,30.9464,31.0247,31.1029,31.1812,31.2594,31.3377]),Gadfly.StatisticElement[],Gadfly.Geom.LineGeometry(Gadfly.Stat.Identity(),true,2,symbol(\"\")),Gadfly.Theme(RGBA{Float64}(0.0,0.6056031366372086,0.9786801302529567,1.0),0.9mm,0.2645502645502646mm,Any[],nothing,nothing,1.0,nothing,5.0mm,RGB{U8}(0.816,0.816,0.878),[0.5mm,0.5mm],RGB{U8}(0.627,0.627,0.627),0.2mm,\"'PT Sans Caption','Helvetica Neue','Helvetica',sans-serif\",2.822222222222222mm,RGB{U8}(0.424,0.376,0.42),\"'PT Sans','Helvetica Neue','Helvetica',sans-serif\",3.880555555555555mm,RGB{U8}(0.337,0.29,0.333),\"'PT Sans Caption','Helvetica Neue','Helvetica',sans-serif\",2.822222222222222mm,RGB{U8}(0.298,0.251,0.294),\"'PT Sans','Helvetica Neue','Helvetica',sans-serif\",3.880555555555555mm,RGB{U8}(0.212,0.165,0.208),\"'PT Sans','Helvetica Neue','Helvetica',sans-serif\",2.822222222222222mm,RGB{U8}(0.298,0.251,0.294),40,-0.05mm,1.0mm,3.0mm,Gadfly.default_stroke_color,0.3mm,Gadfly.default_discrete_highlight_color,Gadfly.default_continuous_highlight_color,(anonymous function),1.0,Gadfly.default_middle_color,0.6mm,:left,:square,:right,RGB{Float64}(0.0,0.6056031366372086,0.9786801302529567),[Compose.circle,Gadfly.square,Gadfly.diamond,Gadfly.cross,Gadfly.xcross,Gadfly.utriangle,Gadfly.dtriangle,Gadfly.star1,Gadfly.star2,Gadfly.hexagon,Gadfly.octagon],2.0mm,1000,10.0,0.5,0.2,4),0)],0x0 DataFrames.DataFrame\n", + ",Data(\n", + " titles=Dict{Symbol,AbstractString}()\n", + ")\n", + ",Gadfly.ScaleElement[Gadfly.Scale.ContinuousScale([:x,:xmin,:xmax,:xintercept,:xviewmin,:xviewmax],Gadfly.Scale.ContinuousScaleTransform(identity,identity,Gadfly.Scale.identity_formatter),-31.41592653589793,31.41592653589793,2,10,nothing,nothing,true),Gadfly.Scale.ContinuousScale([:y,:ymin,:ymax,:yintercept,:middle,:upper_fence,:lower_fence,:upper_hinge,:lower_hinge,:yviewmin,:yviewmax],Gadfly.Scale.ContinuousScaleTransform(identity,identity,Gadfly.Scale.identity_formatter),-0.0,2.0,2,10,nothing,nothing,true)],Gadfly.StatisticElement[],Gadfly.Coord.Cartesian([:x,:xmin,:xmax,:xintercept],[:y,:ymin,:ymax,:yintercept,:middle,:lower_hinge,:upper_hinge,:lower_fence,:upper_fence,:outliers],-31.41592653589793,31.41592653589793,-0.0,2.0,false,false,false,nothing,false),Gadfly.GuideElement[Gadfly.Guide.ManualColorKey{ColorTypes.Color{T,N}}(\"\",AbstractString[\"y1\"],ColorTypes.Color[RGB{Float64}(0.0,0.6056031366372086,0.9786801302529567)]),Gadfly.Guide.XLabel(\"\",:auto),Gadfly.Guide.YLabel(\"\",:auto),Gadfly.Guide.Title(\"\")],Gadfly.Theme(LCHab{Float32}(70.0f0,60.0f0,240.0f0),0.9mm,0.3mm,nothing,nothing,nothing,1.0,RGBA{U8}(1.0,1.0,1.0,1.0),1.0mm,RGB{U8}(0.816,0.816,0.878),[0.5mm,0.5mm],RGB{U8}(0.627,0.627,0.627),0.2mm,\"Helvetica\",2.822222222222222mm,RGBA{U8}(0.0,0.0,0.0,1.0),\"Helvetica\",3.880555555555555mm,RGBA{U8}(0.0,0.0,0.0,1.0),\"'PT Sans Caption','Helvetica Neue','Helvetica',sans-serif\",2.822222222222222mm,RGB{U8}(0.298,0.251,0.294),\"Helvetica\",3.880555555555555mm,RGBA{U8}(0.0,0.0,0.0,1.0),\"Helvetica\",2.822222222222222mm,RGBA{U8}(0.0,0.0,0.0,1.0),40,-0.05mm,1.0mm,3.0mm,Gadfly.default_stroke_color,0.3mm,Gadfly.default_discrete_highlight_color,Gadfly.default_continuous_highlight_color,Gadfly.default_lowlight_color,0.6,Gadfly.default_middle_color,0.6mm,:left,:square,:right,nothing,[Compose.circle,Gadfly.square,Gadfly.diamond,Gadfly.cross,Gadfly.xcross,Gadfly.utriangle,Gadfly.dtriangle,Gadfly.star1,Gadfly.star2,Gadfly.hexagon,Gadfly.octagon],2.0mm,1000,10.0,0.5,0.2,4),Dict{Any,Any}()), nactions=1)" + ] + }, + "execution_count": 4, + "metadata": { + "comm_id": "bce6e728-f61d-4040-acf3-323e8e994cd8", + "reactive": true + }, + "output_type": "execute_result" + } + ], + "source": [ + "a,b = -10π,10π\n", + "u0,t=Fun(x->1/(1-0.5cos(x/2)),Laurent(PeriodicInterval(a,b))),0.0\n", + "sp=space(u0);D=Derivative(sp);H=Hilbert(sp)\n", + "L = -H*D^2\n", + "N(u,t) = -u*u'\n", + "x=Signal(u0);map(y->plot(real(y);xlims=(a,b),ylims=(-0.,2.)).o,x)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "# It moves very slowly to the right.\n", + "u0,t=ETDRK4(L,N,u0,t,0.01,200,x,1e-8);" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Benjamin-Ono equation integrable on $\\mathbb{R}$, $$u_t+uu_x+H\\{u_{xx}\\}=0$$" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false, + "scrolled": true + }, + "outputs": [ + { + "data": { + "image/svg+xml": [ + "\n", + "\n", + "\n", + " \n", + "\n", + "\n", + " \n", + " -10\n", + " -5\n", + " 0\n", + " 5\n", + " 10\n", + " \n", + " \n", + " \n", + " y1\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + " \n", + " -2\n", + " -1\n", + " 0\n", + " 1\n", + " 2\n", + " 3\n", + " 4\n", + " \n", + "\n", + "\n", + " \n", + " \n", + "\n", + "\n", + "\n" + ], + "text/html": [ + "\n", + "\n", + "\n", + " \n", + "\n", + "\n", + " \n", + " -35\n", + " -30\n", + " -25\n", + " -20\n", + " -15\n", + " -10\n", + " -5\n", + " 0\n", + " 5\n", + " 10\n", + " 15\n", + " 20\n", + " 25\n", + " 30\n", + " 35\n", + " -30\n", + " -29\n", + " -28\n", + " -27\n", + " -26\n", + " -25\n", + " -24\n", + " -23\n", + " -22\n", + " -21\n", + " -20\n", + " -19\n", + " -18\n", + " -17\n", + " -16\n", + " -15\n", + " -14\n", + " -13\n", + " -12\n", + " -11\n", + " -10\n", + " -9\n", + " -8\n", + " -7\n", + " -6\n", + " -5\n", + " -4\n", + " -3\n", + " -2\n", + " -1\n", + " 0\n", + " 1\n", + " 2\n", + " 3\n", + " 4\n", + " 5\n", + " 6\n", + " 7\n", + " 8\n", + " 9\n", + " 10\n", + " 11\n", + " 12\n", + " 13\n", + " 14\n", + " 15\n", + " 16\n", + " 17\n", + " 18\n", + " 19\n", + " 20\n", + " 21\n", + " 22\n", + " 23\n", + " 24\n", + " 25\n", + " 26\n", + " 27\n", + " 28\n", + " 29\n", + " 30\n", + " -40\n", + " -20\n", + " 0\n", + " 20\n", + " 40\n", + " -30\n", + " -28\n", + " -26\n", + " -24\n", + " -22\n", + " -20\n", + " -18\n", + " -16\n", + " -14\n", + " -12\n", + " -10\n", + " -8\n", + " -6\n", + " -4\n", + " -2\n", + " 0\n", + " 2\n", + " 4\n", + " 6\n", + " 8\n", + " 10\n", + " 12\n", + " 14\n", + " 16\n", + " 18\n", + " 20\n", + " 22\n", + " 24\n", + " 26\n", + " 28\n", + " 30\n", + " \n", + " \n", + " \n", + " y1\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + " \n", + " -9\n", + " -8\n", + " -7\n", + " -6\n", + " -5\n", + " -4\n", + " -3\n", + " -2\n", + " -1\n", + " 0\n", + " 1\n", + " 2\n", + " 3\n", + " 4\n", + " 5\n", + " 6\n", + " 7\n", + " 8\n", + " 9\n", + " 10\n", + " 11\n", + " -8.0\n", + " -7.8\n", + " -7.6\n", + " -7.4\n", + " -7.2\n", + " -7.0\n", + " -6.8\n", + " -6.6\n", + " -6.4\n", + " -6.2\n", + " -6.0\n", + " -5.8\n", + " -5.6\n", + " -5.4\n", + " -5.2\n", + " -5.0\n", + " -4.8\n", + " -4.6\n", + " -4.4\n", + " -4.2\n", + " -4.0\n", + " -3.8\n", + " -3.6\n", + " -3.4\n", + " -3.2\n", + " -3.0\n", + " -2.8\n", + " -2.6\n", + " -2.4\n", + " -2.2\n", + " -2.0\n", + " -1.8\n", + " -1.6\n", + " -1.4\n", + " -1.2\n", + " -1.0\n", + " -0.8\n", + " -0.6\n", + " -0.4\n", + " -0.2\n", + " 0.0\n", + " 0.2\n", + " 0.4\n", + " 0.6\n", + " 0.8\n", + " 1.0\n", + " 1.2\n", + " 1.4\n", + " 1.6\n", + " 1.8\n", + " 2.0\n", + " 2.2\n", + " 2.4\n", + " 2.6\n", + " 2.8\n", + " 3.0\n", + " 3.2\n", + " 3.4\n", + " 3.6\n", + " 3.8\n", + " 4.0\n", + " 4.2\n", + " 4.4\n", + " 4.6\n", + " 4.8\n", + " 5.0\n", + " 5.2\n", + " 5.4\n", + " 5.6\n", + " 5.8\n", + " 6.0\n", + " 6.2\n", + " 6.4\n", + " 6.6\n", + " 6.8\n", + " 7.0\n", + " 7.2\n", + " 7.4\n", + " 7.6\n", + " 7.8\n", + " 8.0\n", + " 8.2\n", + " 8.4\n", + " 8.6\n", + " 8.8\n", + " 9.0\n", + " 9.2\n", + " 9.4\n", + " 9.6\n", + " 9.8\n", + " 10.0\n", + " -10\n", + " -5\n", + " 0\n", + " 5\n", + " 10\n", + " -8.0\n", + " -7.5\n", + " -7.0\n", + " -6.5\n", + " -6.0\n", + " -5.5\n", + " -5.0\n", + " -4.5\n", + " -4.0\n", + " -3.5\n", + " -3.0\n", + " -2.5\n", + " -2.0\n", + " -1.5\n", + " -1.0\n", + " -0.5\n", + " 0.0\n", + " 0.5\n", + " 1.0\n", + " 1.5\n", + " 2.0\n", + " 2.5\n", + " 3.0\n", + " 3.5\n", + " 4.0\n", + " 4.5\n", + " 5.0\n", + " 5.5\n", + " 6.0\n", + " 6.5\n", + " 7.0\n", + " 7.5\n", + " 8.0\n", + " 8.5\n", + " 9.0\n", + " 9.5\n", + " 10.0\n", + " \n", + "\n", + "\n", + " \n", + " \n", + "\n", + "\n", + "\n", + "\n", + "\n" + ], + "text/plain": [ + "Signal{Gadfly.Plot}(Gadfly.Plot([Gadfly.Layer(nothing,Dict{Symbol,Any}(:y=>[0.15944,0.317074,0.471115,0.619818,0.761499,0.894551,1.01747,1.12886,1.22745,1.31214 … -1.31214,-1.22745,-1.12886,-1.01747,-0.894551,-0.761499,-0.619818,-0.471115,-0.317074,-0.15944],:x=>[-18.7625,-9.35462,-6.20676,-4.62386,-3.66689,-3.02282,-2.55749,-2.20379,-1.92446,-1.69709 … 1.69709,1.92446,2.20379,2.55749,3.02282,3.66689,4.62386,6.20676,9.35462,18.7625]),Gadfly.StatisticElement[],Gadfly.Geom.LineGeometry(Gadfly.Stat.Identity(),true,2,symbol(\"\")),Gadfly.Theme(RGBA{Float64}(0.0,0.6056031366372086,0.9786801302529567,1.0),0.9mm,0.2645502645502646mm,Any[],nothing,nothing,1.0,nothing,5.0mm,RGB{U8}(0.816,0.816,0.878),[0.5mm,0.5mm],RGB{U8}(0.627,0.627,0.627),0.2mm,\"'PT Sans Caption','Helvetica Neue','Helvetica',sans-serif\",2.822222222222222mm,RGB{U8}(0.424,0.376,0.42),\"'PT Sans','Helvetica Neue','Helvetica',sans-serif\",3.880555555555555mm,RGB{U8}(0.337,0.29,0.333),\"'PT Sans Caption','Helvetica Neue','Helvetica',sans-serif\",2.822222222222222mm,RGB{U8}(0.298,0.251,0.294),\"'PT Sans','Helvetica Neue','Helvetica',sans-serif\",3.880555555555555mm,RGB{U8}(0.212,0.165,0.208),\"'PT Sans','Helvetica Neue','Helvetica',sans-serif\",2.822222222222222mm,RGB{U8}(0.298,0.251,0.294),40,-0.05mm,1.0mm,3.0mm,Gadfly.default_stroke_color,0.3mm,Gadfly.default_discrete_highlight_color,Gadfly.default_continuous_highlight_color,(anonymous function),1.0,Gadfly.default_middle_color,0.6mm,:left,:square,:right,RGB{Float64}(0.0,0.6056031366372086,0.9786801302529567),[Compose.circle,Gadfly.square,Gadfly.diamond,Gadfly.cross,Gadfly.xcross,Gadfly.utriangle,Gadfly.dtriangle,Gadfly.star1,Gadfly.star2,Gadfly.hexagon,Gadfly.octagon],2.0mm,1000,10.0,0.5,0.2,4),0)],0x0 DataFrames.DataFrame\n", + ",Data(\n", + " titles=Dict{Symbol,AbstractString}()\n", + ")\n", + ",Gadfly.ScaleElement[Gadfly.Scale.ContinuousScale([:x,:xmin,:xmax,:xintercept,:xviewmin,:xviewmax],Gadfly.Scale.ContinuousScaleTransform(identity,identity,Gadfly.Scale.identity_formatter),-10,10,2,10,nothing,nothing,true),Gadfly.Scale.ContinuousScale([:y,:ymin,:ymax,:yintercept,:middle,:upper_fence,:lower_fence,:upper_hinge,:lower_hinge,:yviewmin,:yviewmax],Gadfly.Scale.ContinuousScaleTransform(identity,identity,Gadfly.Scale.identity_formatter),-2.0,4.0,2,10,nothing,nothing,true)],Gadfly.StatisticElement[],Gadfly.Coord.Cartesian([:x,:xmin,:xmax,:xintercept],[:y,:ymin,:ymax,:yintercept,:middle,:lower_hinge,:upper_hinge,:lower_fence,:upper_fence,:outliers],-10,10,-2.0,4.0,false,false,false,nothing,false),Gadfly.GuideElement[Gadfly.Guide.ManualColorKey{ColorTypes.Color{T,N}}(\"\",AbstractString[\"y1\"],ColorTypes.Color[RGB{Float64}(0.0,0.6056031366372086,0.9786801302529567)]),Gadfly.Guide.XLabel(\"\",:auto),Gadfly.Guide.YLabel(\"\",:auto),Gadfly.Guide.Title(\"\")],Gadfly.Theme(LCHab{Float32}(70.0f0,60.0f0,240.0f0),0.9mm,0.3mm,nothing,nothing,nothing,1.0,RGBA{U8}(1.0,1.0,1.0,1.0),1.0mm,RGB{U8}(0.816,0.816,0.878),[0.5mm,0.5mm],RGB{U8}(0.627,0.627,0.627),0.2mm,\"Helvetica\",2.822222222222222mm,RGBA{U8}(0.0,0.0,0.0,1.0),\"Helvetica\",3.880555555555555mm,RGBA{U8}(0.0,0.0,0.0,1.0),\"'PT Sans Caption','Helvetica Neue','Helvetica',sans-serif\",2.822222222222222mm,RGB{U8}(0.298,0.251,0.294),\"Helvetica\",3.880555555555555mm,RGBA{U8}(0.0,0.0,0.0,1.0),\"Helvetica\",2.822222222222222mm,RGBA{U8}(0.0,0.0,0.0,1.0),40,-0.05mm,1.0mm,3.0mm,Gadfly.default_stroke_color,0.3mm,Gadfly.default_discrete_highlight_color,Gadfly.default_continuous_highlight_color,Gadfly.default_lowlight_color,0.6,Gadfly.default_middle_color,0.6mm,:left,:square,:right,nothing,[Compose.circle,Gadfly.square,Gadfly.diamond,Gadfly.cross,Gadfly.xcross,Gadfly.utriangle,Gadfly.dtriangle,Gadfly.star1,Gadfly.star2,Gadfly.hexagon,Gadfly.octagon],2.0mm,1000,10.0,0.5,0.2,4),Dict{Any,Any}()), nactions=1)" + ] + }, + "execution_count": 6, + "metadata": { + "comm_id": "688fde5e-f6d7-49f7-88a2-8f4d846310b2", + "reactive": true + }, + "output_type": "execute_result" + } + ], + "source": [ + "a,b = -10,10\n", + "sp,spd = Laurent(PeriodicLine()),LaurentDirichlet(PeriodicLine())\n", + "u0=Fun(x->-3x/(1+x^2),spd)\n", + "H=Hilbert(spd);D=Derivative(spd);\n", + "L = -D^2*H\n", + "N(u) = -u*u'\n", + "x=Signal(u0);map(y->plot(real(y);xlims=(a,b),ylims=(-2.,4.)).o,x)" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "u0=BDF2(L,N,u0,0.01,100,x,1e-8);" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Julia 0.4.1-pre", + "language": "julia", + "name": "julia-0.4" + }, + "language_info": { + "file_extension": ".jl", + "mimetype": "application/julia", + "name": "julia", + "version": "0.4.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/src/GreensFun/CauchyWeight.jl b/src/GreensFun/CauchyWeight.jl index 29d00eb..a47a654 100644 --- a/src/GreensFun/CauchyWeight.jl +++ b/src/GreensFun/CauchyWeight.jl @@ -7,6 +7,7 @@ immutable CauchyWeight{O,SV,T,DD} <: AbstractProductSpace{SV,T,DD,2} end CauchyWeight{SV,T,DD}(space::TensorSpace{SV,T,DD,2},O) = CauchyWeight{O,SV,T,DD}(space) +CauchyWeight(domain::ProductDomain,O) = CauchyWeight(Space(domain),O) order{O}(C::CauchyWeight{O}) = O domain(C::CauchyWeight) = domain(C.space) diff --git a/src/Operators/Hilbert.jl b/src/Operators/Hilbert.jl index cf2d89a..00b010e 100644 --- a/src/Operators/Hilbert.jl +++ b/src/Operators/Hilbert.jl @@ -41,7 +41,6 @@ for Op in (:PseudoHilbert,:Hilbert,:SingularIntegral) end bandinds{s,DD}(::$ConcOp{Hardy{s,DD}})=0,0 - domainspace{s,DD}(H::$ConcOp{Hardy{s,DD}})=H.space rangespace{s,DD}(H::$ConcOp{Hardy{s,DD}})=H.space bandinds{DD}(::$ConcOp{Laurent{DD}})=0,0 @@ -49,9 +48,14 @@ for Op in (:PseudoHilbert,:Hilbert,:SingularIntegral) rangespace{DD}(H::$ConcOp{Laurent{DD}})=H.space bandinds{DD}(H::$ConcOp{Fourier{DD}})=-H.order,H.order - domainspace{DD}(H::$ConcOp{Fourier{DD}})=H.space rangespace{DD}(H::$ConcOp{Fourier{DD}})=H.space + bandinds{DD<:PeriodicInterval}(H::$ConcOp{CosSpace{DD}})=(0,1) + bandinds{DD<:PeriodicInterval}(H::$ConcOp{SinSpace{DD}})=(-1,0) + rangespace{DD<:PeriodicInterval}(H::$ConcOp{CosSpace{DD}})=SinSpace(domain(H)) + rangespace{DD<:PeriodicInterval}(H::$ConcOp{SinSpace{DD}})=CosSpace(domain(H)) + + function rangespace{DD}(H::$ConcOp{JacobiWeight{Chebyshev{DD},DD}}) @assert domainspace(H).α==domainspace(H).β==-0.5 H.order==0 ? Chebyshev(domain(H)) : Ultraspherical(H.order,domain(H)) @@ -290,6 +294,71 @@ function getindex{DD<:Circle,OT,T}(H::ConcreteSingularIntegral{Fourier{DD},OT,T} end end +## PeriodicInterval + +function getindex{DD<:PeriodicInterval,OT,T}(H::ConcreteHilbert{Taylor{DD},OT,T},k::Integer,j::Integer) + d = domain(H) + a,b = d.a,d.b + if H.order == 1 + if k>1 + if k == j + T(im) + else + zero(T) + end + else + zero(T) + end + else + error("Hilbert order $(H.order) not implemented for Taylor") + end +end + +function getindex{DD<:PeriodicInterval,OT,T}(H::ConcreteHilbert{Hardy{false,DD},OT,T},k::Integer,j::Integer) + d = domain(H) + a,b = d.a,d.b + if H.order == 1 + if k>1 + if k == j + T(-im) + else + zero(T) + end + else + zero(T) + end + else + error("Hilbert order $(H.order) not implemented for Hardy{false}") + end +end + +function getindex{DD<:PeriodicInterval,OT,T}(H::ConcreteHilbert{CosSpace{DD},OT,T},k::Integer,j::Integer) + d = domain(H) + a,b = d.a,d.b + if H.order == 1 + if k == j-1 + -one(T) + else + zero(T) + end + else + error("Hilbert order $(H.order) not implemented for CosSpace") + end +end + +function getindex{DD<:PeriodicInterval,OT,T}(H::ConcreteHilbert{SinSpace{DD},OT,T},k::Integer,j::Integer) + d = domain(H) + a,b = d.a,d.b + if H.order == 1 + if k == j+1 + one(T) + else + zero(T) + end + else + error("Hilbert order $(H.order) not implemented for CosSpace") + end +end ## JacobiWeight diff --git a/src/clustertree.jl b/src/clustertree.jl index afafc44..cc0ad38 100644 --- a/src/clustertree.jl +++ b/src/clustertree.jl @@ -3,7 +3,7 @@ export clustertree # # clustertree partitions a collection x by maximizing distances normalized by the # minimal diameter along coordinate axes in 2D. It uses complex numbers to represent -# points in the plane R². The Admissibility condition for low-rank approximants to +# points in the plane ℝ². The Admissibility condition for low-rank approximants to # asymptotically smooth kernels is: # # Adm_η(σ×τ) = min{diam(Γ_σ),diam(Γ_τ)} ≤ 2η dist(Γ_σ,Γ_τ), diff --git a/src/periodicline.jl b/src/periodicline.jl index 469b4fe..bf33c55 100644 --- a/src/periodicline.jl +++ b/src/periodicline.jl @@ -11,7 +11,7 @@ end function hilbert{L<:PeriodicLine,SS}(S::Space{SS,L},f,z::Number) S2=setdomain(S,Circle()) - hilbert(S2,f,mappoint(domain(f),Circle(),z))-hilbert(S2,f,-1) + hilbert(S2,f,mappoint(domain(S),Circle(),z))-hilbert(S2,f,-1) end diff --git a/src/stieltjesmoment.jl b/src/stieltjesmoment.jl index a357214..b7e77bb 100644 --- a/src/stieltjesmoment.jl +++ b/src/stieltjesmoment.jl @@ -28,7 +28,7 @@ stieltjesjacobimoment(α::Real,β::Real,z) = stieltjesjacobimoment(α,β,0,z) function logjacobimoment(α::Real,β::Real,n::Int,z) x = 2./(1-z) if n == 0 - 2normalization(0,α,β)*(log(z-1)-dualpart(_₂F₁(dual(zero(α)+eps(α+β),one(β)),α+1,α+β+2,x))) + 2normalization(0,α,β)*(log.(z-1)-dualpart.(_₂F₁(dual(zero(α)+eps(α+β),one(β)),α+1,α+β+2,x))) # For testing purposes only, should be equivalent to above within radius of convergence #2normalization(0,α,β)*(log(z-1)-(α+1)/(α+β+2)*x.*_₃F₂(α+2,α+β+3,x)) else diff --git a/test/logkerneltest.jl b/test/logkerneltest.jl index 5bc5c26..50d4ac2 100644 --- a/test/logkerneltest.jl +++ b/test/logkerneltest.jl @@ -1,6 +1,6 @@ using Base.Test, ApproxFun, SingularIntegralEquations import ApproxFun: ∞, testbandedoperator, testfunctional, testblockbandedoperator, testraggedbelowoperator, JacobiZ - import SingularIntegralEquations: testsies, testsieeval, stieltjesmoment, Directed, _₂F₁, ⁺, ⁻, value + import SingularIntegralEquations: testsies, testsieeval, stieltjesmoment, Directed, _₂F₁, ⁺, ⁻, value, joukowskyinverse testsieeval(Jacobi(0,0)) @@ -33,6 +33,11 @@ H=OffSingularIntegral(S,Chebyshev(3..4),0) H=OffSingularIntegral(S,Chebyshev(3..4.0+im),0) @test (H*f)(3.5+0.5im) ≈ logkernel(f,3.5+0.5im) +x = Fun() +f = chebyshevt(10)/sqrt(1-x^2) +logkernel(f,0.123+.456im) ≈ -real(joukowskyinverse(Val{true},0.123+.456im)^10)/10 +f = chebyshevt(11)/sqrt(1-x^2) +logkernel(f,0.123+.456im) ≈ -real(joukowskyinverse(Val{true},0.123+.456im)^11)/11 ## Circle diff --git a/test/runtests.jl b/test/runtests.jl index fc0d5f6..87104b7 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -31,6 +31,17 @@ for s in (true,false) end +# +# Hilbert transform on the real line for periodic functions on [a,b). +# It is involutory, so H^2*f = - f, except it zeros the constant. +# + +H = Hilbert() +f = Fun(ones(20),Laurent(PeriodicInterval())) +@test norm(H^2*f+f-1) == 0.0 +f = Fun(ones(20),Fourier(PeriodicInterval())) +@test norm(H^2*f+f-1) == 0.0 + x=Fun() @test sum(logabs(x-2.0)) ≈ logabslegendremoment(2.0) @test sum(logabs(x-(2.0+im))) ≈ logabslegendremoment(2.0+im)