23
23
# For the storage pattern of the arrays, please consult the
24
24
# [documentation](https://MikaelSlevinsky.github.io/FastTransforms).
25
25
26
- using FastTransforms, LinearAlgebra
26
+ using FastTransforms, LinearAlgebra, Plots
27
+ const GENFIGS = joinpath (dirname (dirname (pathof (FastTransforms))), " docs/src/generated" )
28
+ ! isdir (GENFIGS) && mkdir (GENFIGS)
29
+ plotlyjs ()
27
30
28
31
# Our function $f$ and the Cartesian components of its gradient:
29
32
f = (x,y) -> 1 / (1 + x^ 2 + y^ 2 )
30
33
fx = (x,y) -> - 2 x/ (1 + x^ 2 + y^ 2 )^ 2
31
34
fy = (x,y) -> - 2 y/ (1 + x^ 2 + y^ 2 )^ 2
32
35
33
36
# The polynomial degree:
34
- N = 10
37
+ N = 15
35
38
M = N
36
39
37
40
# The parameters of the Proriol series:
@@ -56,6 +59,16 @@ w = [sinpi((2M-2m-1)/(4M))^2 for m in 0:M-1]
56
59
# On the mapped tensor product grid, our function samples are:
57
60
F = [f (x[n+ 1 ], x[N- n]* w[m+ 1 ]) for n in 0 : N- 1 , m in 0 : M- 1 ]
58
61
62
+ # We superpose a surface plot of $f$ on top of the grid:
63
+ X = [x for x in x, w in w]
64
+ Y = [x[N- n]* w[m+ 1 ] for n in 0 : N- 1 , m in 0 : M- 1 ]
65
+ scatter3d (vec (X), vec (Y), vec (0 F); markersize= 0.75 , markercolor= :green , size= (800 , 600 ))
66
+ surface! (X, Y, F; legend= false , xlabel= " x" , ylabel= " y" , zlabel= " f" )
67
+ savefig (joinpath (GENFIGS, " proriol.html" ))
68
+ # ##```@raw html
69
+ # ##<object type="text/html" data="../proriol.html" style="width:100%;height:600px;"></object>
70
+ # ##```
71
+
59
72
# We precompute a Proriol--Chebyshev² plan:
60
73
P = plan_tri2cheb (F, α, β, γ)
61
74
0 commit comments