aboutsummaryrefslogtreecommitdiff
path: root/src/GeneralizedPolynomial-Uniform/Lagrange-maximum-degree/1d.maple
blob: cdf1494a8f826909a3e771b3c0909274986041c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# 1d.maple -- compute Lagrange interpolation coefficients in 1-D
# $Header$

################################################################################

#
# 1d, cube, order=1, smoothing=0 (size=2)
#

# interpolating polynomial
interp_1d_cube_order1_smooth0
	:= Lagrange_polynomial_interpolant(fn_1d_order1, coeffs_list_1d_order1,
					   coords_list_1d, posn_list_1d_size2);

# I
coeffs_as_lc_of_data(%, posn_list_1d_size2);
print_coeffs__lc_of_data(%, "coeffs_I->coeff_", "fp",
			 "1d.coeffs/1d.cube.order1.smooth0/coeffs-I.compute.c");

# d/dx
simplify( diff(interp_1d_cube_order1_smooth0,x) );
coeffs_as_lc_of_data(%, posn_list_1d_size2);
print_coeffs__lc_of_data(%, "coeffs_dx->coeff_", "fp",
			 "1d.coeffs/1d.cube.order1.smooth0/coeffs-dx.compute.c");

################################################################################

#
# 1d, cube, order=2, smoothing=0 (size=3)
#

# interpolating polynomial
interp_1d_cube_order2_smooth0
	:= Lagrange_polynomial_interpolant(fn_1d_order2, coeffs_list_1d_order2,
					   coords_list_1d, posn_list_1d_size3);

# I
coeffs_as_lc_of_data(%, posn_list_1d_size3);
print_coeffs__lc_of_data(%, "coeffs_I->coeff_", "fp",
			 "1d.coeffs/1d.cube.order2.smooth0/coeffs-I.compute.c");

# d/dx
simplify( diff(interp_1d_cube_order2_smooth0,x) );
coeffs_as_lc_of_data(%, posn_list_1d_size3);
print_coeffs__lc_of_data(%, "coeffs_dx->coeff_", "fp",
			 "1d.coeffs/1d.cube.order2.smooth0/coeffs-dx.compute.c");

# d^2/dx^2
simplify( diff(interp_1d_cube_order2_smooth0,x,x) );
coeffs_as_lc_of_data(%, posn_list_1d_size3);
print_coeffs__lc_of_data(%, "coeffs_dxx->coeff_", "fp",
			 "1d.coeffs/1d.cube.order2.smooth0/coeffs-dxx.compute.c");

################################################################################

#
# 1d, cube, order=3, smoothing=0 (size=4)
#

# interpolating polynomial
interp_1d_cube_order3_smooth0
	:= Lagrange_polynomial_interpolant(fn_1d_order3, coeffs_list_1d_order3,
					   coords_list_1d, posn_list_1d_size4);

# I
coeffs_as_lc_of_data(%, posn_list_1d_size4);
print_coeffs__lc_of_data(%, "coeffs_I->coeff_", "fp",
			"1d.coeffs/1d.cube.order3.smooth0/coeffs-I.compute.c");

# d/dx
simplify( diff(interp_1d_cube_order3_smooth0,x) );
coeffs_as_lc_of_data(%, posn_list_1d_size4);
print_coeffs__lc_of_data(%, "coeffs_dx->coeff_", "fp",
			"1d.coeffs/1d.cube.order3.smooth0/coeffs-dx.compute.c");

# d^2/dx^2
simplify( diff(interp_1d_cube_order3_smooth0,x,x) );
coeffs_as_lc_of_data(%, posn_list_1d_size4);
print_coeffs__lc_of_data(%, "coeffs_dxx->coeff_", "fp",
			"1d.coeffs/1d.cube.order3.smooth0/coeffs-dxx.compute.c");

################################################################################

#
# 1d, cube, order=4, smoothing=0 (size=5)
#

# interpolating polynomial
interp_1d_cube_order4_smooth0
	:= Lagrange_polynomial_interpolant(fn_1d_order4, coeffs_list_1d_order4,
					   coords_list_1d, posn_list_1d_size5);

# I
coeffs_as_lc_of_data(%, posn_list_1d_size5);
print_coeffs__lc_of_data(%, "coeffs_I->coeff_", "fp",
			"1d.coeffs/1d.cube.order4.smooth0/coeffs-I.compute.c");

# d/dx
simplify( diff(interp_1d_cube_order4_smooth0,x) );
coeffs_as_lc_of_data(%, posn_list_1d_size5);
print_coeffs__lc_of_data(%, "coeffs_dx->coeff_", "fp",
			"1d.coeffs/1d.cube.order4.smooth0/coeffs-dx.compute.c");

# d^2/dx^2
simplify( diff(interp_1d_cube_order4_smooth0,x,x) );
coeffs_as_lc_of_data(%, posn_list_1d_size5);
print_coeffs__lc_of_data(%, "coeffs_dxx->coeff_", "fp",
			"1d.coeffs/1d.cube.order4.smooth0/coeffs-dxx.compute.c");

################################################################################

#
# 1d, cube, order=5, smoothing=0 (size=6)
#

# interpolating polynomial
interp_1d_cube_order5_smooth0
	:= Lagrange_polynomial_interpolant(fn_1d_order5, coeffs_list_1d_order5,
					   coords_list_1d, posn_list_1d_size6);

# I
coeffs_as_lc_of_data(%, posn_list_1d_size6);
print_coeffs__lc_of_data(%, "coeffs_I->coeff_", "fp",
			"1d.coeffs/1d.cube.order5.smooth0/coeffs-I.compute.c");

# d/dx
simplify( diff(interp_1d_cube_order5_smooth0,x) );
coeffs_as_lc_of_data(%, posn_list_1d_size6);
print_coeffs__lc_of_data(%, "coeffs_dx->coeff_", "fp",
			"1d.coeffs/1d.cube.order5.smooth0/coeffs-dx.compute.c");

# d^2/dx^2
simplify( diff(interp_1d_cube_order5_smooth0,x,x) );
coeffs_as_lc_of_data(%, posn_list_1d_size6);
print_coeffs__lc_of_data(%, "coeffs_dxx->coeff_", "fp",
			"1d.coeffs/1d.cube.order5.smooth0/coeffs-dxx.compute.c");

################################################################################

#
# 1d, cube, order=6, smoothing=0 (size=7)
#

# interpolating polynomial
interp_1d_cube_order6_smooth0
	:= Lagrange_polynomial_interpolant(fn_1d_order6, coeffs_list_1d_order6,
					   coords_list_1d, posn_list_1d_size7);

# I
coeffs_as_lc_of_data(%, posn_list_1d_size7);
print_coeffs__lc_of_data(%, "coeffs_I->coeff_", "fp",
			"1d.coeffs/1d.cube.order6.smooth0/coeffs-I.compute.c");

# d/dx
simplify( diff(interp_1d_cube_order6_smooth0,x) );
coeffs_as_lc_of_data(%, posn_list_1d_size7);
print_coeffs__lc_of_data(%, "coeffs_dx->coeff_", "fp",
			"1d.coeffs/1d.cube.order6.smooth0/coeffs-dx.compute.c");

# d^2/dx^2
simplify( diff(interp_1d_cube_order6_smooth0,x,x) );
coeffs_as_lc_of_data(%, posn_list_1d_size7);
print_coeffs__lc_of_data(%, "coeffs_dxx->coeff_", "fp",
			"1d.coeffs/1d.cube.order6.smooth0/coeffs-dxx.compute.c");

################################################################################