|
1 |
| -using Revise, ApproxFun, MultivariateOrthogonalPolynomials |
| 1 | +using Revise |
| 2 | +using ApproxFun, MultivariateOrthogonalPolynomials |
2 | 3 | import MultivariateOrthogonalPolynomials: checkerboard, icheckerboard, CDisk2CxfPlan
|
3 | 4 | import ApproxFunBase: totensor
|
4 | 5 | import ApproxFunOrthogonalPolynomials: jacobip
|
5 | 6 |
|
6 | 7 |
|
7 |
| - |
8 | 8 | function chebydiskeval(c::AbstractMatrix{T}, r, θ) where T
|
9 | 9 | ret = zero(T)
|
10 | 10 | for j = 1:2:size(c,2), k=1:size(c,1)
|
|
52 | 52 | P = CDisk2CxfPlan(n)
|
53 | 53 | d = P \ c
|
54 | 54 | @test d ≈ [1/sqrt(2)]
|
| 55 | + |
55 | 56 | f = Fun((x,y) -> y, ChebyshevDisk()); n = 2;
|
56 | 57 | c = totensor(f.space, f.coefficients)
|
57 | 58 | c = pad(c, n, 4n-3)
|
|
80 | 81 | @test d[2,5] ≈ 1
|
81 | 82 | end
|
82 | 83 | @testset "different m and ℓ" begin
|
83 |
| - for (m,ℓ) in ((0,2), (1,1), (2,2), (2,6), (3,3)) |
| 84 | + for (m,ℓ) in ((0,0), (0,2), (1,1), (2,2), (2,6), (3,3)) |
84 | 85 | p1 = (r,θ) -> sqrt(2ℓ+2)*r^m*jacobip((ℓ-m)÷2, 0, m, 2r^2-1)*cos(m*θ)/sqrt(π)
|
85 | 86 | f = Fun((x,y) -> p1(sqrt(x^2+y^2), atan(y,x)), ChebyshevDisk());
|
86 | 87 | @test f(0.1*cos(0.2),0.1*sin(0.2)) ≈ p1(0.1,0.2)
|
|
99 | 100 | end
|
100 | 101 | end
|
101 | 102 |
|
| 103 | +@testset "ChebyshevDisk-ZernikeDisk" begin |
| 104 | + @test coefficients([sqrt(2/π)], ChebyshevDisk(), ZernikeDisk()) ≈ [1.0] |
| 105 | + @test coefficients([1.0], ZernikeDisk(), ChebyshevDisk()) ≈ [sqrt(2/π)] |
| 106 | +end |
| 107 | + |
| 108 | +@testset "ZernikeDisk" begin |
| 109 | + f = Fun((x,y) -> 1, ZernikeDisk(), 10) |
| 110 | + @test f(0.1,0.2) ≈ 1.0 |
| 111 | + f = Fun((x,y) -> 1, ZernikeDisk()) |
| 112 | + @test f(0.1,0.2) ≈ 1.0 |
| 113 | + f = Fun((x,y) -> exp(x*cos(y-0.1)), ZernikeDisk()) |
| 114 | + @test f(0.1,0.2) ≈ exp(0.1*cos(0.1)) |
| 115 | +end |
0 commit comments