Message Boards Message Boards

0
|
4198 Views
|
3 Replies
|
1 Total Likes
View groups...
Share
Share this post:

[?]Avoid code error on example of p.101-102 Mathematics beyond Mathematics?

Posted 6 years ago

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".

Attachments:
POSTED BY: Samuel Kohn
3 Replies
Posted 6 years ago

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]

POSTED BY: San J
Posted 6 years ago
Attachments:
POSTED BY: Samuel Kohn
Posted 6 years ago

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.

Attachments:
POSTED BY: Samuel Kohn
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract