0

I am looking into ApproxFun.jl mainly in order to solve PDEs (this problem here is not specific to PDE solving though). I tried around a bit with some functionality of ApproxFun in 1D that I now like to transfer to 2D. Unfortunately, it is not clear to me how to do that. The documentation is not particularly helpful.

So... I can define a space, operators and transformations in 1D easily like:

F = Fourier()
n = 512 
T = ApproxFun.plan_transform(F, n)
Ti = ApproxFun.plan_itransform(F, n)
k = points(F, n)
D = Derivative(F,1)

and so on...

But now, I don't know, how this works in 2D. First, I generate some test data

xy = zeros((100,100))
for i=1:100
   for j=1:100
     xy[i,j] = sin(2*pi*0.3*(i+j)) + 0.25*(rand() - 0.5) + sin(2*pi*0.05*i)
   end
end

I can define a 2D space with

F2D = Fourier()^2 

and the transformations with

T2D = ApproxFun.transform(F2D, length(xy))
Ti2D = ApproxFun.transform(F2D, length(xy))

Already here, I am not sure if length(xy) is the right argument. I can't define a derivative

D2D = Derivative(F2D, 1)  # results in Error: Implement Derivative .... 

as this doesn't seem to be implemented (like this). Transformations are more important to me though, but also these won't work as a

T2D*xy 

results in a

ERROR: MethodError: Cannot `convert` an object of type Float64 to an object of type Tuple{ApproxFunBase.TransformPlan{Float64,ApproxFunBase.SumSpace{Tuple{CosSpace{PeriodicSegment{Float64},Float64},SinSpace{PeriodicSegment{Float64},Float64}},PeriodicSegment{Float64},Float64},false,ApproxFunBase.TransformPlan{Float64,ApproxFunBase.SumSpace{Tuple{CosSpace{PeriodicSegment{Float64},Float64},SinSpace{PeriodicSegment{Float64},Float64}},PeriodicSegment{Float64},Float64},true,FFTW.r2rFFTWPlan{Float64,(0,),true,1}}},Int64}

Is this sort of work with 2D spaces not supported or what am I doing wrong here?

Any help is appreciated

4

0 回答 0