0
$\begingroup$

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!

$\endgroup$
7
  • $\begingroup$ The dimensional analysis also carries through if y and the parameters are treated as dimensionless. Indeed, the system is autonomous and therefore mathematically invariant under the transformation $y\rightarrow y+3$, where $3$ could be any other real number. Try Expand[soln]. One of the terms you identified cancels out (at least what I identified from your description). However, you'll still have a constant term 6 I kf C[6] that is supposed to be dimensionless. Try Simplify[soln] and maybe you can justify 3 + y as having the same dimensions as y. Not sure it can be fixed. $\endgroup$
    – Michael E2
    Dec 13, 2020 at 19:29
  • $\begingroup$ Indeed, the problem is having the y+3 as 3 is obviously dimensionless and can't be justified from the equations (which keep the dimensional requirement). Also, it's unclear to me where this 3 stems from. $\endgroup$
    – Oren
    Dec 13, 2020 at 20:38
  • 1
    $\begingroup$ Substituting the DSolve result into the ODEs yields {True, True, True, True, True, True, True}, so the result appears to be correct. $\endgroup$
    – bbgodfrey
    Dec 13, 2020 at 21:15
  • $\begingroup$ How did you check? I used FullSimplify[eqn/.soln] and it doesn't yield as you write. Regardless, I agree that Mathematica thinks it's correct. However, I'm trying to figure out how or why because it's uncanny to give up dimensional analisys like that. $\endgroup$
    – Oren
    Dec 13, 2020 at 22:05
  • 1
    $\begingroup$ Use 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, c1p, c2m, c2p, c3m, c3p, c0}, y] // Flatten to obtain Functions as solutions. Then use Simplify[{ ... }/.{ ... }] where first ... is your list of equations and the second ... is the solution you just obtained. Hope this helps. $\endgroup$
    – bbgodfrey
    Dec 13, 2020 at 22:20

1 Answer 1

1
$\begingroup$

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_4\right) \\ \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.

Checking this solution

Replace the solutions and the derivatives of the solutions and check

deqs /. soln /. dsoln // Simplify

(*  {True, True, True, True, True, True, True}  *)

Original ambiguity

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]  *)

How many ODEs are there?

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.