skohn
(Samuel Kohn)
1
Please show how to modify what follows so that it is correct.
Clear[x1, x2]
{{x1[t_], x2[t_]}} = {x1[t], x2[t]}
/. DSolve
[
{x1'[t] == 1 - 2.5 x1[t] + x2[t],
x2'[t] == 2 x1[t] - x2[t],
x1[0] == 0,
x2[0] == 0}
{x1[t], x2[t]},
t]
Plot[{x1[t], x2[t]}, {t, 0, 100}]
See attached to see the error messages .
Also it may be a good idea to have Forums dedicated to the various books on Mathematica such as “Mathematica Beyond Mathematics”.
skohn
(Samuel Kohn)
2
Following is an exact quote from the book for the fix up:
José Guillermo Sánchez León - 2017 - ?Science
Clear[x1, x2] {{x1[t_], x2[t_]}} = {x1[t], x2[t]} /. DSolve[ {x1’[t_] == 1 - Rationalize[2.5] x1[t] + x2[t], {x1’[t_]'[t_] == 2 x1[t] - x2[t], x1[0] == 0, x2[0] == 0}, {x1[t], x2[t]}, t] // ExpandAll Plot[{x1[t], x2[t]}, {t, 0, 100}]
PLEASE SEE ATTACHED.
guillerm
(San J)
3
Note: I have checked the book an you has forgotten a “,”
DSolve[{x1’[t] == 1 - 2.5 x1[t] + x2[t], x2’[t] == 2 x1[t] - x2[t], x1[0] == 0, x2[0] == 0} , {x1[t], x2[t]}, t]
skohn
(Samuel Kohn)
4
Got it. Thank you.
Clear[x1, x2]
{{x1[t_], x2[t2_]}} = {x1[t], x2[t]} /.
DSolve[
{x1’[t] == 1 - 2.5 x1[t] + x2[t],
x2’[t] == 2 x1[t] - x2[t],
x1[0] == 0,
x2[0] == 0},
{x1[t], x2[t]}, t]
{{E^(-3.5 t) (-0.219131 E^(0.149219 t) +
4.4408910^-16 E^(0.298438 t) - 1.78087 E^(3.35078 t) +
2. E^(3.5 t) - 6.9388910^-18 E^(6.70156 t)),
E^(-3.5 t) (0.186433 E^(0.149219 t) -
4.44089*10^-16 E^(0.298438 t) - 4.18643 E^(3.35078 t) +
4. E^(3.5 t))}}
Those commas can really cause a considerable amount of frustration.
SUGGESTION, Maybe in future updates recommendations for commas may be suggested by Mathematica - Similar to Grammar and Spell Checks.
In addition, you may also collect some of these errors and have a puzzle section for possible corrections.
Thank you very very much.