1
$\begingroup$

Long time reader but first time asker for the Mathematica section.

I'm trying to solve a set of differential equations and it just returns the equations back to me. I'm not entirely sure why, but admit there's probably some strategy I don't know.

Here's the code.

ClearAll["Global`*"];
DSolve[{W'[t] == -12 A W[t]^3 - 4 B - 4 C W[t]*Y[t], 
  X'[t] == 12 A W[t]^3 - 12 B, Y'[t] == 16 B - 16 C W[t]*Y[t], 
  Z'[t] == 20 C W[t]*Y[t], W[0] == 1, X[0] == 0, Y[0] == 0, 
  Z[0] == 0 }, {W[t], X[t], Y[t], Z[t]}, t]

A, B, and C are large and complicated constants, but ultimately just constants. W, X, Y, and Z are all functions of t that I'm trying to solve for, hopefully at least to the point I can plot them. However, when I run the code I just get -

DSolve[{Derivative[1][W][t] == -4 B - 12 A W[t]^3 - 4 C W[t] Y[t], 
  Derivative[1][X][t] == -12 B + 12 A W[t]^3, 
  Derivative[1][Y][t] == 16 B - 16 C W[t] Y[t], 
  Derivative[1][Z][t] == 20 C W[t] Y[t], W[0] == 1, X[0] == 0, 
  Y[0] == 0, Z[0] == 0}, {W[t], X[t], Y[t], Z[t]}, t]

Any help would be appreciated.

$\endgroup$
5
  • $\begingroup$ It means DSolve does not know how to solve it. $\endgroup$
    – Michael E2
    Oct 6 '20 at 16:45
  • $\begingroup$ Thank you, I kind of figured that. Is there something else that would work better? $\endgroup$
    – Jason
    Oct 6 '20 at 17:00
  • $\begingroup$ Note that X and Z depend on W and Y, but W and Y do not depend on X and Z. Therefore, you can first solve for W and Y and afterwards for X and Z. However, even when you make this simplification, DSolve can not solve it. It is possible that there is no closed solution or that MMA is not up to it. But you may try giving numerical values to the constants and use NDSolve. $\endgroup$ Oct 6 '20 at 17:05
  • $\begingroup$ If the constants A, B, and C have numerical values, you can use NDSolve to get a numerical solution. $\endgroup$
    – Michael E2
    Oct 6 '20 at 17:21
  • $\begingroup$ Note that C is a Mathematica built-in symbol. This is why it appears a different color. $\endgroup$ Oct 6 '20 at 19:31
1
$\begingroup$
ClearAll["Global`*"];

eqns = {W'[t] == -12 A W[t]^3 - 4 B - 4 C W[t]*Y[t], 
   X'[t] == 12 A W[t]^3 - 12 B, Y'[t] == 16 B - 16 C W[t]*Y[t], 
   Z'[t] == 20 C W[t]*Y[t], W[0] == 1, X[0] == 0, Y[0] == 0, Z[0] == 0};

tmax = 10;

When DSolve cannot solve the system you need to use a numeric approach. Using ParametricNDSolve

sol = ParametricNDSolve[eqns, {W, X, Y, Z}, {t, 0, tmax}, {A, B, C}]

enter image description here

Manipulate[
 Module[{funcs},
  funcs =
   {W[A, B, C], X[A, B, C], Y[A, B, C], Z[A, B, C]} /. sol;
  Plot[
   Evaluate[(#[t] & /@ funcs) /. sol],
   {t, 0, tmax},
   PlotStyle -> {Automatic, Dashed},
   PlotLegends -> {W, X, Y, Z},
   Frame -> True]],
 {{A, 0}, 0, 1, 0.05, Appearance -> "Labeled"},
 {{B, 0.05}, 0, 1, 0.05, Appearance -> "Labeled"},
 {{C, 0.1}, 0, 1, 0.05, Appearance -> "Labeled"}]

enter image description here

$\endgroup$
1
  • $\begingroup$ I admit I never would have thought of this. I'll need to tweek it a bit to see if it meets my needs but it's a fascinating possibility. $\endgroup$
    – Jason
    Oct 6 '20 at 17:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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