julia - 2D (Fourier) Spaces with ApproxFun.jl
问题描述
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
解决方案
推荐阅读
- php - 在 WooCommerce 结帐页面中将用户地理定位的国家/地区设置为默认值
- python - 重新索引大型数据集
- c++ - C++ 从未使用过该值
- apache-nifi - 如何在 Nifi 1.9.2 和 Zookeeper 3.x 中顺利恢复节点?
- css - 仅在第一个和最后一个输入块上的边界半径
- cmake - 我可以使用 CMake 生成 Apple App Clip 项目吗?
- python - 在 ipywidgets 中显示图例的颜色框
- linux - 在带有wireguard的docker容器中,为什么我只能从docker主机访问nginx而不能远程访问?
- reactjs - Formik Yuk - 删除所需的消息
- c# - 为什么我的任务不会在 C# 控制台应用程序中运行?