Skip to content

Commit 03125d3

Browse files
committed
Add padua points example
1 parent 9b47598 commit 03125d3

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

examples/padua.jl

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#############
2+
# This demonstrates the Padua transform and inverse transform,
3+
# explaining precisely the normalization and points
4+
#############
5+
6+
using FastTransforms
7+
8+
N = 15
9+
pts = paduapoints(N)
10+
x = pts[:,1]; y = pts[:,2]
11+
12+
f = (x,y) -> exp(x + cos(y))
13+
= paduatransform(f.(x , y))
14+
= (x,y) -> begin
15+
j = 1
16+
ret = 0.0
17+
for n in 0:N, k in 0:n
18+
ret += f̌[j]*cos((n-k)*acos(x)) * cos(k*acos(y))
19+
j += 1
20+
end
21+
ret
22+
end
23+
24+
(0.1,0.2) f(0.1,0.2)
25+
26+
ipaduatransform(f̌) .(x,y)

0 commit comments

Comments
 (0)