如何在 Maple 中使用分段边界条件求解磁盘上的 Laplace PDE?
How to solve Laplace PDE on disk with piecewise boundary condition in Maple?
windows 上的 Maple 2017.3 能够在磁盘上求解拉普拉斯偏微分方程,当边界条件 f(theta)
作为通用函数(未定义)给出时。
但是当我使用分段定义 f(theta)
时,由于某种原因它没有求解 PDE。有谁知道为什么?我做错了什么吗?
这是 MWE,显示它可以求解半径为 1 的圆盘上的偏微分方程,边界条件为通用 f(theta)
restart;
pde:= diff(u(r,theta),r)+1/r*diff(u(r,theta),r) + 1/r^2* diff(u(r,theta),theta)=0;
bc:= u(1,theta)=f(theta),
u(r,0)=u(r,2*Pi),
D[2](u)(r,0)=D[2](u)(r,2*Pi);
sol:= pdsolve([pde,bc],u(r,theta)) assuming r<=1 and theta>=0 and theta<2*Pi;
现在我改了上面的f(theta)
,给了一个具体的函数,就是分段的。现在解决不了
restart;
f:=theta->piecewise(theta>=0 and theta<=Pi,20,
theta>Pi and theta<2*Pi,0);
pde:= diff(u(r,theta),r)+1/r*diff(u(r,theta),r) + 1/r^2* diff(u(r,theta),theta)=0;
bc:= u(1,theta)=f(theta),
u(r,0)=u(r,2*Pi),
D[2](u)(r,0)=D[2](u)(r,2*Pi);
sol:= pdsolve([pde,bc],u(r,theta)) assuming r<=1 and theta>=0 and theta<2*Pi;
我是不是做错了什么?有解决办法吗?
作为参考,Mathematica 11.2 可以解决这个问题:
ClearAll[u,r,θ]
pde=D[u[r,θ],{r,2}]+1/r D[u[r,θ],r]+1/r^2 D[u[r,θ],{θ,2}]==0
bc=Piecewise[{{20,0<θ<Pi},{0,Pi<θ<2Pi}}]
sol=DSolve[{pde,u[1,θ]==bc},u[r,θ],r,θ];
sol=sol/.K[1]->n
那么为什么不从pdsolve
获取未赋值的f
的结果,然后代入piecewise
呢?
restart;
pde:= diff(u(r,theta),r)+1/r*diff(u(r,theta),r) + 1/r^2*
diff(u(r,theta),theta)=0:
bc:= u(1,theta)=f(theta),
u(r,0)=u(r,2*Pi),
D[2](u)(r,0)=D[2](u)(r,2*Pi):
sol:= rhs(pdsolve([pde,bc],u(r,theta)))
assuming r<=1 and theta>=0 and theta<2*Pi:
lprint(sol);
(1/2)*(2*(Sum(r^n*((Int(f(theta)*sin(n*theta), theta = 0 ..
2*Pi))*sin(n*theta)+(Int(f(theta)*cos(n*theta), theta = 0 ..
2*Pi))*cos(n*theta))/Pi, n = 1 .. infinity))*Pi+Int(f(theta), theta = 0 .. 2*Pi))/Pi
F:=theta->piecewise(theta>=0 and theta<=Pi,20,
theta>Pi and theta<2*Pi,0):
下面我们将使用 subs(f=(F),sol)
作为 pde 解决方案,分段 F
代替未分配的名称 f
.
让我们在特定点计算 sol
。
sol_spec:=simplify(combine(eval(subs(f=(F),sol),[r=1/2,theta=Pi/3]))):
value(sol_spec): # symbolic summation and symbolic integration
lprint(%);
(1/2)*((80/3)*Pi+40*arctan((1/5)*3^(1/2)))/Pi
evalf(%);
15.45628948
evalf(sol_spec); # numeric summation and numeric integration
15.51328895
我们可以解决sol
中的积分并获得求和形式(如Mma所声称的那样)。
T:=subs(f=F,subsindets(sol,specfunc(Int),IntegrationTools:-Split,Pi)):
ans:=simplify(eval(T,Int=int)):
lprint(%);
10+Sum(20*sin(n*theta)*(r^n-(-r)^n)/(n*Pi), n = 1 .. infinity)
在与之前相同的特定点进行评估。
ans_spec:=(eval(ans,[r=1/2,theta=Pi/3])):
value(ans_spec): # symbolic summation
lprint(%);
40/3+20*arctan((1/5)*3^(1/2))/Pi
evalf(%);
15.45628948
evalf(ans_spec); # numeric summation
15.51328895
我们甚至可以在 r
和 theta
.
的某些条件下获得求和的封闭形式
huh:=evalc(subsindets(ans,specfunc(Sum),
u->sum(op(u),formal)))
assuming r>0, r<1, theta>0, theta<Pi:
lprint(huh);
10+20*arctan(sin(theta)*r/(1-cos(theta)*r))/Pi+20*arctan(sin(theta)*r/(1+cos(theta)*r))/Pi
eval(huh,[r=1/2,theta=Pi/3]):
lprint(%);
40/3+20*arctan((1/5)*3^(1/2))/Pi
evalf(%);
15.45628948
请注意,在组合成对的符号 arctan
调用时存在错误(已报告),这使我无法在上面的 huh
中简化或组合它们。这不会影响上述结果。
windows 上的 Maple 2017.3 能够在磁盘上求解拉普拉斯偏微分方程,当边界条件 f(theta)
作为通用函数(未定义)给出时。
但是当我使用分段定义 f(theta)
时,由于某种原因它没有求解 PDE。有谁知道为什么?我做错了什么吗?
这是 MWE,显示它可以求解半径为 1 的圆盘上的偏微分方程,边界条件为通用 f(theta)
restart;
pde:= diff(u(r,theta),r)+1/r*diff(u(r,theta),r) + 1/r^2* diff(u(r,theta),theta)=0;
bc:= u(1,theta)=f(theta),
u(r,0)=u(r,2*Pi),
D[2](u)(r,0)=D[2](u)(r,2*Pi);
sol:= pdsolve([pde,bc],u(r,theta)) assuming r<=1 and theta>=0 and theta<2*Pi;
现在我改了上面的f(theta)
,给了一个具体的函数,就是分段的。现在解决不了
restart;
f:=theta->piecewise(theta>=0 and theta<=Pi,20,
theta>Pi and theta<2*Pi,0);
pde:= diff(u(r,theta),r)+1/r*diff(u(r,theta),r) + 1/r^2* diff(u(r,theta),theta)=0;
bc:= u(1,theta)=f(theta),
u(r,0)=u(r,2*Pi),
D[2](u)(r,0)=D[2](u)(r,2*Pi);
sol:= pdsolve([pde,bc],u(r,theta)) assuming r<=1 and theta>=0 and theta<2*Pi;
我是不是做错了什么?有解决办法吗?
作为参考,Mathematica 11.2 可以解决这个问题:
ClearAll[u,r,θ]
pde=D[u[r,θ],{r,2}]+1/r D[u[r,θ],r]+1/r^2 D[u[r,θ],{θ,2}]==0
bc=Piecewise[{{20,0<θ<Pi},{0,Pi<θ<2Pi}}]
sol=DSolve[{pde,u[1,θ]==bc},u[r,θ],r,θ];
sol=sol/.K[1]->n
那么为什么不从pdsolve
获取未赋值的f
的结果,然后代入piecewise
呢?
restart;
pde:= diff(u(r,theta),r)+1/r*diff(u(r,theta),r) + 1/r^2*
diff(u(r,theta),theta)=0:
bc:= u(1,theta)=f(theta),
u(r,0)=u(r,2*Pi),
D[2](u)(r,0)=D[2](u)(r,2*Pi):
sol:= rhs(pdsolve([pde,bc],u(r,theta)))
assuming r<=1 and theta>=0 and theta<2*Pi:
lprint(sol);
(1/2)*(2*(Sum(r^n*((Int(f(theta)*sin(n*theta), theta = 0 ..
2*Pi))*sin(n*theta)+(Int(f(theta)*cos(n*theta), theta = 0 ..
2*Pi))*cos(n*theta))/Pi, n = 1 .. infinity))*Pi+Int(f(theta), theta = 0 .. 2*Pi))/Pi
F:=theta->piecewise(theta>=0 and theta<=Pi,20,
theta>Pi and theta<2*Pi,0):
下面我们将使用 subs(f=(F),sol)
作为 pde 解决方案,分段 F
代替未分配的名称 f
.
让我们在特定点计算 sol
。
sol_spec:=simplify(combine(eval(subs(f=(F),sol),[r=1/2,theta=Pi/3]))):
value(sol_spec): # symbolic summation and symbolic integration
lprint(%);
(1/2)*((80/3)*Pi+40*arctan((1/5)*3^(1/2)))/Pi
evalf(%);
15.45628948
evalf(sol_spec); # numeric summation and numeric integration
15.51328895
我们可以解决sol
中的积分并获得求和形式(如Mma所声称的那样)。
T:=subs(f=F,subsindets(sol,specfunc(Int),IntegrationTools:-Split,Pi)):
ans:=simplify(eval(T,Int=int)):
lprint(%);
10+Sum(20*sin(n*theta)*(r^n-(-r)^n)/(n*Pi), n = 1 .. infinity)
在与之前相同的特定点进行评估。
ans_spec:=(eval(ans,[r=1/2,theta=Pi/3])):
value(ans_spec): # symbolic summation
lprint(%);
40/3+20*arctan((1/5)*3^(1/2))/Pi
evalf(%);
15.45628948
evalf(ans_spec); # numeric summation
15.51328895
我们甚至可以在 r
和 theta
.
huh:=evalc(subsindets(ans,specfunc(Sum),
u->sum(op(u),formal)))
assuming r>0, r<1, theta>0, theta<Pi:
lprint(huh);
10+20*arctan(sin(theta)*r/(1-cos(theta)*r))/Pi+20*arctan(sin(theta)*r/(1+cos(theta)*r))/Pi
eval(huh,[r=1/2,theta=Pi/3]):
lprint(%);
40/3+20*arctan((1/5)*3^(1/2))/Pi
evalf(%);
15.45628948
请注意,在组合成对的符号 arctan
调用时存在错误(已报告),这使我无法在上面的 huh
中简化或组合它们。这不会影响上述结果。