Mathematica Asked on February 8, 2021
I’m trying to solve a linear system of ODEs:
DSolve[{D[c1m[y], y] == 0, D[c2m[y], y] == 2 I kf c3p[y],
D[c2p[y], y] == 2 I kf c3m[y], -D[c2m[y], y] - A == 0,
D[c1m[y], y] - D[c3m[y], y] == 2 I kf c2p[y],
2 D[c0[y], y] - D[c2p[y], y] - B == 0,
D[c1p[y], y] - D[c3p[y], y] == 2 I kf c2m[y]},
{c1m[y], c1p[y], c2m[y], c2p[y], c3m[y], c3p[y], c0[y]}, {y}]
Note that A
, B
and kf
have dimensions of 1/space, and that the different c’s are dimensionless whereas y
has a space dimension so that this set of ODEs is valid. However, the answer I get for c1p
is dimensionally wrong (involves adding space dimension with space squared).
What am I missing?
Thanks!
One approach that avoids the units ambiguity is to solve the first 5 equations and then solve the other 2 equations, like this
deqs = {
D[c1m[y], y] == 0,
D[c2m[y], y] == 2 I kf c3p[y],
D[c2p[y], y] == 2 I kf c3m[y],
-D[c2m[y], y] - A == 0,
D[c1m[y], y] - D[c3m[y], y] == 2 I kf c2p[y],
2 D[c0[y], y] - D[c2p[y], y] - B == 0,
D[c1p[y], y] - D[c3p[y], y] == 2 I kf c2m[y]};
soln = First@DSolve[deqs[[1 ;; 5]],
{c1m[y], c2m[y], c2p[y], c3m[y], c3p[y]}, y];
dsoln := soln /. Rule[lhs_, rhs_] :> (D[lhs, y] -> D[rhs, y]);
soln = Join[soln, First@DSolve[deqs[[{6, 7}]] /. soln /. dsoln,
{c1p[y], c0[y]}, y]];
soln // ColumnForm // TeXForm
$begin{array}{c} text{c1m}(y)to c_1 text{c2p}(y)to c_2 cosh (2 text{kf} y)+i c_3 sinh (2 text{kf} y) text{c3m}(y)to c_3 cosh (2 text{kf} y)-i c_2 sinh (2 text{kf} y) text{c2m}(y)to c_4-A y text{c3p}(y)to frac{i A}{2 text{kf}} text{c0}(y)to frac{B y}{2}+c_5+frac{1}{2} c_2 cosh (2 text{kf} y)+frac{1}{2} i c_3 sinh (2 text{kf} y) text{c1p}(y)to c_6-2 i text{kf} left(frac{A y^2}{2}-y c_4right) end{array}$
Besides having no ambiguity in the solution for c1p[y]
, this approach yields hyperbolic trig functions, which can be easier to interpret than several exponentials.
Replace the solutions and the derivatives of the solutions and check
deqs /. soln /. dsoln // Simplify
(* {True, True, True, True, True, True, True} *)
Note: the constants C[5]
and C[6]
found below are not the same as those above.
When we solve all 7 DEs at once, the solution for c1p[y]
contains an ambiguity
amb = c1p[y] /. First@DSolve[deqs,
{c1m[y], c1p[y], c2m[y], c2p[y], c3m[y], c3p[y], c0[y]}, y];
amb // Simplify
(* A (I/(2 kf) - I kf y^2) + C[5] + 2 I kf (3 + y) C[6] *)
The y+3
term looks ambiguous, since $y$ has units and 3 does not, but the 3 can be consolidated into the constant $c_5$ by introducing the initial condition c1p[0]
like this
amb /. First@First@Solve[
(Last[amb] /. y -> 0) == c1p[0], C[5]] // Simplify
(* c1p[y] -> -I A kf y^2 + 2 I kf y C[6] + c1p[0] *)
Or by introducing a new constant, C[7]
amb[[-1]] = amb[[-1]] + C[7] - (amb[[-1]] /. y -> 0) // Simplify;
amb
(* c1p[y] -> -I A kf y^2 + 2 I kf y C[6] + C[7] *)
We count 7 DEs in the list, but there are only 6 arbitrary constants. Taken as a separate system, the second and fourth DE's give an algebraic solution for c3p[y]
without a constant of integration.
Answered by LouisB on February 8, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP