# Simplifying the result of DSolve

I have a system of differential equations that can be solved with DSolve. However, the coefficients are very long there are like terms which can be combined. I used //FullSimplify in my code but the output of DSolve is still too complicated. Is there a way for Mathematica to turn all the coefficients into decimals and then combine the like terms?

Remove["Global'*"];
i = 4;
R2 = 0.001 // Rationalize;
RL = 100000;
RS = 100000000;
R1 = 0.04834 // Rationalize;
C1 = 8.48 // Rationalize;
C2 = 3.44 // Rationalize;
s = DSolve[{V1[t] == RS/(RS + R1)*V2[t] + RS*R1*i/(RS + R1),
V2'[t] ==
1/C1*(i R2 RL RS - (R2 RL + R1 (R2 + RL) + (R2 + RL) RS) V2[t] +
RL (R1 + RS) V3[t])/(R2 RL (R1 + RS)),
V3'[t] == 1/C2*(V2[t] - V3[t])/R2, V2 == 0,
V1 == RS*R1*i/(RS + R1), V3 == 0}, {V1[t], V2[t], V3[t]},
t] // FullSimplify

Plot[Evaluate[{V1[t], V2[t], V3[t]} /. s], {t, 0, 5},
PlotStyle -> {Blue, {Green, Thick}, {Red,
AbsoluteDashing[{10, 10}]}}, PlotLegends -> {V1[t], V2[t], V3[t]}]

• s // N // Simplify or Simplify@N@s or Simplify[N[s]]. – march Aug 25 '15 at 19:50
• I tried added these to my code but then there are some errors. I don't think i'm using these commands right. What does s and N stand for or do i just directly copy and paste them into my code? – jerry Aug 26 '15 at 14:01
• s is the name you gave to the output of DSolve. You can look up N in the MMA help files (which you should be in the habit of doing). So s // N // Simplify is a command you would add to the code on the line after the definition of s (and you should remove the FullSimplify). – march Aug 26 '15 at 15:10

i = 4;
R2 = 0.001 // Rationalize;
RL = 100000;
RS = 100000000;
R1 = 0.04834 // Rationalize;
C1 = 8.48 // Rationalize;
C2 = 3.44 // Rationalize;

s = DSolve[{V1[t] == RS/(RS + R1)*V2[t] + RS*R1*i/(RS + R1),
V2'[t] ==
1/C1*(i R2 RL RS - (R2 RL + R1 (R2 + RL) + (R2 + RL) RS) V2[t] +
RL (R1 + RS) V3[t])/(R2 RL (R1 + RS)),
V3'[t] == 1/C2*(V2[t] - V3[t])/R2, V2 == 0,
V1 == RS*R1*i/(RS + R1), V3 == 0}, {V1[t], V2[t], V3[t]},
t] // FullSimplify;

(s[] // Expand) /. n_?NumberQ :> N[n]

(*  {V1[t] -> 399601. - 0.000333138 E^(-408.622 t) - 399600. E^(-8.39765*10^-7 t),
V2[t] -> 399600. - 0.000333138 E^(-408.622 t) - 399600. E^(-8.39765*10^-7 t),
V3[t] -> 399600. + 0.000821224 E^(-408.622 t) - 399600. E^(-8.39765*10^-7 t)}
*)


EDIT: Note that the PatternTest ?NumberQ is used rather than ?NumericQ to avoid converting the constant E to its numerical value.

• wow the addition of that line works wonderfully. Can you explain what is actually going on in it though? I've never seen most of those commands before. – jerry Aug 26 '15 at 14:05
• @jerry - see EDIT. In general, highlight unknown commands or operators and press F1 for help (documentation). – Bob Hanlon Aug 26 '15 at 14:21
• ahh okok ill play around with that then – jerry Aug 26 '15 at 14:47