-
Notifications
You must be signed in to change notification settings - Fork 3
/
rtest_pdefourier.mac
127 lines (87 loc) · 4.82 KB
/
rtest_pdefourier.mac
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
(kill(all),0);
0$
(load("pdefourier.mac"), 0);
0$
(
declare(L,constant),
assume(t>0,L>0,c>0),
absolute0(x):=if ( x>=-1 and x<=0) then -x elseif (x>0 and x<=1) then x,
v(x):=if (-%pi<=x and x<0) then x^2 elseif (0<=x and x<=%pi) then sin(3*x),
f1(x):=if (0<=x and x<L) then A elseif (L<=x and x<=2*L) then 0,
g(%theta):=if (-%pi<=%theta and %theta<0) then 1+%theta/%pi elseif (0<=%theta and %theta<=%pi) then 1-%theta/%pi,
'done
);
'done$
/*Fourier coefficients*/
fouriercoeff(sin(3*x)+cos(7*x),x,%pi);
[[0,0,0],[[3,0,1],[7,1,0]]]$
fouriercoeff(x^2+1,x,1);
[[4/3,(4*(-1)^n)/(%pi^2*n^2),0],[]]$
fouriercoeff(v(x),x,%pi);
[[(%pi^3+2)/(6*%pi),(((2*%pi-3)*n^2-18*%pi)*(-1)^n-3*n^2)/(%pi*n^2*(n^2-9)),((%pi^2*n^2-2)*(-1)^n+2)/(%pi*n^3)],[[3,-2/9,-((18*%pi^2-27*%pi-8)/(54*%pi))]]]$
fouriercoeff(absolute0(x),x,1);
[[1/2,(2*((-1)^n-1))/(%pi^2*n^2),0],[]]$
fouriercoeff(f1(x),x,L);
[[A/2,0,-((A*((-1)^n-1))/(%pi*n))],[]]$
fouriersincoeff(cos(x),x,%pi);
[[(2*n*((-1)^n+1))/(%pi*(n^2-1))],[[1,0]]]$
cfouriercoeff(g(%theta),%theta,%pi);
[[1/2,-(((-1)^n-1)/(%pi^2*n^2))],[]]$
fouriercoscoeff(x^3,x,L);
[[L^3/4,(6*L^3*((%pi^2*n^2-2)*(-1)^n+2))/(%pi^4*n^4)],[]]$
/*Fourier series*/
fourier_series(absolute0(x),x,1,inf);
(2*sum((((-1)^n-1)*cos(%pi*n*x))/n^2,n,1,inf))/%pi^2+1/2$
fourier_series(x^2*cos(4*x),x,%pi,inf);
4*(sum(((n^2+16)*(-1)^n*cos(n*x))/(n^4-32*n^2+256),n,1,inf))+((32*%pi^2+3)*cos(4*x))/96+1/8$
fouriercos_series(L-x,x,L,inf);
L/2-(2*L*sum((((-1)^n-1)*cos((%pi*n*x)/L))/n^2,n,1,inf))/%pi^2$
fouriersin_series(1+x^2,x,L,inf);
-((2*sum((((%pi^2*(L^2+1)*n^2-2*L^2)*(-1)^n-%pi^2*n^2+2*L^2)*sin((%pi*n*x)/L))/n^3,n,1,inf))/%pi^3)$
/*PDEs*/
dirichlet_heat(sin(x)+x/%pi+exp(-t)*(x/%pi -1),0,exp(-t),t,x,t,%pi,1,inf);
-(2*sum((%e^(-n^2*t)*sin(n*x))/n,n,1,inf))/%pi+
(%e^(-t)*(%pi*%e^t-%pi-2)*sin(x))/%pi-((%e^(-t)-t)*x)/%pi+%e^(-t)$
dirichlet_wave(0,0,0,sin(t),0,x,t,1,1,inf);
-(sum(((2*%pi*n*sin(%pi*n*t)-2*sin(t))*sin(%pi*n*x))/(%pi^3*n^3-%pi*n),n,1,inf))-sin(t)*x+sin(t)$
neumann_heat(t,1+3*cos(4*%pi*x),0,0,x,t,1,1,inf);
3*%e^(-16*%pi^2*t)*cos(4*%pi*x)+t^2/2+1$
neumann_wave(0,3*cos(x),1-cos(4*x),0,0,x,t,%pi,2,inf);
-(sin(8*t)*cos(4*x))/8+3*cos(2*t)*cos(x)+t$
neumann_wave((1-x)*cos(t),x^2/(2*%pi),cos(3*x),cos(t)-1,cos(t),x,t,%pi,2,inf);
(sin(6*t)*cos(3*x))/6+x^2/(2*%pi)+(cos(t)-1)*x-cos(t)+(2*t^2)/%pi+1$
dirichlet_laplace_rectangle(1,1,0,T*x*(1-x),0,0,x,y,inf);
-(4*T*sum((((-1)^n-1)*sin(%pi*n*x)*sinh(%pi*n*y))/(n^3*sinh(%pi*n)),n,1,inf))/%pi^3$
dirichlet_laplace_disk(1,g(%theta),%theta,inf);
1/2-(sum((((-1)^n-1)*r^abs(n)*%e^(%i*n*%theta))/n^2,n,minf,inf)/%pi^2)$
dirichlet_laplace_disk(1,sin(5*%theta)^2+cos(2*%theta),%theta,10);
-((r^10*cos(10*%theta)-2*r^2*cos(2*%theta)-1)/2)$
dirichlet_laplace_annulus(1,2,(cos(%theta))^2,0,%theta,4);
(15*r^2*log(r)+4*log(2)*cos(2*%theta)*r^4-4*log(2)*cos(2*%theta))/(30*log(2)*r^2)$
dirichlet_laplace_wedge(R,%pi/2,cos(4*%theta),%theta,inf);
-((2*sum((n*((-1)^n-1)*(r/R)^(2*n)*sin(2*n*%theta))/(n^2-4),n,1,inf))/%pi)$
dirichlet_laplace_wedge(1,%pi/2,sin(2*%theta),%theta,inf);
r^2*sin(2*%theta)$
neumann_laplace_wedge(R,%pi/2,cos(4*%theta),%theta,inf);
-((R*sum((((-1)^n-1)*(r/R)^(2*n)*sin(2*n*%theta))/(n^2-4),n,1,inf))/%pi)$
mixed_heat(0,x,1,0,0,1,0,0,x,t,L,1,inf);
-((8*L*sum(((-1)^n*%e^(-(%pi^2*(2*n-1)^2*t)/(4*L^2))*sin((%pi*(2*n-1)*x)/(2*L)))/(2*n-1)^2,n,1,inf))/%pi^2)$
mixed_heat(0,T[1],1,0,1,1,T[1],T[2],x,t,1,1,inf);
(T[1]-T[2])*
(sum(((sin(%lambda[n])-%lambda[n]*cos(%lambda[n]))*%e^(-%lambda[n]^2*t)*sin(%lambda[n]*x))/(%lambda[n]^2*(cos(%lambda[n])^2+1)),n,1,inf))+((T[2]-T[1])*x)/2+T[1]$
mixed_heat(0,100*x*(1-x),0,1,0,1,0,0,x,t,1,1/4,inf);
50/3-((200*sum((((-1)^n+1)*%e^(-(%pi^2*n^2*t)/4)*cos(%pi*n*x))/n^2,n,1,inf))/%pi^2)$
mixed_heat(0,f(x),1,1,1,1,0,0,x,t,L,k,inf);
2*sum((%e^(-(%pi^2*k*n^2*t)/L^2)*(sin((%pi*n*x)/L)-(%pi*n*cos((%pi*n*x)/L))/L)*integrate(f(x)*(L*sin((%pi*n*x)/L)+%pi*n*cos((%pi*n*x)/L)),x,0,L))/(%pi^2*n^2+L^2),n,1,inf)$
mixed_heat(0,f(x),1,0,0,1,A,B,x,t,L,k,inf);
(2*sum(%e^(-(%pi^2*k*(2*n-1)^2*t)/(4*L^2))*sin((%pi*(2*n-1)*x)/(2*L))*integrate((f(x)-B*x-A)*sin((%pi*(2*n-1)*x)/(2*L)),x,0,L),n,1,inf))/L+B*x+A$
mixed_heat(cos(w*t),x,0,1,0,1,0,0,x,t,L,k,inf);
(2*L*sum((((-1)^n-1)*%e^(-(%pi^2*k*n^2*t)/L^2)*cos((%pi*n*x)/L))/n^2,n,1,inf))/%pi^2+sin(t*w)/w+L/2$
mixed_heat(1+x*cos(t),1+cos(2*%pi*x),0,1,0,1,sin(t),sin(t),x,t,1,1,inf);
%e^(-4*%pi^2*t)*cos(2*%pi*x)+sin(t)*x+t+1$
mixed_wave(a*x,0,0,1,0,1,0,0,0,x,t,L,c,inf);
sum(((2*L^3*a*(-1)^n*cos((%pi*c*n*t)/L)-2*L^3*a*(-1)^n)*sin((%pi*n*x)/L))/n^3,n,1,inf)/(%pi^3*c^2)$
mixed_wave(x*exp(-t),0,1,1,0,1,0,0,0,x,t,1,1,inf);
-%e^(-t)*sum(((((2*%pi^2*n^2+4)*(-1)^n-2*%pi^2*n^2-2)*%e^t*sin(%pi*n*t)-2*%pi*n*(-1)^n*%e^t*cos(%pi*n*t)+2*%pi*n*(-1)^n)*sin(%pi*n*x))/(%pi^4*n^4+%pi^2*n^2),n,1,inf)$
mixed_wave(0,f(x),0,1,0,0,1,0,0,x,t,L,c,inf);
(2*sum(cos((%pi*c*(2*n-1)*t)/(2*L))*sin((%pi*(2*n-1)*x)/(2*L))*integrate(f(x)*sin((%pi*(2*n-1)*x)/(2*L)),x,0,L),n,1,inf))/L$