DSolveValue[eqn,expr,x]
给出由独立变量为 x 的常微分方程 eqn 的符号解确定的 expr 的值.
DSolveValue[eqn,expr,{x,xmin,xmax}]
使用 x 位于 xmin 和 xmax 之间的符号解.
DSolveValue[{eqn1,eqn2,…},expr,…]
使用一系列微分方程的符号解.
DSolveValue[eqn,expr,{x1,x2,…}]
使用偏微分方程 eqn 的解.
DSolveValue[eqn,expr,{x1,x2,…}∈Ω]
使用偏微分方程 eqn 在区域 Ω 上的解.
DSolveValue
DSolveValue[eqn,expr,x]
给出由独立变量为 x 的常微分方程 eqn 的符号解确定的 expr 的值.
DSolveValue[eqn,expr,{x,xmin,xmax}]
使用 x 位于 xmin 和 xmax 之间的符号解.
DSolveValue[{eqn1,eqn2,…},expr,…]
使用一系列微分方程的符号解.
DSolveValue[eqn,expr,{x1,x2,…}]
使用偏微分方程 eqn 的解.
DSolveValue[eqn,expr,{x1,x2,…}∈Ω]
使用偏微分方程 eqn 在区域 Ω 上的解.
更多信息和选项
- DSolveValue 可用来求解常微分方程 (ODE)、偏微分方程 (PDE)、微分代数方程 (DAE)、 时滞微分方程 (DDE)、积分方程、积分微分方程以及混合型微分方程.
- DSolveValue 的输出由关联函数 u 或 u[x] 的形式控制:
-
DSolveValue[eqn,u,x] f 其中 f 为纯函数 DSolveValue[eqn,u[x],x] f[x] 其中 f[x] 是关于 x 的表达式 - DSolveValue 会返回单个解,而 DSolve 能返回多个解.
- DSolveValue 的解可能含有不能明确计算结果的 Inactive 和与积分. 这种情况下,可使用变量 K[1]、K[2]、….
- DSolveValue[eqn,y[Infinity],x] 给出在 Infinity 解 y 的极限值.
- 可用 DSolveValue 求解的不同方程类型包括:
-
u'[x]f[x,u[x]] 常微分方程 a ∂xu[x,y]+b ∂yu[x,y]f 偏微分方程 f[u'[x],u[x],x]0 微分代数方程 u'[x]f[x,u[x-x1]] 时滞微分方程 u'[x]+
k[x,t]u[t]tf积分微分方程 {…,WhenEvent[cond,u[x]g]} 混合型微分方程 - DSolveValue[u[t]->sys,resp,t] 可用于求解系统模型,其中 sys 可以是 TransferFunctionModel 或 StateSpaceModel,而响应 resp 可以是以下其中之一: »
-
"StateResponse" sys 对输入
的状态响应"OutputResponse" sys 对输入
的输出响应 - DSolveValue[sys,resp,t] 可用于求解系统模型,其中 sys 可以是 TransferFunctionModel 或 StateSpaceModel,而响应 resp 可以是以下其中之一:
-
"ImpulseResponse" sys 对输入 DiracDelta[t] 的输出响应 "StepResponse" sys 对输入 UnitStep[t] 的输出响应 "RampRespone" sys 对输入 Ramp[t] 的输出响应 - 可以通过给出在特定点的方程,比如 u[x1]a、u'[x2]b 等等,指定常微分方程 (ODE) 和微分代数方程 (DAE) 的边界条件.
- 可以用方程 u[x,y1]a、Derivative[1,0][u][x,y1]b 等给出偏微分方程 (PDE) 的边界条件. 或是以 DirichletCondition[u[x,y]g[x,y],cond] 形式给出.
- 可以利用历史函数 g[x], 以 u[x/;x<x0]g[x] 形式给出时滞微分方程 (DDE) 的初始条件.
- 还可以将 WhenEvent[event,action] 包含在方程 eqn 中,用来指定当 event 变成 True 时采取的 action.
- 规约 u∈Vectors[n] 或 u∈Matrices[{m,n}] 可用于分别表示因变量 u 是向量值变量或矩阵值变量.或者将 u 定义为 VectorSymbol 或 MatrixSymbol. » »
- 区域 Ω 可以是任意使 RegionQ[Ω] 为 True 的表达式.
- 对于不能进行符号式求解的微分方程,N[DSolveValue[...]] 会调用 NDSolve 或 ParametricNDSolve.
- 可以给出下列选项:
-
Assumptions $Assumptions 对参数的假设 DiscreteVariables {} 混合型方程的离散变量 GeneratedParameters C 怎样命名产生的参数 Method Automatic 使用什么方法 - GeneratedParameters 控制产生参数的形式;缺省情况下,对于常微分方程 (ODE) 和微分代数方程 (DAE),这些参数是常数 C[n],对于偏微分方程 (PDE),则为任意函数 C[n][…]. »
范例
打开所有单元 关闭所有单元基本范例 (3)
DSolveValue[y'[x] + y[x] == a Sin[x], y[x], x]DSolveValue[{y'[x] + y[x] == a Sin[x], y[0] == 0}, y[x], x]sol = DSolveValue[{y'[x] + y[x] == a Sin[x], y[0] == 0}, y, x]Plot[Table[sol[x] /. {a -> i}, {i, 7}], {x, -2, 10}]DSolveValue[{y''[x] + y[x] == 0, y[0] == 0, y'[0] == 1}, y[3], x]DSolveValue[{y''[x] + y[x] == 0, y[0] == 0, y'[0] == 1}, y'[x], x]范围 (121)
基本用法 (13)
DSolveValue[y'[x] == 3y[x], y[x], x]DSolveValue[{y'[x] == 3y[x], y[0] == 5}, y[x], x]sol = DSolveValue[{y'[x] == -y[x]}, y[x], x]绘制任意常数 C[1] 为两个不同的值时解的曲线:
Plot[{sol /. C[1] -> 2, sol /. C[1] -> 3}, {x, 1, 4}]sol = DSolveValue[{y'[x] == -3y[x] ^ 2, y[1] == 2}, y[x], x]Plot[sol, {x, 1, 4}]eqns = {y'[x] == y[x] + a Cos[x], y[0] == 3};sol = DSolveValue[eqns, y, x]eqns /. {y -> sol}//SimplifyDSolveValue[{y''[x] + 4y[x] == 7}, y[x], x]DSolveValue[{y''[x] + 4y[x] == 7, y[0] == 1, y'[0] == 2}, y[x], x]eqns = {Derivative[1][y][x] == y[x] - a z[x], Derivative[1][z][x] == y[x] - z[x], y[0] == 1, z[0] == 4};sol = DSolveValue[eqns, {y, z}, x]ParametricPlot[Evaluate[Table[{sol[[1]][x], sol[[2]][x]}, {a, 3, 8}]], {x, 0, 10}]eqns /. Thread[{y, z} -> sol]//Simplifysol = DSolveValue[{y'[x] - 3z[x] == Sin[x], y[x] + z[x] == 1 / 5, y[Pi / 2] == 1 / 2}, {y, z}, x]Plot[Evaluate[{sol[[1]][x], sol[[2]][x], sol[[1]][x] + sol[[2]][x]}], {x, 2, 16}, PlotLegends -> {y[x], z[x], y[x] + z[x]}]z := u[x, y]p := D[u[x, y], x]q := D[u[x, y], y]eqn = p + 3q + z == 1;sol = DSolveValue[eqn, u, {x, y}]sol /. C[1] -> SinPlot3D[%[x, y], {x, -3, 3}, {y, -3, 3}, PlotRange -> All]DSolveValue[y''[x] - 4y[x] == 0, y[x], x]DSolveValue[y''[x] - 4y[x] == 0, y[x], x, GeneratedParameters -> f]DSolveValue[{x'[t] == x[t - 1] ^ 2, x[t /; t ≤ 0] == a t}, x[t], {t, 0, 2}]Plot[Evaluate[Table[%, {a, 1, 5}]], {t, -1, 2}]DSolveValue[{y''[t] == -981 / 100, y[0] == 5, y'[0] == 0, WhenEvent[y[t] == 0, y'[t] -> -(7 / 10)y'[t]]}, y[t], {t, 0, 4}]Plot[%, {t, 0, 4}]如果符号解失败,应用 N[DSolveValue[…]] 调用 NDSolveValue:
DSolveValue[{y''[x] + x ^ 2y'[x] + Sin[y[x]] == 1, y[0] == 1, y'[0] == 1}, y, {x, 0, 4}]f = N[%]Plot[f[x], {x, 0, 4}]DSolveValue[Derivative[2][x][t] == Quantity[5, ("Meters"/"Seconds"^2)], x[t], t]DSolveValue[{Derivative[2][x][t] == Quantity[5, ("Meters"/"Seconds"^2)], x[Quantity[0, "Seconds"]] == Quantity[3, "Meters"], Derivative[1][x][Quantity[0, "Seconds"]] == Quantity[7, ("Meters"/"Seconds")]}, x[t], t]线性微分方程 (5)
DSolveValue[{y'[x] == ay[x], y[0] == 1}, y[x], x]DSolveValue[y'[x] + x y[x] == Cos[x], y[x], x]sol = DSolveValue[{y''[x] - x y[x] == 0, y[0] == 1, y[9] == 1}, y[x], x]Plot[sol, {x, -10, 10}]DSolveValue[y''[x] + 4y'[x] + 5y[x] == 0, y[x], x]DSolveValue[x ^ 2y''[x] + 4x y'[x] + 7y[x] == 0, y[x], x]DSolveValue[x y''[x] + 2y'[x] - x y[x] == Sin[x], y, x]DSolveValue[y''[x] - x y[x] == 0, y[x], x]DSolveValue[(1 - x ^ 2)y''[x] - 2x y'[x] + (49 - 49x ^ 2 - 16 / (1 - x ^ 2) + SpheroidalEigenvalue[5, 4, 7])y[x] ==
0, y[x], x]DSolveValue[y''[x] + (8 + 3Cos[x] ^ 2)y[x] == 0, y[x], x]DSolveValue[y''[x] + (9 + Sech[x] ^ 2)y[x] == 0, y[x], x]DSolveValue[y''[x] == Exp[-x]y[x], y[x], x]DSolveValue[y'''[x] + 4y'[x] == 5y[x], y, x]DSolveValue[3x ^ 3y''''[x] + 19x ^ 2y'''[x] + (2x - 3x ^ 2)y''[x] + (2 - 9x)y'[x] - 3y[x] == 0, y[x], x]DSolveValue[(525 + x ^ 4)y[x] - 51(-x y'[x] + x ^ 2 y''[x]) + 2x ^ 3y'''[x] + x ^ 4 y''''[x] == 0, y[x], x]DSolveValue[Derivative[4][y][x] + 5y'''[x] + 2y[x] == x E^3x Cos[3x], y[x], x]非线性微分方程 (4)
DSolveValue[y'[x] - Sqrt[(y[x] / x)] == y[x] / x, y, x]用 WeierstrassP 表示的解:
DSolveValue[y''[x] == y[x] ^ 2 + 1, y, x]DSolveValue[{y''[x] == y[x] ^ 3, y[0] == 5, y'[0] == 25 / Sqrt[2]}, y[x], x]DSolveValue[2 x Sqrt[(1 - x/1 + x)] (1 + x) ArcSech[x]^2 - E^E^(f[x]/ArcSech[x]) + (f[x]/ArcSech[x]) f[x] - E^E^(f[x]/ArcSech[x]) + (f[x]/ArcSech[x]) x Sqrt[(1 - x/1 + x)] (1 + x) ArcSech[x] Derivative[1][f][x] == 0, f[x], x]微分方程组 (10)
DSolveValue[{y'[x] == x ^ 2y[x], z'[x] == 5z[x]}, {y[x], z[x]}, x]sol[x_] = With[{θ = Pi / 3}, DSolveValue[{y'[x] == Cos[θ]y[x] - Sin[θ]z[x] + 1, z'[x] == Sin[θ]y[x] + Cos[θ]z[x], y[0] == 1, z[0] == 1}, {y[x], z[x]}, x]]Plot[sol[x], {x, 0, 9}]DSolveValue[{Derivative[1][y][x] == -(4 y[x]/x) + (4 z[x]/x), Derivative[1][z][x] == ((4/x) - (x/4)) y[x] - (4 z[x]/x)}, {y[x], z[x]}, x]DSolveValue[ {y'[x] == Exp[z[x]] + 1, z'[x] == y[x] - x}, {y[x], z[x]}, x]//Quietm = {{4, -6}, {1, -1}};DSolveValue[x'[t] == m.x[t], x[t]∈Vectors[2], t]或者将
定义为 VectorSymbol:
x = VectorSymbol["x", 2]DSolveValue[x'[t] == m.x[t], x[t], t]m = {{0, 1}, {-1, 0}};
x0 = {{1, 2}, {3, 4}};(sol = DSolveValue[{x'[t] == m.x[t], x[0] == x0}, Element[x[t], Matrices[{2, 2}]], t])//MatrixForm或者将
定义为 MatrixSymbol:
x = MatrixSymbol["x", {2, 2}](sol = DSolveValue[{x'[t] == m.x[t], x[0] == x0}, x[t], t])//MatrixFormPlot[Evaluate[Flatten[sol]], {t, 0, 10}]m = {{2, -1}, {1, -2}};g = {(2t - 5)Cos[3t], (3t + 2)Sin[3t]} E^-2t;DSolveValue[x'[t] - m.x[t] == g, Element[x[t], Vectors[2]], t]DSolveValue[{Derivative[1][y][x] == -(4 y[x]/x) + (4 z[x]/x), Derivative[1][z][x] == ((4/x) - (x/4)) y[x] - (4 z[x]/x), Derivative[1][y1][x] == 1 + E^z1[x], Derivative[1][z1][x] == -x + y1[x], w1'[x] + 2 E ^ w2[x] == 0, w2'[x] == -w1[x]}, {y[x], z[x], y1[x], z1[x], w1[x], w2[x]}, x]//QuietDSolveValue[{Derivative[1][y1][x] == (y2[x]/(-(2/3) + (I/2)) + x), Derivative[1][y2][x] == (y3[x]/10 ((-4 - 6 I) + x)), Derivative[1][y3][x] == 0}, {y1[x], y2[x], y3[x]}, x]MatrixForm[m = {{0, x^4 / (x - 2)^2, 0}, {0, 0, x / (x^2 + 1)}, {0, 0, 0}}]DSolveValue[Join[Thread[D[{y1[x], y2[x], y3[x]}, x] == m.{y1[x], y2[x], y3[x]}], {y1[0] == 1, y2[0] == 1, y3[0] == 1}], {y1[x], y2[x], y3[x]}, x]微分代数方程 (3)
DSolveValue[{2 y'[x] + z'[x] == 4y[x] + x, y[x] - z[x] == 1}, {y[x], z[x]}, x]{sol1, sol2} = DSolveValue[{y'[x] - 4z[x] == Cos[x], y[x] + z[x] == 1 / 2, y[Pi / 2] == 1 / 2}, {y, z}, x]Plot[{sol1[x], sol2[x], sol1[x] + sol2[x]}, {x, 2, 16}]DSolveValue[{x'[t] == x[t] + 2y[t], y[t] == x[t] + 2 ^ t, x[t] + z[t] == 0}, {x[t], y[t], z[t]}, t]时滞微分方程 (2)
sol = DSolveValue[{x'[t] == x[t - 1] ^ 2, x[t /; t ≤ 0] == a t}, x, {t, 0, 2}]Plot[Table[sol[t], {a, 1, 5}], {t, -1, 2}]eqns = {x'[t] == a y[t - 1] + y[t - 3], y'[t] == x[t - 1], x[t /; t ≤ 0] == t, y[t /; t ≤ 0] == t ^ 2};{sol1, sol2} = DSolveValue[eqns, {x, y}, {t, 0, 5}]ParametricPlot[Table[{sol1[t], sol2[t]}, {a, -1, 2, 1 / 3}]//Evaluate, {t, 0, 5}, Exclusions -> None]分段微分方程 (4)
sol = DSolveValue[{y''[x] - y[x] == Max[x, x ^ 2], y[0] == 1, y'[0] == 2}, y[x], x]//SimplifyDSolveValue[y'[x] + Clip[x] ^ 2y[x] == 0, y[x], x]sol = DSolveValue[{y'[x] == Piecewise[{{Cos[x] ^ 2, x > 2}}, y[x] ^ 2 / 3], y[0] == 1}, y, x]Plot[sol[x], {x, 0, 7}]DSolveValue[y''[x] - y[x] == HeavisideTheta[x], y[x], x]DSolveValue[y'[x] + 7y[x] == DiracDelta[x], y[x], x]DSolveValue[y'[x] == UnitStep[x], y[x], {x, 0, 1}]DSolveValue[y'[x] == UnitStep[x], y, {x, -1, 0}]DSolveValue[y'[x] == UnitStep[x], y, {x, -1, 1}]混合微分方程 (8)
sol = DSolveValue[{x'[t] == x[t], x[0] == 1, WhenEvent[Mod[t, 1] == 0, x[t] -> x[t] + 10]}, x[t], {t, 0, 3}]Plot[sol, {t, 0, 4}, Exclusions -> None]dsol = DSolveValue[{x''[t] == x[t] + t, x[0] == 1, x'[0] == 3, WhenEvent[Mod[2 t, 1] == 0, {x[t] -> x[t] + t, x'[t] -> -x'[t]}]}, x, {t, 0, 4}]Plot[dsol[t], {t, 0, 4}, Exclusions -> None]{dsol1, dsol2} = DSolveValue[{x'[t] == y[t], y'[t] == 2x[t], x[0] == 0, y[0] == 1, WhenEvent[Mod[t, 1] == 0, {x[t] -> x[t], y[t] -> -y[t] + 2}]}, {x[t], y[t]}, {t, 0, 4}]ParametricPlot[{dsol1, dsol2}, {t, 0, 4}, PlotRange -> All, Exclusions -> None]DSolveValue[{x'[t] == x[t], x[0] == 1, WhenEvent[t == 2, "StopIntegration"]}, x, {t, 0, 3}]sol = DSolveValue[{x''[t] + x[t] == 0, x[0] == 0, x'[0] == 1, WhenEvent[x[t] == 0, {x'[t] -> -x'[t], "RemoveEvent"}]}, x, {t, 0, 10}]Plot[sol[t], {t, 0, 10}]sol = DSolve[{x'[t] == a[t], x[0] == 0, a[0] == 1, WhenEvent[Mod[x[t], 1] == 0, a[t] -> -a[t]]}, {x, a}, {t, 0, 4}, DiscreteVariables -> a]Plot[x[t] /. sol, {t, 0, 4}]sol = DSolveValue[{x'[t] == y[t], y'[t] == 1, x[0] == 0, y[0] == 0, WhenEvent[t == 1, x[t] -> x[t] + 1], WhenEvent[t == 2, y[t] -> y[t] + 2]}, {x, y}, {t, 0, 3}]ParametricPlot[{sol[[1]][t], sol[[2]][t]}, {t, 0, 3}, Exclusions -> None]sol = DSolveValue[{x'[t] == 1, x[0] == 0, WhenEvent[{t == 1, t == 2}, x[t] -> x[t] + 1]}, x, {t, 0, 3}]Plot[sol[t], {t, 0, 3}, Exclusions -> None]施图姆-刘维尔问题 (6)
sol = DSolveValue[{y''[x] + λ y[x] == 0, y[0] == 0, y[π] == 0}, y[x], x]eigfuns = Table[sol //. { -> i, λ -> ^2} /. {C[1] -> 1}, {i, 5}]Plot[Evaluate[eigfuns], {x, 0, Pi}]sol = DSolveValue[{y''[x] + λ y[x] == 0, y'[0] == 0, y'[π] == 0}, y[x], x]eigfuns = Table[sol //. { -> i, λ -> ^2} /. {C[1] -> 1}, {i, 5}]Plot[Evaluate[eigfuns], {x, 0, Pi}]sol = DSolveValue[{y''[x] + λ y[x] == 0, y[0] == 0, y'[π] == 0}, y[x], x]eigfuns = Table[sol //. { -> i, λ -> (-(1/2) + )^2} /. {C[1] -> 1}, {i, 5}]Plot[Evaluate[eigfuns], {x, 0, Pi}]sol = DSolveValue[{y''[x] + λ y[x] == 0, y[0] + y'[0] == 0, y[1] == 0}, y[x], x]roots = λ /. Solve[Sqrt[λ] Cos[Sqrt[λ]] == Sin[Sqrt[λ]] && 10 < λ < 80, λ];data = Table[{λ, 0}, {λ, roots}];Plot[Sqrt[λ] Cos[Sqrt[λ]] - Sin[Sqrt[λ]], {λ, 10, 80}, Epilog -> {PointSize[Large], Red, Point[data]}]利用 Assumptions 获取位于该范围内的特征函数:
DSolveValue[{y''[x] + λ y[x] == 0, y[0] + y'[0] == 0, y[1] == 0}, y[x], x, Assumptions -> 1 < λ < 80]DSolveValue[{y''[x] + 2λ y'[x] + λ ^ 2 y[x] == 0, y[1] + y'[1] == 0, 3y[2] + 2y'[2] == 0}, y[x], x]eqns = {-y''[x] + x y[x] == λ y[x], y[0] == 0, y[1] == 0};sol = DSolveValue[eqns, y[x], x, Assumptions -> 1 < λ < 200];eigvals = {ToRules[sol[[1, 1, 2]]]}eigfuns = (sol[[1, 1, 1]] /. {C[1] -> 1})Plot[Evaluate[eigfuns /. eigvals], {x, 0, 1}]积分方程 (6)
eqn = y[x] == x^3 + λSubsuperscript[∫, 0, x](t - x)y[t]ⅆt;sol = DSolveValue[eqn, y[x], x]Plot[Table[sol, {λ, 1, 3, 0.5}]//Evaluate, {x, 0, 20}]eqn = y[x] == Sin[7 x] - (x/a) + Subsuperscript[∫, 0, (π/2)]x y[t]ⅆt;sol = DSolveValue[eqn, y[x], x]Plot[Table[sol, {a, -1, 4, 0.7}]//Evaluate, {x, 0, Pi / 2}]eqn = Derivative[1][y][x] == 1 + Sin[a x] + Subsuperscript[∫, 0, x]y[t]ⅆt;sol1 = DSolveValue[eqn, y[x], x]init = y[0] == -1;sol2 = DSolveValue[{eqn, init}, y[x], x]Plot[Table[sol2, {a, -1, 4, 0.7}]//Evaluate, {x, 0, 3}]eqn = Sin[a x] == Subsuperscript[∫, 0, x](y[t]/Sqrt[x - t])ⅆt;sol = DSolveValue[eqn, y[x], x]Plot[Table[sol, {a, 1, 3, 0.7}]//Evaluate, {x, 0, 9}]eqn = y[x] == x^a - Subsuperscript[∫, 0, x](y[t]/Sqrt[x - t])ⅆt;sol = DSolveValue[eqn, y[x], x]Plot[Table[sol, {a, 1, 4, 0.7}]//Evaluate, {x, 0, 2}]eqn = y[x] == λ Subsuperscript[∫, 0, π]Cos[x + t]y[t]ⅆt;sol = DSolveValue[eqn, y[x], x]Plot[Table[sol /. {C[1] -> 1, C[2] -> 1}, {λ, {-2 / Pi, 2 / Pi}}]//Evaluate, {x, 0, 3π}]一阶偏微分方程 (7)
DSolveValue[3D[u[x, y], x] + 5D[u[x, y], y] == x , u[x, y], {x, y}]对任意函数 C[1] 作特定选择后的解:
% /. {C[1][e_] :> Sin[e] + Cos[e]}Plot3D[%, {x, -5, 5}, {y, -5, 5}]DSolveValue[{x D[u[x, y], y] + y D[u[x, y], x] ==
-4x y u[x, y], u[x, 0] == E ^ (-x ^ 2)}, u[x, y], {x, y}]Plot3D[%, {x, -2, 2}, {y, -2, 2}, ColorFunction -> "TemperatureMap"]DSolveValue[{D[u[t, x], t] + D[u[t, x], x] == 0, u[t, 0] == 0, u[0, x] == Sin[x]}, u[t, x], {t, x}]Plot3D[%//Evaluate, {t, 0, 3}, {x, 0, 3}, Exclusions -> None]DSolveValue[D[u[t, x], t] + c D[u[t, x], x] == 0, u[t, x], {t, x}]DSolveValue[{D[u[t, x], t] + c D[u[t, x], x] == 0, u[0, x] == E ^ (-x ^ 2)}, u[t, x], {t, x}]Plot[% /. {c -> 1, t -> 3}//Evaluate, {x, 0, 10}, PlotRange -> All, Ticks -> False, Filling -> Axis, Epilog -> Arrow[{{4, 4 / 5}, {7, 4 / 5}}]]DSolveValue[2D[u[x, y], x] + 5D[u[x, y], y] == u[x, y] ^ 2 + 1, u[x, y], {x, y}]//QuietDSolveValue[{D[u[x, y], x] + u[x, y] D[u[x, y], y] == 0,
u[x, 0] == 1 / (x + 1)}, u[x, y], {x, y}]Plot3D[%, {x, 0, 3}, {y, 0, 2}]DSolveValue[u[x, y] == x D[u[x, y], x] + y D[u[x, y], y] + Sin[D[u[x, y], x] + D[u[x, y], y]] , u[x, y], {x, y}]//Quiet双曲型偏微分方程 (11)
weqn = D[u[x, t], {t, 2}] == D[u[x, t], {x, 2}];ic = {u[x, 0] == E ^ (-x ^ 2), Derivative[0, 1][u][x, 0] == 1};DSolveValue[{weqn, ic}, u[x, t], {x, t}]Plot3D[Evaluate[%], {x, -7, 7}, {t, 0, 4}, PlotRange -> All]weqn = D[u[x, t], {t, 2}] == D[u[x, t], {x, 2}];ic = {u[x, 0] == UnitBox[x] + UnitTriangle[x / 3], Derivative[0, 1][u][x, 0] == 0};DSolveValue[ {weqn, ic}, u[x, t], {x, t}]//Simplify//TraditionalFormPlot3D[Evaluate[%], {x, -7, 7}, {t, 0, 4}, PlotRange -> All, PlotPoints -> 250, Exclusions -> None]以一对衰减指数函数为初始数据的情况下,求解波动方程的初值问题:
weqn = D[u[x, t], {t, 2}] == D[u[x, t], {x, 2}];ic = {u[x, 0] == E ^ (-(x - 6) ^ 2) + E ^ (-(x + 6) ^ 2),
Derivative[0, 1][u][x, 0] == 1 / 2};sol = DSolveValue[ {weqn, ic}, u[x, t], {x, t}]Plot3D[Evaluate[sol], {x, -30, 30}, {t, 0, 20}, PlotRange -> All, Exclusions -> All, PlotPoints -> 30, WorkingPrecision -> 20]//Quietweqn = {D[u[x, t], {t, 2}] == D[u[x, t], {x, 2}] + m};ic = {u[x, 0] == Sin[x] - Cos[3 * x] / E ^ (Abs[x] / 6),
Derivative[0, 1][u][x, 0] == 0};sol = DSolveValue[{weqn, ic}, u[x, t], {x, t}]Table[Plot3D[Evaluate[sol], {x, -7, 7}, {t, 0, 4}, PlotRange -> All, Ticks -> False], {m, {-1, 0, 1}}]weqn = D[u[x, t], {t, 2}] == D[u[x, t], {x, 2}];ic = {u[x, 0] == Piecewise[{{Sin[x] ^ 2, Pi < x < 2Pi}}], Derivative[0, 1][u][x, 0] == 0};bc = u[0, t] == 0;sol = DSolveValue[{weqn, ic, bc}, u[x, t], {x, t}];Plot3D[Evaluate[sol], {x, 0, 12}, {t, 0, 10}, Exclusions -> None, PlotRange -> All, PlotPoints -> 120]Grid[Partition[Table[Plot[Evaluate[sol], {x, 0, 20},
Exclusions -> None, PlotRange -> All], {t, 0, 12}], 3], ItemSize -> 10]weqn = D[u[x, t], {t, 2}] == D[u[x, t], {x, 2}];ic = {u[x, 0] == Sin[x] ^ 3, Derivative[0, 1][u][x, 0] == 1 - E ^ (-x / 10)};bc = Derivative[1, 0][u][0, t] == 1;sol = DSolveValue[{weqn, ic , bc }, u[x, t], {x, t}];Plot3D[Evaluate[sol], {x, 0, 20}, {t, 0, 2}, Exclusions -> None, PlotRange -> All]Grid[Partition[Table[Plot[Evaluate[sol], {x, 0, 20},
Exclusions -> None], {t, 0, 12}], 3], ItemSize -> 8]weqn = D[u[x, t], {t, 2}] == D[u[x, t], {x, 2}];ic = {u[x, 0] == x ^ 2(Pi - x), Derivative[0, 1][u][x, 0] == 0};bc = {u[0, t] == 0, u[Pi, t] == 0};sol = DSolveValue[{weqn, ic, bc}, u[x, t], {x, t}]从 Inactive 和中提取前三项:
asol = TruncateSum[sol, 3]Plot3D[asol, {x, 0, Pi}, {t, 0, 4Pi}, ColorFunction -> Hue]Plot[Evaluate[Table[asol, {t, 0, 7}]], {x, 0, Pi}]weqn = D[u[x, y, t], {t, 2}] == Laplacian[u[x, y, t], {x, y}];ic = {u[x, y, 0] == (1 / 10)(x - x ^ 2)(2y - y ^ 2), Derivative[0, 0, 1][u][x, y, 0] == 0};bc = {u[x, 0, t] == 0,
u[0, y, t] == 0, u[1, y, t] == 0, u[x, 2, t] == 0};(sol = FullSimplify[DSolveValue[{weqn, ic, bc}, u[x, y, t], {x, y, t}], K[1]∈Integers && K[3]∈Integers && K[1] ≥ 1 && K[3] ≥ 1])//TraditionalForm从 Inactive 和中提取若干项:
h[x_, y_, t_] = TruncateSum[sol, 3]Animate[Plot3D[h[x, y, t], {x, 0, 1}, {y, 0, 2}, Ticks -> False, PlotRange -> {-1 / 36, 1 / 36}, MeshStyle -> Red, PerformanceGoal -> "Quality"], {t, 0, 8}, SaveDefinitions -> True, DefaultDuration -> 12]reqn = r D[u[r, t], {t, 2}] == D[r D[u[r, t], r], r];ic = {u[r, 0] == 1, Derivative[0, 1][u][r, 0] == r / 3};bc = u[1, t] == 0;(sol = DSolveValue[{reqn, ic, bc}, u[r, t], {r, t}]//FullSimplify)//TraditionalForm从 Inactive 和中提取前三项:
h[r_, t_] = TruncateSum[sol, 3]//N;Plot3D[h[r, 0.7] /. {r -> Sqrt[x ^ 2 + y ^ 2]}, {x, y}∈Disk[], PlotRange -> All, Ticks -> None]DSolveValue[12 D[u[x, t], {x, 2}] == D[u[x, t], {t, 2}] + D[u[x, t], x, t], u[x, t], {x, t}]DSolveValue[D[u[x, y], {x, 2}] - 2Sin[x] D[u[x, y], x, y] - Cos[x] ^ 2 D[u[x, y], {y, 2}] - Cos[x]D[u[x, y], y] == 0, u[x, y], {x, y} ]DSolveValue[3D[u[x, t], {x, 2}] - D[u[x, t], {t, 2}] + D[u[x, t], x, t] == 1, u[x, t], {x, t}]eqns = {D[u[x, t], t] == D[v[x, t], x] + 1, D[v[x, t], t] == -D[u[x, t], x] - 1};ic = {u[x, 0] == Cos[x] ^ 2, v[x, 0] == Sin[x]};sol = DSolveValue[{eqns, ic}, {u[x, t], v[x, t]}, {x, t}]//FullSimplifyPlot3D[sol//Evaluate, {x, 0, 4}, {t, 0, 3}, PlotRange -> {-70, 120}]抛物线型偏微分方程 (7)
heqn = D[u[x, t], t] == D[u[x, t], {x, 2}];ic = u[x, 0] == E ^ (-x ^ 2);sol = DSolveValue[{heqn, ic }, u[x, t], {x, t}]Plot3D[Evaluate[sol], {x, -5, 5}, {t, 0, 4}, PlotRange -> All]Plot[Evaluate[Table[sol, {t, 0, 4}]], {x, -5, 5}, PlotRange -> All, Filling -> Axis]//Quietheqn = D[u[x, t], t] == D[u[x, t], {x, 2}];ic = u[x, 0] == UnitBox[x];以误差函数 Erf 的形式给出解:
sol = DSolveValue[{heqn, ic }, u[x, t], {x, t}]Plot3D[Evaluate[sol], {x, -2, 2}, {t, 0, 1}, PlotRange -> All, PlotPoints -> 250]heqn = D[u[x, t], t] == D[u[x, t], {x, 2}] + m;ic = u[x, 0] == Sin[x];sol = DSolveValue[{heqn, ic }, u[x, t], {x, t}]Table[Plot3D[Evaluate[sol] /. {m -> i}, {x, -7, 7}, {t, 0, 4}, PlotRange -> All, Axes -> False], {i, {2, 0, -2}}]heqn = D[u[x, t], t] == D[u[x, t], {x, 2}];ic = u[x, 0] == x(3 - x) ^ 2;bc = {u[0, t] == 0, u[3, t] == 0};sol = DSolveValue[{heqn, ic, bc }, u[x, t], {x, t}]从 Inactive 和中提取三项:
asol = TruncateSum[sol, 3]Plot3D[asol//Evaluate, {x, 0, 3}, {t, 0, 3 / 2}, Exclusions -> None, PlotRange -> All]heqn = D[u[x, t], t] == D[u[x, t], {x, 2}];ic = u[x, 0] == x(3 - x);bc = {Derivative[1, 0][u][0, t] == 0, Derivative[1, 0][u][3, t] == 0};sol = DSolveValue[{heqn, ic, bc }, u[x, t], {x, t}]从 Inactive 和中提取若干项:
asol = TruncateSum[sol, 4]Plot3D[asol//Evaluate, {x, 0, 3}, {t, 0, 1}, Exclusions -> None, PlotRange -> All]asol /. t -> ∞Plot[Evaluate[Table[asol, {t, 0, 1, 0.2}]], {x, 0, 3}, PlotRange -> All, Filling -> Axis]rheqn = r D[u[r, t], t] == D[r D[u[r, t], r], r];ic = u[r, 0] == 1 - r;bc = u[1, t] == 0;(sol = DSolveValue[{rheqn, ic, bc}, u[r, t], {r, t}])//TraditionalForm从 Inactive 和中提取若干项:
h[r_, t_] = TruncateSum[sol, 3]//N;Table[Plot3D[h[r, 0.1][[i]] /. {r -> Sqrt[x ^ 2 + y ^ 2]}//Evaluate, {x, y}∈Disk[], Ticks -> None], {i, 3}]BlackScholesPDE = D[v[t, s], t] + 1 / 2σ ^ 2 s ^ 2 D[v[t, s], {s, 2}] + (r - q) s D[v[t, s], s] - r v[t, s] == 0;bc = v[T, s] == ψ[s];DSolveValue[{BlackScholesPDE, bc}, v[t, s], {t, s}]椭圆型偏微分方程 (9)
leqn = Laplacian[u[x, y], {x, y}] == 0;bc = u[x, 0] == UnitBox[x];sol = DSolveValue[{leqn, bc}, u[x, y], {x, y}]Plot3D[sol, {x, -3, 3}, {y, 0, 5}, PlotRange -> All, Exclusions -> None]leqn = Laplacian[u[x, y], {x, y}] == 0;bc = u[0, y] == Sinc[y];sol = DSolveValue[{leqn, bc}, u[x, y], {x, y}]Plot3D[sol, {y, -10, 10}, {x, 0, 5}, PlotRange -> All]leqn = Laplacian[u[x, y], {x, y}] == 0;bc = {u[x, 0] == (-1 / ((x - 2) ^ 2 + 3)), u[0, y] == (1 / ((y - 3) ^ 2 + 1))};sol = DSolveValue[{leqn, bc}, u[x, y], {x, y}];Plot3D[sol, {x, 0, 10}, {y, 0, 7}, PlotRange -> All]leqn = Laplacian[u[x, y], {x, y}] == 0;bc = Derivative[0, 1][u][x, 0] == UnitBox[x];sol = DSolveValue[{leqn, bc}, u[x, y], {x, y}]Plot3D[sol, {x, -3, 3}, {y, 0, 5}, PlotRange -> All, Exclusions -> None]leqn = Laplacian[u[x, y], {x, y}] == 0;bc = {u[x, 0] == x ^ 2(1 - x), u[x, 2] == 0, u[0, y] == 0, u[1, y] == 0};sol = FullSimplify[DSolveValue[{leqn, bc}, u[x, y], {x, y}]]从 Inactive 和中提取若干项:
asol = TruncateSum[sol, 4]Plot3D[asol, {x, 0, 1}, {y, 0, 2}, PlotRange -> All]leqn = Laplacian[u[r, θ], {r, θ}, "Polar"] == 0;bc = u[3, θ] == Sin[6θ];sol = DSolveValue[{leqn, bc}, u[r, θ], {r, θ}]Plot3D[Evaluate[sol /. {r -> Sqrt[x ^ 2 + y ^ 2], θ -> ArcTan[x, y]}], {x, y}∈Disk[{0, 0}, 3], PlotRange -> All, Exclusions -> None]leqn = D[u[r, θ], {r, 2}] + (1 / r) D[u[r, θ], r] + (1 / r ^ 2) D[u[r, θ], {θ, 2}] == 0;bc = {u[1, θ] == 0, u[2, θ] == 5};sol = DSolveValue[{leqn, bc}, u[r, θ], {r, θ}]Plot3D[Evaluate[sol /. {r -> Sqrt[x ^ 2 + y ^ 2], θ -> ArcTan[x, y]}], {x, y}∈Annulus[{0, 0}, {1, 2}], PlotRange -> All, Exclusions -> None]peqn = Laplacian[u[x, y], {x, y}] == 6x - 6y;bc = {u[x, 0] == 1 + 11x + x ^ 3, u[x, 2] == -7 + 11x + x ^ 3, u[0, y] == 1 - y ^ 3, u[4, y] == 109 - y ^ 3};sol = DSolveValue[{peqn, bc}, u[x, y], {x, y}]heqn = {Laplacian[u[x, y], {x, y}] + 5 u[x, y] == 0};bc = {u[x, 0] == UnitTriangle[x - 2], u[x, 2] == 0, u[0, y] == 0, u[4, y] == 0};(sol = DSolveValue[{heqn, bc}, u[x, y], {x, y}])//TraditionalForm从 Inactive 和中提取有限个项:
fsol = TruncateSum[sol, 30];Plot3D[fsol//Evaluate, {x, 0, 4}, {y, 0, 2}, PlotRange -> All]一般偏微分方程 (6)
eqn = I ℏ D[ψ[x, t], t] == (-ℏ^2/2m) D[ψ[x, t], {x, 2}];
DSolveValue[{eqn, ψ[a, t] == 0, ψ[b, t] == 0}, ψ[x, t], {x, t}]u[x_, t_] = TruncateSum[%, 4]无论四个常数 C[k] 取何值,ψ 都满足方程及边界条件:
Simplify[{eqn, ψ[a, t] == 0, ψ[b, t] == 0} /. ψ -> u]eqn = I D[ψ[x, t], t] == -2 D[ψ[x, t], {x, 2}];
f[x_] := -350 + 155 x - 22 x^2 + x^3
sol = DSolveValue[{eqn, ψ[5, t] == 0, ψ[10, t] == 0, ψ[x, 2] == f[x]}, ψ, {x, t}]u[k_Integer] = TruncateSum[sol, k]Table[eqn /. ψ -> u[k], {k, 4}]//SimplifyTable[{u[k][5, t] == 0, u[k][10, t] == 0}, {k, 4}]Grid@Partition[Table[Plot[{u[k][x, 2], f[x]}, {x, 5, 10}, ImageSize -> 200], {k, 4}], 2]eqn = I D[ψ[x, t], t] == -D[ψ[x, t], {x, 2}] + 2 x^2ψ[x, t];sol = DSolveValue[{eqn, ψ[-∞, t] == 0, ψ[∞, t] == 0}, ψ[x, t], {x, t}]u[x_, t_] = TruncateSum[sol, 2]Simplify[eqn /. ψ -> u]Limit[u[x, t], x -> ∞]Limit[u[x, t], x -> -∞]Integrate[Abs[u[x, t]]^2, {x, -∞, ∞}, Assumptions -> t∈Reals]BurgersEqn = D[u[x, t], t] + u[x, t]D[u[x, t], x] == ν D[u[x, t], {x, 2}];sol = DSolveValue[{BurgersEqn, u[x, 0] == UnitBox[x]}, u[x, t], {x, t}];(dsol = sol//FullSimplify)//TraditionalFormQuiet[Plot[Table[dsol /. {ν -> 1 / 40}, {t, 1 / 100, 7}]//Evaluate, {x, -2, 3.3}, PlotRange -> All, Filling -> Axis, WorkingPrecision -> 20]]Table[Plot3D[dsol//Evaluate, {x, -2, 2}, {t, 0, 5}, PlotRange -> All, Ticks -> False], {ν, {2 / 3, 1 / 6, 1 / 14}}]TricomiEqn = D[u[x, y], {x, 2}] + y D[u[x, y], {y, 2}] == 0;DSolveValue[{TricomiEqn, u[x, 0] == 0, Derivative[0, 1][u][x, 0] == x ^ 2}, u[x, y], {x, y}]Plot3D[%//Evaluate, {x, -3, 3}, {y, 0, 5}]Korteweg–de Vries (KdV) 方程的行波解:
KdV = {D[u[x, t], t] + D[u[x, t], {x, 3}] + 6u[x, t]D[u[x, t], x] == 0};sol = DSolveValue[KdV, u[x, t], {x, t}]//Quietpsol = sol /. {C[1] -> 1, C[2] -> -4, C[3] -> 1 / 4}//SimplifyPlot[Evaluate[Table[psol, {t, 1, 12, 3}]], {x, -7, 35}, PlotRange -> All, Filling -> Axis, Epilog -> {Arrow[{{5, 1.6}, {9, 1.6}}], Arrow[{{17, 1.6}, {21, 1.6}}], Arrow[{{29, 1.6}, {33, 1.6}}]}]区域上的偏微分方程 (3)
leqn = Laplacian[u[x, y], {x, y}] == 0;dcond = DirichletCondition[u[x, y] == Piecewise[{{UnitTriangle[2 x - 1], y == 0 || y == 2}}, 0], True];Ω = Rectangle[{0, 0}, {1, 2}];(sol = FullSimplify[DSolveValue[{leqn, dcond}, u[x, y], {x, y}∈Ω]])//TraditionalForm从 Inactive 和中提取前 100 项:
asol = TruncateSum[sol, 100];Plot3D[asol//Evaluate, {x, y}∈Ω, PlotRange -> All, PlotStyle -> Hue[0.2]]leqn = Laplacian[u[x, y], {x, y}] == 0;dcond = DirichletCondition[u[x, y] == Sin[6ArcTan[y / x]], True];Ω = Disk[{0, 0}, 3];sol = FullSimplify[DSolveValue[{leqn, dcond}, u[x, y], {x, y}∈Ω]]Plot3D[sol//Evaluate, {x, y}∈Ω, PlotRange -> All, PlotStyle -> Hue[0.5]]leqn = Laplacian[u[x, y], {x, y}] == 0;dcond = DirichletCondition[u[x, y] == 1 / (1 + x ^ 2), True];Ω = HalfPlane[{{0, 0}, {1, 0}}, {0, 1}];sol = DSolveValue[{leqn, dcond}, u[x, y], {x, y}∈Ω]Plot3D[sol//Evaluate, {x, y}∈Ω, PlotRange -> All, PlotStyle -> Green]分数阶微分方程 (8)
sol = DSolveValue[CaputoD[y[x], {x, 1 / 2}] - 3 y[x] == 0, y[x], x]CaputoD[y[x], {x, 1 / 2}] == 3y[x] /. y[x] -> sol//FullSimplifysol = DSolveValue[{CaputoD[y[x], {x, 1 / 2}] - 3 y[x] == 0, y[0] == 5}, y[x], x]Plot[sol, {x, 0, 1}]求解包含 0.7 阶 CaputoD 的分数微分方程:
sol = DSolveValue[CaputoD[y[x], {x, 0.7}] + 3 y[x] == 0, y[x], x]CaputoD[y[x], {x, 0.7}] + 3y[x] == 0 /. y[x] -> sol//FullSimplifysol = DSolveValue[{CaputoD[y[x], {x, 0.7}] + 3 y[x] == 0, y[0] == 4}, y[x], x];
Plot[sol, {x, 0, 1}]sol = DSolveValue[{CaputoD[y[x], {x, 3 / 4}] == -2CaputoD[y[x], {x, 1 / 2}] + y[x], y[0] == 1}, y[x], x]Plot[sol, {x, 0, 1}]sol = DSolveValue[{CaputoD[y[x], {x, 1 / 7}] == 8 (1 - y[x]), y[0] == 2}, y, x]{CaputoD[y[x], {x, 1 / 7}] == 8 (1 - y[x]), y[0] == 2} /. y -> sol//Simplifyeqns = {CaputoD[x1[t], {t, 0.95}] == 2x1[t] - x2[t], CaputoD[x2[t], {t, 0.95}] == 4x1[t] - 3x2[t], x1[0] == 1.2, x2[0] == 4.2};sol = DSolveValue[eqns, {x1, x2}, t]eqns /. {x1 -> sol[[1]], x2 -> sol[[2]]}//SimplifyParametricPlot[Evaluate[{sol[[1]][t], sol[[2]][t]}], {t, 0, 2}]m = {{0, 1}, {-1, 0}};
a = 16 / 17;
v = {-3, 5};
sol = DSolveValue[{CaputoD[x[t], {t, a}] == m. x[t], x[0] == v}, Element[x[t], Vectors[2]], t]Plot[Evaluate[sol], {t, 0, 10}]ParametricPlot[Evaluate[sol], {t, 0, 20}]m = {{-1, 0, 0}, {2, 1, -9}, {3, 6, 1}};
a = 0.95;
v = {-3, 5, 0};sol = DSolveValue[{CaputoD[x[t], {t, a}] == m. x[t], x[0] == v}, Element[x[t], Vectors[3]], t]Plot[Evaluate[sol], {t, 0, 1}]a = 19 / 10;
fweqn = CaputoD[y[t, x], {t, a}] == D[y[t, x], {x, 2}];
ic = {y[0, x] == Sin[Pi x], Derivative[1, 0][y][0, x] == 0, y[t, 0] == 0, y[t, 1] == 0};sol = DSolveValue[{fweqn, ic}, y[t, x], {t, x}]Plot3D[sol, {x, -5, 5}, {t, 0, 1}, PlotPoints -> 25]系统模型 (9)
计算正弦输入时 StateSpaceModel 的 OutputResponse 和 StateResponse:
DSolveValue[Sin[t] -> StateSpaceModel[{{{a}}, {{b}}, {{c}}, {{d}}}], "OutputResponse", t]DSolveValue[Sin[t] -> StateSpaceModel[{{{a}}, {{b}}, {{c}}, {{d}}}], "StateResponse", t]DSolveValue[Sin[10t] -> TransferFunctionModel[{{{1}}, 1 + s}, s], "OutputResponse", t]tfm = TransferFunctionModel[{{{1}}, 5 + s + s^2}, s];sr = DSolveValue[tfm, "StepResponse", t]//PiecewiseExpandir = DSolveValue[tfm, "ImpulseResponse", t]rr = DSolveValue[tfm, "RampResponse", t]//PiecewiseExpandPlot[{sr, ir, rr}, {t, 0, 10}, PlotRange -> All, PlotLegends -> {"Step response", "Impulse response", "Ramp response"}]DSolveValue[{0 -> StateSpaceModel[{{{-2, 0.8, 0}, {-0.8, -2, 0}, {0, 0, -1}}, {{1}, {0}, {-1}}, {{1, 0, 0}}, {{0}}},
SamplingPeriod -> None, SystemsModelLabels -> None], {1, 0.1, 1}}, "OutputResponse", t]DSolveValue[{Sin[2t - Pi / 2], Sin[t]} -> TransferFunctionModel[{{{1, 1}, {1, 1}}, {{s, 1 + s},
{2 + s, 3 + s}}}, s], "OutputResponse", {t, 0, 20}]Plot[Evaluate@%, {t, 0, 20}]sys = StateSpaceModel[TransferFunctionModel[{{{1, 1}}, {{-a + s,
-b + s}}}, s]]DSolveValue[Sin[t] -> sys, "OutputResponse", t]DSolveValue[Sin[t] -> sys, {"OutputResponse", #1 + #2&}, t]Expand[DSolveValue[{u[t] -> StateSpaceModel[{{{a}}, {{b}}}, SamplingPeriod -> None,
SystemsModelLabels -> None], {Subscript[x, 0]}}, "StateResponse", t]]DSolveValue[{UnitStep[t] -> StateSpaceModel[{{{a}}, {{b}}}, SamplingPeriod -> None,
SystemsModelLabels -> None], {Subscript[x, 0]}}, "StateResponse", t]描述符 StateSpaceModel 的状态响应:
Expand[DSolveValue[{u[t] -> StateSpaceModel[{{{a}}, {{b}}, {{c}}, {{d}},
{{e}}}, SamplingPeriod -> None, SystemsModelLabels -> None], {Subscript[x, 0]}}, "StateResponse", t]]描述符 StateSpaceModel 的输出响应:
Expand[DSolveValue[{u[t] -> StateSpaceModel[{{{a}}, {{b}}, {{c}}, {{d}},
{{e}}}, SamplingPeriod -> None, SystemsModelLabels -> None], {Subscript[x, 0]}}, "OutputResponse", t]]推广和延伸 (2)
DSolveValue[{y''[x] + y[x] == 0, y[0] == 0, y'[0] == 1}, y'[x], x]DSolveValue[y''[x] + 4y[x] == 0, y, x]DSolveValue[{y''[x] + 4y[x] == 0, y[0] == 1}, y, x]DSolveValue[{y''[x] + 4y[x] == 0, y[0] == 1, y'[0] == 4}, y, x]选项 (5)
Assumptions (1)
DSolveValue[{y''[x] + λy[x] == 0, y[0] == 0, y[π] == 0}, y[x], x]用 Assumptions 指定参数 λ 的范围:
DSolveValue[{y''[x] + λy[x] == 0, y[0] == 0, y[π] == 0}, y[x], x, Assumptions -> 0 < λ < 20]DiscreteVariables (1)
GeneratedParameters (2)
DSolveValue[y''[x] == y[x], y[x], x, GeneratedParameters -> d]DSolveValue[y''[x] == y[x], y[x], x, GeneratedParameters -> (Subscript[c, #]&)]DSolveValue[y''[x] == y[x], y[x], x, GeneratedParameters -> Unique[C]]在 DSolveValue 的不同调用间,积分常数是惟一的:
DSolveValue[y''[x] == y[x], y[x], x, GeneratedParameters -> Unique[C]]Method (1)
DSolveValue[{y''[x] + y[x] == 0, y[0] == 0, y'[0] == 1}, y[x], x]获取以 DifferentialRoot 形式给出的解:
DSolveValue[{y''[x] + y[x] == 0, y[0] == 0, y'[0] == 1}, y[x], x, Method -> "Holonomic"]应用 (41)
常微分方程 (12)
sol = DSolveValue[{y'[x] == y[x](1 - y[x] / 27), y[0] == a}, y, x]//QuietPlot[sol[x] /. {{a -> 1 / 13}, {a -> 1 / 2}, {a -> 4}}//Evaluate, {x, 0, 18}]sol = DSolveValue[{y''[x] + y[x] == 0, y[0] == 1, y'[0] == 1 / 3}, y , x]Plot[sol[x], {x, 0, 17}]sol = DSolveValue[{y''[x] + 3y'[x] + 40 y[x] == 0, y[0] == 1, y'[0] == 1 / 3}, y, x]Plot[sol[x], {x, 0, 4}, PlotRange -> All]phase[x_] = DSolveValue[{y''[x] + 3y'[x] + 40 y[x] == 0, y[0] == 1, y'[0] == 1 / 3}, {y[x], y'[x]}, x];ParametricPlot[phase[x], {x, 0, 4}, PlotRange -> All, AspectRatio -> 1]{sol1, sol2} = DSolveValue[{x'[t] == -2y[t] + 3x[t], y'[t] == 15x[t] - y[t], x[0] == a, y[0] == b}, {x, y}, t];ParametricPlot[Evaluate[Table[{sol1[t], sol2[t]} /. {a -> 1 / (13 + m), b -> 1 / (15 + m)}, {m, 0, 20, 7}]], {t, -2, 2}]DSolveValue[{y'[x] + Exp[x]y[x] == 1, y[0] == 3}, y[x] , x]Series[%, {x, 0, 7}]计算 Infinity 处的极限值:
DSolveValue[{x''[t] - E ^ (-x'[t]) + x[t] == 0, x[0] == 1, x'[0] == 5}, x[∞], t]//Quiet模拟移动传送带上的物块,该传送带通过弹簧固定在墙上. 比较系统参数(物块的质量、皮带速度、摩擦系数、弹簧常数)取不同值时的位置和速度:
beltv[t_] = vb;
spring[x_] = k(l - x);
friction[v_] := -a(v - beltv[t]);sys := {m x''[t] == spring[x[t]] + friction[x'[t]], x[0] == l, x'[0] == 0};{pos[m_, k_, a_, vb_, t_], vel[m_, k_, a_, vb_, t_]} = DSolveValue[sys, {x[t], x'[t]}, {t, 0, 2}]//FullSimplifyl = 1;
Manipulate[{Plot[{pos[m, k, a, vb, t]}, {t, 0, 2}, PlotRange -> All, PlotLabel -> "Position"], Plot[{vel[m, k, a, vb, t], vb}, {t, 0, 2}, PlotRange -> All, PlotLabel -> "Velocity"]}, {{m, 1, "mass of the block"}, 1, 10, 1}, {{k, 100, "spring constant"}, 100, 1000, 100}, {{vb, 1, "belt velocity"}, 1, 10, 1}, {{a, 5, "friction coefficient"}, 5, 45, 10}, SaveDefinitions -> True]使用元件定律和基尔霍夫连接定律来模拟 RLC 电路对在时间
施加的电压
中的阶跃脉冲的响应:
ClearAll[r, l, c];
vR[t_] := r iL[t];
vL[t_] := v1[t] - vR[t] - vC[t];
sys = {l iL'[t] == vL[t], c vC'[t] == iL[t]};v1[t_] := UnitStep[t - .01];
ic = {iL[0] == 0, vC[0] == 0};{iL1[r_, c_, l_, t_], vC1[r_, c_, l_, t_]} = DSolveValue[Flatten[{sys, ic}], {iL[t], vC[t]}, t];Manipulate[{Plot[Evaluate[{v1[t], Re[vC1[r, c, l, t]]}], {t, 0, .03}, Filling -> {1 -> 0}, Ticks -> {Range[0.01, 0.03, 0.01], Automatic}, PlotRange -> All, PlotLabel -> "SubscriptBox[V, C][t]"], Plot[Evaluate[Re[iL1[r, c, l, t]]], {t, 0, .03}, Ticks -> {Range[0.01, 0.03, 0.01], Automatic}, PlotRange -> All, PlotLabel -> "I[t]"]}, {{r, 1, "R"}, 1, 10, 1}, {{l, 10^-2, "L"}, 10^-2, 5 10^-2, 10^-2}, {{c, 10^-4, "C"}, 10^-4, 5 10^-4, 10^-4}, SaveDefinitions -> True]当水通过管道从一个水箱流到另一个水箱时,模拟两个圆柱形水箱中水的高度变化:
p1[t_] := ρ g h1[t];
p2[t_] := ρ g h2[t];flowRate = (p1[t] - p2[t])(π pipeDia ^ 4) / (128 μ pipeLen);
massConservation = {a1 h1'[t] == -flowRate, a2 h2'[t] == flowRate};
ic = {h1[0] == 1, h2[0] == 0};{h1[t_], h2[t_]} = DSolveValue[Flatten[{massConservation, ic}], {h1[t], h2[t]}, t]params = {pipeLen -> 0.1, pipeDia -> 0.2, a1 -> 1, a2 -> 1, ρ -> 0.2, μ -> 2 10 ^ -3, g -> 9.81};Plot[Evaluate[{h1[t], h2[t]} /. params], {t, 0, 15}, PlotRange -> All, PlotLegends -> {"SubscriptBox[h, 1][t]", "SubscriptBox[h, 2][t]"}]DSolveValue[{CaputoD[x[t], {t, 1.9}] + x[t] == 0, x[0] == 1, x'[0] == 0}, x[t], t]fracsol = Plot[%, {t, 0, 20}]dampedOsc = DSolveValue[{x''[t] + a x'[t] + x[t] == 0, x[0] == 1, x'[0] == 0}, x[t], t]//FullSimplify用阻尼振子的解拟合分数振子的数据,以确定阻尼因子
的相应值:
data = Cases[InputForm[fracsol], Line[m_] :> m, -1][[1]];
fit = FindFit[data, dampedOsc, a, t]dampedsol = Plot[dampedOsc /. fit, {t, 0, 20}];
Show[fracsol, dampedsol]LCeqn[α_, l_, c_] = {CaputoD[i[t], {t, α}] + (1/l c)i[t] == 0, i[0] == 0.1, i'[0] == 0};LCsol[α_, l_, c_] := DSolveValue[LCeqn[α, l, c], i[t], t];LCsol[2, l, c]LCsol[1.9, l, c]Plot[Evaluate[{LCsol[2, 1, 1], LCsol[1.9, 1, 1], LCsol[1.8, 1, 1]}], {t, 0, 10}, PlotLegends -> {"α=2", "α=1.9", "α=1.8"}]RCeqn[α_, r_, c_] = {CaputoD[v[t], {t, α}] + (1/r c)v[t] == 0, v[0] == 20};RCsol[α_, r_, c_] := DSolveValue[RCeqn[α, r, c], v[t], t]RCsol[1, r, c]RCsol[0.9, r, c]Plot[Evaluate[{RCsol[1, 10, 1], RCsol[0.9, 10, 1], RCsol[0.8, 10, 1]}], {t, 0, 100}, PlotLegends -> {"α=1", "α=0.9", "α=0.8"}]混合微分方程 (8)
system = {x''[t] + .1x'[t] + x[t] == 0, x[0] == 1, x'[0] == 0};
control = WhenEvent[Mod[t, 1] == 0, x'[t] -> x'[t] + 1];sol = DSolveValue[{system, control}, x, {t, 0, 50}];Plot[Evaluate[{sol[t], sol'[t]}], {t, 0, 50}]sol = DSolveValue[{x''[t] + x[t] == 0, x[0] == 0, x'[0] == 1, WhenEvent[x[t] == 0, x'[t] -> -x'[t]]}, x, {t, 0, 4π}]Plot[Evaluate[{Sin[t], sol[t]}], {t, 0, 4π}]c = .75;
sol = DSolveValue[{y''[t] == -9.8, y[0] == 13.5, y'[0] == 5, a[0] == 13, WhenEvent[y[t] - a[t] == 0, y'[t] -> -c y'[t]], WhenEvent[Mod[t, 1], a[t] -> a[t] - 1]}, {y, a}, {t, 0, 8}, DiscreteVariables -> {a}] ;Plot[Evaluate[{y[t], a[t]} /. Thread[{y, a} -> sol]], {t, 0, 8}, Filling -> {2 -> 0}, Exclusions -> None]sol = DSolveValue[{x'[t] == a[t], y'[t] == b[t], x[0] == 0, y[0] == 0, a[0] == 1, b[0] == 17 / 12, WhenEvent[x[t] ^ 2 == 1, a[t] -> -a[t]], WhenEvent[y[t] ^ 2 == 1, b[t] -> -b[t]]}, {x, y}, {t, 0, 50}, DiscreteVariables -> {a, b}];ParametricPlot[{x[t], y[t]} /. Thread[{x, y} -> sol], {t, 0, 50}, Frame -> True, FrameTicks -> None, PlotRange -> 1, Axes -> False]system = {y'[t] == y[t] + u[t], y[0] == 1, u[0] == 0};
control = WhenEvent[Mod[t, 1] == 0, u[t] -> -2y[t]];DSolveValue[{system, control}, {y, u}, {t, 0, 20}, DiscreteVariables -> u];Plot[Evaluate[{u[t], y[t]} /. {Thread[{u, y} -> %]}], {t, 0, 10}, PlotRange -> {-6, 6}, Exclusions -> None]system = {x''[t] == u[t], x[0] == 1, x'[0] == 1, u[0] == -7};τ = 0.5;
control = WhenEvent[Mod[t, τ] == 0, u[t] -> -(1 / τ ^ 2)x[t] - (3 / (2τ))x'[t]];DSolveValue[{system, control}, {x, u}, {t, 0, 2}, DiscreteVariables -> u];Plot[Evaluate[{x[t], x'[t], u[t]} /. Thread[{x, u} -> %]], {t, 0, 2}, PlotRange -> All, Exclusions -> None]system = {x''[t] == u[t], x'[0] == x[0] == 0, u[0] == 1};kp = 1; td = 1;τ = 1; xref = 1;
control = WhenEvent[Mod[t, τ] == 0, u[t] -> kp(xref - x[t] - td x'[t])];DSolveValue[{system, control}, {x, u}, {t, 0, 12}, DiscreteVariables -> u];Plot[Evaluate[{xref, x[t], u[t]} /. Thread[{x, u} -> %]], {t, 0, 12}, Exclusions -> None]sol = DSolveValue[{a'[t] == -1 / 11u[t], a[0] == 1, u[0] == 1,
WhenEvent[a[t] < 0, u[t] -> 0]}, a, {t, 0, 15}, DiscreteVariables -> u]Plot[Evaluate[sol[t]], {t, 0, 15}, PlotRange -> All]时滞微分方程 (2)
sol = DSolveValue[{x'[t] == Sign[x[t - 2]] - x[t - 2], x[t /; t <= 0] == 0.1}, x, {t, 0, 30}];ParametricPlot[Evaluate[{x[t - 2], x[t]} /. {x -> sol}], {t, 2, 30}]f[λ_, μ_] := DSolveValue[{x'[t] == λ x[t] + μ x[t - 1], x[t /; t ≤ 0] == 1 - t}, x[t], {t, 0, 10}]Plot[Evaluate[{f[1 / 2, -1], f[-7 / 2, 4], f[-5, 4]}], {t, 0, 15}, Exclusions -> None]积分方程 (4)
等时降落问题要求找到一条向下的曲线,把珠子放在曲线任一位置,滑落到底的时间都相等. 把总的下降时间用曲线长度和速度 v 表示后,可以导出阿贝尔积分方程
. 通过关系
定义未知函数
并使用能量守恒方程
导出显式方程:
abeleqn = T == Subsuperscript[∫, 0, y](h[z]/Sqrt[2g]Sqrt[y - z])ⅆz;用 DSolveValue 求解积分方程:
DSolveValue[abeleqn, h[y], y]dxdy = Sqrt[%^2 - 1]让曲线从原点开始并积分——并假设被积函数是实数值的——导出以
为自变量的函数
:
x[y_] = Integrate[dxdy, {y, 0, y}, Assumptions -> (2 g T^2 /π^2y) > 1 && y > 0]代换
和
的值,用 ParametricPlot 显示极大等时降线:
Show[ParametricPlot[{{x[y], y}, {-x[y], y}} /. {g -> 9.8, T -> 2}, {y, 0, (2(9.8)2^2/π^2)}], ImageSize -> Medium]变量替换
可以给出一个简单的、非奇异的曲线参数化形式,范围在
之间:
c[θ_] = (g T^2/π^2){Sin[θ] + θ, 1 - Cos[θ]} ;结合能量守恒方程和链式法则
可以得出下列以
为自变量的函数
的微分方程:
FullSimplify[ (Sqrt[2g (Last[c[θMax]] - Last[c[θ]])] /Sqrt[c'[θ].c'[θ]]) , g > 0 && T > 0]teqn = θ'[t] == (% /. {θ -> θ[t], T -> 2});Θ[t_] = Table[NDSolveValue[{teqn, θ[0] == θMax}, θ[t], {t, 0, 4}], {θMax, {-2 Pi / 3, -Pi / 2, -Pi / 4, -Pi / 12}}];Plot[Evaluate[Θ[t]], {t, 0, 4}, PlotTheme -> "Scientific"]{cShape[t_], cBeads[t_]} = {c[t], c /@ Θ[t]} /. {T -> 2, g -> 9.8};
Animate@@{ParametricPlot[cShape[s] , {s, -Pi, Pi}, ImageSize -> Medium, Epilog -> {AbsolutePointSize[8], Point[cBeads[t]]}], {t, 0, 4, Appearance -> "Labeled"}, SaveDefinitions -> True, AnimationDirection -> ForwardBackward}ieqn = 3Derivative[1][v][t] + 2 v[t] + 40 Subsuperscript[∫, 0, t]v[m]ⅆm == 50 Cos[2 t];ic = v[0] == 28;用 DSolveValue 求解积分微分方程:
sol = DSolveValue[{ieqn, ic}, v[t], t]Plot[sol, {t, 0, 8}, PlotRange -> All, Filling -> Axis]
,电感是 ,而电容是 . 一开始,电阻器里的电流为 . 求电流随时间变化的函数:
ieqn = 5 Derivative[1][i][t] + 0.2 i[t] + (1/0.7)Subsuperscript[∫, 0, t]i[m]ⅆm == 2 Cos[t];ic = i[0] == 1;用 DSolveValue 求解积分微分方程:
sol = DSolveValue[{ieqn, ic}, i[t], t]//FullSimplify//ChopPlot[sol, {t, 0, 80}, PlotRange -> All, Filling -> Axis]一个线性沃尔泰拉积分方程等价于一个线性微分方程的初值问题. 为下列沃尔泰拉方程验证这个关系:
eqn = y[x] == x^3 + λSubsuperscript[∫, 0, x](t - x)y[t]ⅆt;用 DSolveValue 求解积分方程:
sol = DSolveValue[eqn, y[x], x]deqn = D[eqn, {x, 2}]init = {(eqn /. {x -> 0}), (D[eqn, x] /. {x -> 0})}DSolveValue[{deqn, init}, y[x], x]//SimplifyPlot[Table[%, {λ, 1, 3, 0.5}]//Evaluate, {x, 0, 20}, Filling -> Axis]经典偏微分方程 (5)
eqn = D[u[x, t], {t, 2}] == D[u[x, t], {x, 2}];bc = {u[0, t] == 0, u[π, t] == 0};ic = {u[x, 0] == Sin[m x], Derivative[0, 1][u][x, 0] == 0};dsol = DSolveValue[{eqn, bc, ic}, u[x, t], {x, t}, Assumptions -> Element[m, Integers]]Table[Show[Plot[Table[dsol, {t, 0, 4}]//Evaluate, {x, 0, Pi}, Ticks -> False]], {m, 4}]ic = {u[x, 0] == x(π - x) ^ 2, Derivative[0, 1][u][x, 0] == 0};dsol = DSolveValue[{eqn, bc, ic}, u[x, t], {x, t}] /. {K[1] -> m}从 Inactive 和中提取四项:
sol[x_, t_] = TruncateSum[dsol, 4]Animate[Plot[sol[x, t], {x, 0, π}, PerformanceGoal -> "Quality", PlotRange -> {-5, 5}, ImageSize -> Medium], {t, 0, 12}, SaveDefinitions -> True]eqn = r D[u[r, t], {t, 2}] == D[r D[u[r, t], r], r];bc = u[1, t] == 0;ic = {u[r, 0] == 0, Derivative[0, 1][u][r, 0] == 1};(dsol = DSolveValue[{eqn, bc, ic}, u[r, t], {r, t}])//TraditionalForm从 Inactive 和中提取有限个项:
h[r_, t_] = TruncateSum[dsol, 3]//N;Animate[Plot3D[h[r, t] /. {r -> Sqrt[x ^ 2 + y ^ 2]}, {x, y}∈Disk[], PlotRange -> {-1, 1}, Ticks -> None, Mesh -> True, MeshStyle -> {Red, Blue}, PlotStyle -> Yellow], {t, 0, 4}, SaveDefinitions -> True]heqn = D[u[x, t], t] == D[u[x, t], {x, 2}];bc = {u[0, t] == 20, u[1, t] == 50};ic = u[x, 0] == 0;sol = DSolveValue[{heqn, bc, ic}, u[x, t], {x, t}]从 Inactive 和中提取若干项:
approxsol = TruncateSum[sol, 3]//ExpandPlot[Table[approxsol, {t, 0.02, 0.5, 0.07}]//Evaluate, {x, 0, 1}, AxesOrigin -> {0, 0}]ssol = DSolveValue[{v''[x] == 0, v[0] == 20, v[1] == 50}, v[x], x]//ExpandPlot[ssol, {x, 0, 1}]heqn = D[u[x, t], t] == D[u[x, t], {x, 2}];bc = {Derivative[1, 0][u][0, t] == 0, Derivative[1, 0][u][1, t] == 0};ic = u[x, 0] == 20 + 80x;sol = DSolveValue[{heqn, bc, ic}, u[x, t], {x, t}]从 Inactive 和中提取若干项:
approxsol = TruncateSum[sol, 4]//ExpandPlot[Table[approxsol, {t, 0.02, 0.9, 0.07}]//Evaluate, {x, 0, 1}, AxesOrigin -> {0, 0}, PlotRange -> All]从实部和虚部在
轴上的值开始,构建一个复解析函数. 实部 u 和虚部 v 满足柯西–黎曼方程:
creqns = {D[u[x, y], x] == D[v[x, y], y], D[v[x, y], x] == -D[u[x, y], y]};xvals = {u[x, 0] == x ^ 3, v[x, 0] == 0};sol[x_, y_] = DSolveValue[{creqns, xvals}, {u[x, y], v[x, y]}, {x, y}]Laplacian[sol[x, y], {x, y}]ContourPlot[sol[x, y], {x, -5, 5}, {y, -5, 5}, ContourStyle -> {Red, Blue}, PlotTheme -> "Marketing"]f[x_, y_] = sol[x, y][[1]] + I sol[x, y][[2]](f[x, y]//Factor) /. {x + I y -> z}一般偏微分方程 (5)
研究当粘性参数变成无限小的极限情况下,伯格斯方程对冲击波的平滑解的演变情况:
eqns = { D[u[x, t], t] + u[x, t]D[u[x, t], x] == ϵ D[u[x, t], {x, 2}] , u[x, 0] == Piecewise[{{1, x < 0}}]};dsol = DSolveValue[eqns, u[x, t], {x, t}]Plot3D[dsol /. {ϵ -> 1 / 10}, {x, -2, 2}, {t, 0.001, 5}]Table[Plot3D[dsol /. {ϵ -> 1 / 1000}, {x, -2, 2}, {t, 0.001, 5}, Exclusions -> All, Ticks -> None], {ϵ, {1 / 10, 1 / 100, 1 / 1000}}]//Quiet一个被限制在长度为 d 的一位盒上移动的电子遵守端点处狄利克雷条件下的自由薛定谔方程:
eqn = I ℏ D[ψ[x, t], t] == (-ℏ^2/2m) D[ψ[x, t], {x, 2}];
bcs = {ψ[0, t] == 0, ψ[d, t] == 0};DSolveValue[Join[{eqn}, bcs], ψ[x, t], {x, t}]和中的每一项被称为定态,因为用正弦函数作为初始条件会使位置概率密度
与时间无关. 例如:
sol1 = DSolveValue[Join[{eqn, ψ[x, 0] == Sqrt[(2/d)]Sin[Pi(x/d)]}, bcs], ψ[x, t], {x, t}]ρ1[x_, t_] = Simplify[ComplexExpand[Conjugate[sol1]sol1], d > 0]将初始数据归一化,以使密度的积分(在某处发现粒子的总概率)为 1:
Integrate[ρ1[x, t], {x, 0, d}]任意其它初始条件,即便简单到只是两个定态的和,都会导致产生复杂的含时密度:
sol2 = DSolveValue[Join[{eqn, ψ[x, 0] == (1/Sqrt[d])Sin[Pi(x/d)] + (1/Sqrt[d])Sin[2Pi(x/d)]}, bcs], ψ[x, t], {x, t}]ρ2[x_, t_] = Simplify[ComplexExpand[Conjugate[sol2]sol2], d > 0]Integrate[ρ2[x, t], {x, 0, d}]用国际单位制中的单位输入电子的质量和
的值,并将 d 设为典型的原子间距离,1 纳米,得到下列密度函数:
ρe[x_, t_] = ρ2[x, t] /. {ℏ -> 1.055*^-34, m -> 9.109 * 10 ^ -31, d -> 10 ^ -9}Plot3D[ρe[x 10^-9, t 10^-15]10^-9, {x, 0, 1}, {t, 0, 3.66}, PlotTheme -> {"Grid", "LargeLabels"}, AxesLabel -> {"x (nm)", "t (fs)", "ρe (SuperscriptBox[nm, -1])"}, ImageSize -> Medium]将图像作成概率密度电影,可以看出电子的“中心”在盒子两个边之间来回移动:
Animate[Plot[ρe[x, t], {x, 0, 10 ^ -9}, PerformanceGoal -> -"Quality", PlotRange -> {0, 4*^9}, ImageSize -> Medium, AxesLabel -> {"x (m)", "ρe (SuperscriptBox[m, -1])"}], {t, 0, 3.66*^-15}, SaveDefinitions -> True]如果标的资产价格和执行价格都是 $100,无风险利率为 5%,资产波动幅度为 20%,偿还期限为一年,用布莱克–舒尔斯模型求欧洲香草买入期权的价值:
BlackScholesModel = {D[c[t, s], t] + 1 / 2σ ^ 2 s ^ 2 D[c[t, s], {s, 2}] + r s D[c[t, s], s] - r c[t, s] == 0, c[T, s] == Max[s - k, 0]};dsol = DSolveValue[BlackScholesModel, c[t, s], {t, s}]dsol /. {t -> 0, s -> 100, k -> 100, σ -> 0.2, T -> 1, r -> 0.05}和 FinancialDerivative 给出的值进行比较:
FinancialDerivative[{"European", "Call"}, {"StrikePrice" -> 100.00, "Expiration" -> 1}, {"InterestRate" -> 0.05, "Volatility" -> 0.2, "CurrentPrice" -> 100}]sol = DSolveValue[{D[f[x, y], x] == x y Cos[x y] + Sin[x y],
D[f[x, y], y] == -E^-y + x^2 Cos[x y]}, f[x, y], {x, y}]Plot3D[Table[sol /. {C[1] -> k}, {k, 1, 22, 5}]//Evaluate, {x, 0, 10}, {y, 0, 2}, PlotRange -> All]sol = DSolveValue[{(1 - x)D[u[x, y], x] == y u[x, y], u[0, y] == 1}, u[x, y], {x, y}]Table[(-1) ^ i SeriesCoefficient[ Series[sol, {x, 0, 10}, {y, 0, 4}], {10, i}]10!, {i, 4}]StirlingS1[10, Range[4]]系统模型 (5)
tfm = TransferFunctionModel[{{{1}}, 5 + s + s^2}, s];ir[τ_] = DSolveValue[tfm, "ImpulseResponse", τ]使用 UnilateralConvolve 以获得正弦输入的模型输出响应:
lconv[t_] = UnilateralConvolve[ir[τ], Sin[τ], τ, t]Animate[
GraphicsRow[{
Plot[{ir[τ], Sin[t - τ]}, {τ, 0, 2Pi}, ...],
Plot[ir[τ] Sin[t - τ]UnitStep[t - τ], {τ, 0, 2Pi}, ...],
Plot[lconv[τ], {τ, 0, t}, ...]}, ImageSize -> 480], {t, 0, 2Pi}]使用 DSolveValue 计算正弦输入的输出响应:
or = DSolveValue[{Sin[t] -> tfm}, "OutputResponse", t]or - lconv[t]//FullSimplifyy = DSolveValue[TransferFunctionModel[{{{1}}, 1 + 10*s}, s], "StepResponse", t];Subscript[y, ss] = Limit[y, t -> ∞]τ = t /. FindRoot[y == (1 - (1/E)) Subscript[y, ss], {t, 1}]With[{y1 = y /. t -> τ}, Plot[y, {t, 0, 40}, Epilog -> {Dashed, Line[{{τ, 0}, {τ, y1}, {0, y1}}], PointSize[Medium], Point[{{τ, y1}}]}]]ssm = StateSpaceModel[{{{0, 0, -10, 0}, {0, 0, 0, 10}, {3.7, 0, -2, 0}, {0, -0.6, 0, -5}},
{{0, 0}, {0, 0}, {8.533, 0}, {0, 8.533}}, {{0.5, 0.5, 0, 0}, {-2.113, 2.113, 0.375, 0.375}},
{{0, 0}, {0, 0}}}, SamplingPeriod -> None, SystemsModelLabels -> None];MapIndexed[Plot[#, {t, 0, 5}, PlotRange -> All, PlotLabel -> "Input " <> ToString@First@#2 <> " -> " <> " State " <> ToString@Last@#2]&, DSolveValue[UnitStep[t] -> ssm, "StateResponse", t]//Simplify//Chop, {2}]生产和库存系统模型的状态空间模型,以期望生产率和销售率为输入,以实际生产率和库存水平为状态:
ssm = StateSpaceModel[{{{-1, -0.1875}, {1, 0}}, {{0.1875, 0}, {0, -1}}}, SamplingPeriod -> None,
SystemsModelLabels -> None];确定在给定生产率和销售额从初始平衡条件跃升 10% 的情况下的响应:
resp = DSolveValue[{{Subscript[u, 1], 1.1 Subscript[x, 10]} -> ssm, {Subscript[x, 10], Subscript[u, 1]}}, "StateResponse", t]//Expand//ChopPlot[Evaluate[resp] /. {Subscript[x, 10] -> 1, Subscript[u, 1] -> 6}, {t, 0, 50}, PlotStyle -> {Thickness[0.005], Dashing[{0.05, 0.01}]}, PlotRange -> All, AxesOrigin -> {0, 0}, PlotLabel -> "State response", AxesLabel -> {"t"}]Clohessy–Wiltshire 方程模拟了围绕中心天体运行的两颗卫星之间的相对运动:
sat = StateSpaceModel[{{{0, 1, 0, 0, 0, 0}, {3*n^2, 0, 0, 2*n, 0, 0},
{0, 0, 0, 1, 0, 0}, {0, -2*n, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 1},
{0, 0, 0, 0, -n^2, 0}}, {{0, 0, 0}, {1, 0, 0}, {0, 0, 0}, {0, 1, 0}, {0, 0, 0},
{0, 0, 1}}, {{1, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0}, {0, 0, 1, 0, 0, 0}},
{{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}}, SamplingPeriod -> None, SystemsModelLabels -> None];使用 DSolveValue 以获得特定发射条件下的封闭相对轨道:
n = 0.001;Subscript[x, 0] = 1;Subscript[xd, 0] = 0.0005;
x = Map[DSolveValue[{{0, 0, 0} -> sat, {Subscript[x, 0], Subscript[xd, 0], (2Subscript[xd, 0]/n), -2n Subscript[x, 0], Sequence@@##}}, "StateResponse", {t, 0, 5 (2Pi/n)}]&, {{-2 Subscript[x, 0], -2 Subscript[xd, 0]}, {2 Subscript[x, 0], 2 Subscript[xd, 0]}}];ParametricPlot3D[{x[[1, 1 ;; 5 ;; 2]], x[[2, 1 ;; 5 ;; 2]]}, {t, 0, 5 (2Pi/n)}, BoxRatios -> {1, 1, 1}, AxesLabel -> {"X", "Y", "Z"}]属性和关系 (12)
DSolveValue 返回解的表达式:
DSolveValue[{y'[x] == y[x], y[0] == 1}, y[x], x]DSolve 返回解的规则:
DSolve[{y'[x] == y[x], y[0] == 1}, y[x], x]sol = DSolveValue[{y''[x] - y[x] == 0, y[0] == 1, y'[0] == 4}, y, x]Simplify[{y''[x] - y[x] == 0, y[0] == 1, y'[0] == 4} /. y -> sol]对应于 Integrate 的微分方程:
DSolveValue[y'[x] == Exp[x ^ 2], y[x], x]Integrate[Exp[x ^ 2], x]用 NDSolveValue 求数值解:
exactsol = DSolveValue[{y''[x] + y[x] == 0, y[0] == 1, y'[0] == 0}, y, x]Table[exactsol[x], {x, -2., 2}]numsol = NDSolveValue[{y''[x] + y[x] == 0, y[0] == 1, y'[0] == 0}, y, {x, -2, 2}]Table[numsol[x], {x, -2., 2}]使用 AsymptoticDSolveValue 找到渐进扩展:
dsol = DSolveValue[{y'[x] - 2y[x] == 0, y[0] == 1}, y[x], x]Series[%, {x, 0, 4}]//NormalAsymptoticDSolveValue[{y'[x] - 2y[x] == 0, y[0] == 1}, y[x], {x, 0, 4}]用 DEigensystem 计算特征值和特征函数:
{ℒ, ℬ} = {-Laplacian[u[x], {x}], DirichletCondition[u[x] == 0, True]};DSolveValue[{u''[x] + λ u[x] == 0, u[0] == 0, u[π] == 0}, u[x], x]DEigensystem[{ℒ, ℬ}, u[x], {x, 0, Pi}, 3]用 DSolveValue 计算脉冲响应:
DSolveValue[y'''[x] - 5y''[x] + 9y'[x] - 5y[x] == DiracDelta''[x] + 2DiracDelta'[x] + DiracDelta[x] && y[-1] == 0 && y'[-1] == 0 && y''[-1] == 0, y[x], x]//FullSimplify用 InverseLaplaceTransform 执行同一计算:
InverseLaplaceTransform[(s ^ 2 + 2s + 1/s ^ 3 - 5s ^ 2 + 9s - 5), s, x]//FullSimplify如果符号解失败,用 N[DSolveValue[…]] 调用 NDSolveValue:
DSolveValue[{y''[x] + x ^ 2 y'[x] + Tan[y[x]] == 1, y[0] == 1, y'[0] == 1}, y, {x, 0, 1}]sol = N[%]Table[sol[x], {x, 0, 1, 0.2}]CompleteIntegral 求非线性偏微分方程 (PDE) 的完全积分:
deqn = D[u[x, y], x] + D[u[x, y], y] ^ 2 == 3;CompleteIntegral[deqn, u[x, y], {x, y}]DSolveValue 返回相同解,但带有警告信息:
DSolveValue[deqn, u[x, y], {x, y}]使用 CompleteIntegral 求线性偏微分方程 (PDE) 的完全积分:
deqn = D[u[x, y], x] + 2D[u[x, y], y] == 1;CompleteIntegral[deqn, u[x, y], {x, y}]DSolveValue 返回此偏微分方程 (PDE) 的通解:
DSolveValue[deqn, u[x, y], {x, y}]用 DFixedPoints 求由两个 ODE 组成的方程组的固定点:
DFixedPoints[{x'[t] == -x[t] - y[t] - 1, y'[t] == 2x[t] - y[t] + 5}, {x, y}, t]用 DStabilityConditions 分析固定点的稳定性:
DStabilityConditions[{x'[t] == -x[t] - y[t] - 1, y'[t] == 2x[t] - y[t] + 5}, {x, y}, t]DSolveValue[{x'[t] == -x[t] - y[t] - 1, y'[t] == 2x[t] - y[t] + 5, x[0] == -2, y[0] == 1}, {x[t], y[t]}, t]//Simplifysol = DSolveValue[{x'[t] == -x[t] - y[t] - 1, y'[t] == 2x[t] - y[t] + 5, x[0] == 3, y[0] == -2}, {x[t], y[t]}, t]//SimplifyPlot[Evaluate[sol], {t, 0, 20}]sim = SystemModelSimulate[[image]]SystemModelPlot[sim]可能存在的问题 (5)
如果解有多个分支,DSolveValue 只返回一个分支:
DSolveValue[{y'[x] + y[x] == Sin[x], y'[0] ^ 2 == 1}, y[x], x]用 DSolve 得到解的所有分支:
DSolve[{y'[x] + y[x] == Sin[x], y'[0] ^ 2 == 1}, y[x], x]sol = DSolveValue[y'[x] == f[x], y[x], x]sol /. f -> Function[x, 0]使用 Activate 运算积分:
Activate[%]DSolveValue[x'[K] == K ^ K, x[K], K]DSolveValue[x'[C] == C ^ C, x[C], C]DSolveValue[x'[k] == k ^ k, x[k], k]DSolveValue[x'[c] == c ^ c, x[c], c]y[x_] := Cos[x]DSolveValue[{y'[x] == 0, y[0] == 1}, y, x]Clear[y]DSolveValue[{y'[x] == 0, y[0] == 1}, y[x], x]eqn = y''[x] + (k + g1 / (a + x)) y'[x] + (m + g2 / (a + x)) y[x] == 0;sol = DSolveValue[eqn, y[x], x]sol /. {g1 -> 0, g2 -> 0}//SimplifyDSolveValue[eqn /. {g1 -> 0, g2 -> 0}, y[x], x]巧妙范例 (2)
{x, y, t} = DSolveValue[{x'[s] == Cos[t[s]], y'[s] == Sin[t[s]], t'[s] == s, x[0] == 0, y[0] == 0, t[0] == 0}, {x, y, t}, s]ParametricPlot[{x[s], y[s]}, {s, -10, 10}]sol = DSolveValue[(-((192n(1 + n)x ^ 5) / (1 - x ^ 2) ^ 6) + (2496n(1 + n)x ^ 3) / (1 - x ^ 2) ^ 5 - (8160n ^ 2(1 + n) ^ 2x ^ 3) / (1 - x ^ 2) ^ 5 - (1632n(1 + n)x) / (1 - x ^ 2) ^ 4 + (7824n ^ 2(1 + n) ^ 2x) / (1 - x ^ 2) ^ 4 - (6912n ^ 3(1 + n) ^ 3x) / (1 - x ^ 2) ^ 4)y[x] + ((64x ^ 6) / (1 - x ^ 2) ^ 6 - (1824x ^ 4) / (1 - x ^ 2) ^ 5 + (8256n(1 + n)x ^ 4) / (1 - x ^ 2) ^ 5 + (2880x ^ 2) / (1 - x ^ 2) ^ 4 - (19200n(1 + n)x ^ 2) / (1 - x ^ 2) ^ 4 + (22896n ^ 2(1 + n) ^ 2x ^ 2) / (1 - x ^ 2) ^ 4 - 272 / (1 - x ^ 2) ^ 3 + (2208n(1 + n)) / (1 - x ^ 2) ^ 3 - (4384n ^ 2(1 + n) ^ 2) / (1 - x ^ 2) ^ 3 + (2304n ^ 3(1 + n) ^ 3) / (1 - x ^ 2) ^ 3)
y'[x] + (-((2016x ^ 5) / (1 - x ^ 2) ^ 5) + (9408x ^ 3) / (1 - x ^ 2) ^ 4 - (19488n(1 + n)x ^ 3) / (1 - x ^ 2) ^ 4 - (3696x) / (1 - x ^ 2) ^ 3 + (12768n(1 + n)x) / (1 - x ^ 2) ^ 3 - (9408n ^ 2(1 + n) ^ 2x) / (1 - x ^ 2) ^ 3)y''[x] + ((4816x ^ 4) / (1 - x ^ 2) ^ 4 - (7168x ^ 2) / (1 - x ^ 2) ^ 3 + (9632n(1 + n)x ^ 2) / (1 - x ^ 2) ^ 3 + 616 / (1 - x ^ 2) ^ 2 - (1456n(1 + n)) / (1 - x ^ 2) ^ 2 + (784n ^ 2(1 + n) ^ 2) / (1 - x ^ 2) ^ 2)y'''[x] + (-((2800x ^ 3) / (1 - x ^ 2) ^ 3) + (1400x) / (1 - x ^ 2) ^ 2 - (1400n(1 + n)x) / (1 - x ^ 2) ^ 2)
y''''[x] + ((560x ^ 2) / (1 - x ^ 2) ^ 2 - 70 / (1 - x ^ 2) + (56n(1 + n)) / (1 - x ^ 2))y'''''[x] - (42x y''''''[x]) / (1 - x ^ 2) + y'''''''[x] == 0, y[x], x]技术笔记
文本
Wolfram Research (2014),DSolveValue,Wolfram 语言函数,https://reference.wolfram.com/language/ref/DSolveValue.html (更新于 2026 年).
CMS
Wolfram 语言. 2014. "DSolveValue." Wolfram 语言与系统参考资料中心. Wolfram Research. 最新版本 2026. https://reference.wolfram.com/language/ref/DSolveValue.html.
APA
Wolfram 语言. (2014). DSolveValue. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/DSolveValue.html 年
BibTeX
@misc{reference.wolfram_2026_dsolvevalue, author="Wolfram Research", title="{DSolveValue}", year="2026", howpublished="\url{https://reference.wolfram.com/language/ref/DSolveValue.html}", note=[Accessed: 13-September-2026]}
BibLaTeX
@online{reference.wolfram_2026_dsolvevalue, organization={Wolfram Research}, title={DSolveValue}, year={2026}, url={https://reference.wolfram.com/language/ref/DSolveValue.html}, note=[Accessed: 13-September-2026]}