ODE为y'' + lam * y(x)=0
,其中包含BC y'(0)-y(0)=0
和y'(1)=0
。
Maple dsolve
仅提供简单的解决方案y(x)=0
。人们怎么能要求Maple提供Mathematica默认的非平凡解决方案呢?
这就是我试过的
ode:= diff(y(x),x$2)+ lambda*y(x)=0;
bc:=D(y)(0) - y(0)=0, D(y)(1)=0;
dsolve({ode,bc},y(x));
在Windows 7上的Maple 2017.3上给出y(x)=0
。
虽然Mathematica上的相同命令给出了
ClearAll[y,x,lam];
DSolve[{y''[x]+lam y[x]==0,y'[0]-y[0]==0,y'[1]==0},y[x],x]
手动解决这个问题是正确的。
Maple是否具有单独的特征值边界值dsolver?需要单独包装吗?我试图通过键入assuming(lambda>0)
来帮助Maple,但它没有什么区别。
我确信Maple可以做到这一点,因为我知道Maple在微分方程中非常强大,我只需要正确的选项或命令来完成它。
答案 0 :(得分:2)
这不是自动生成的分段结果。
第二次调用solve
涉及解决cos(lambda^(1/2))
而不是简单的名称。 (求解lambda
会产生RootOf
,并且处理任何替换似乎都很尴尬。)
但是这里有一些东西。 (我希望有更好的方式......)
restart;
ans:=dsolve({diff(diff(y(x),x),x)+lambda*y(x) = 0,
D(y)(0)=K, D(y)(1) = 0},y(x)):
ans:=collect(ans,K); # for beauty's sake
/ 1/2 1/2 1/2 \
|sin(lambda x) cos(lambda ) cos(lambda x)|
ans := y(x) = |---------------- + -------------------------------| K
| 1/2 1/2 1/2 |
\ lambda lambda sin(lambda ) /
solve(eval(subs(x=0,y(0)=K,ans)),{K});
{K = 0}
eval(ans, %);
y(x) = 0
eqn:=solve(eval(subs(x=0,y(0)=K,ans)),{cos(lambda^(1/2))});
1/2 1/2 1/2
eqn := {cos(lambda ) = lambda sin(lambda )}
eval(ans,eqn);
/ 1/2 \
|sin(lambda x) 1/2 |
y(x) = |---------------- + cos(lambda x)| K
| 1/2 |
\ lambda /
[编辑:如果您对lambda的真实价值感兴趣,那么这里还有别的东西。]
restart;
de := diff(diff(y(x),x),x) + lambda*y(x) = 0:
bcs := D(y)(0) = K, D(y)(1) = 0:
ans := dsolve({de,bcs}, y(x)):
ans := collect(ans, K);
/ / (1/2) \
|sin\lambda x/
ans := y(x) = |------------------
| (1/2)
\ lambda
/ (1/2)\ / (1/2) \\
cos\lambda / cos\lambda x/|
+ -----------------------------------| K
(1/2) / (1/2)\ |
lambda sin\lambda / /
# The following equation must hold in order that your
# original boundary condition D(y)(0) = y(0) holds.
eqn := eval(subs(x=0, y(0)=K,ans));
/ (1/2)\
K cos\lambda /
eqn := K = ----------------------------
(1/2) / (1/2)\
lambda sin\lambda /
spec := [solve(eqn)];
[
[
[
spec := [{K = 0, lambda = lambda},
[
/ 2\ ]
| / (1/2) \ | ]
< | / 2\ | >]
|K = K, lambda = RootOf\tan(_Z) \_Z / - 1/ | ]
\ / ]
all_spec := map(allvalues, spec):
# Select only those elements of `all_spec` which satisfy `eqn`.
# (One of the float RootOfs returned by `allvalues` doesn't
# satisfy `eqn` above.
all_spec := select(u->is(simplify(fnormal(evalf[20](eval((rhs-lhs)(eqn),u))),
zero)
= 0),
all_spec):
map(print, all_spec):
{K = 0, lambda = lambda}
/ 2\
| / (1/2) \ |
< | / 2\ | >
|K = K, lambda = RootOf\tan(_Z) \_Z / - 1, 0.8603335890/ |
\ /
/ 2\
| / (1/2) \ |
< | / 2\ | >
|K = K, lambda = RootOf\tan(_Z) \_Z / - 1, 3.425618459/ |
\ /
# These below are the mentioned solutions, using the above RootOf's
# having so-called "float descriptors", which means they can
# be further approximated to arbitrary precision using `evalf`.
p_sols := {seq([eval(ans, K=eval(K,all_spec[i])),
[lambda=eval(lambda,all_spec[i])]],
i=1..nops(all_spec))}:
#map(print, p_sols):
# For fun, now approximate using default precision.
fp_sols := evalf(p_sols):
seq(print(eval(fp_sols[i][1], fp_sols[i][2])), i=1..nops(fp_sols)):
y(x) = 0.
y(x) = (1.162339833 sin(0.8603335890 x)
+ 1.000000000 cos(0.8603335890 x)) K
y(x) = (0.2919180907 sin(3.425618459 x)
+ 1.000000002 cos(3.425618459 x)) K