0
$\begingroup$

Solve: x' = Ax + b Given: A = {{1, 2}, {3, 4}}; b = {{e^{t}},{2}};

This will solve if b == 0

DSolve[{x1'[t], x2'[t]} == a.{x1[t], x2[t]}, {x1[t], x2[t]}, t]

But if I add "b" I get "DSolve::nolist: ...there should be no lists on either side of the equation" error.

DSolve[{x1'[t], x2'[t]} == a.{x1[t], x2[t]}+b, {x1[t], x2[t]}, t]
$\endgroup$
2
  • $\begingroup$ Could it be that your variable name is a capital A and you DSolve code has a lower case a? For instance DSolve[{x1'[t], x2'[t]} == A.{x1[t], x2[t]} + b, {x1[t], x2[t]}, t] works for me. $\endgroup$ – Michael E2 Oct 11 '20 at 14:01
  • $\begingroup$ Also, generally I avoid starting variable names with capitals so as not to conflict with built-in functions and variables. See #4 in mathematica.stackexchange.com/a/18395/4999 $\endgroup$ – Michael E2 Oct 11 '20 at 14:02
1
$\begingroup$

Try this

A = {{1, 2}, {3, 4}};
b = {E^t, 2};
X = {x1[t], x2[t]};
cinits = Thread[(X /. {t -> 0}) == {1, 2}];
DSolve[{D[X, t] == A.X + b, cinits}, X, t]
$\endgroup$
4
  • $\begingroup$ Why does this work as opposed to what I have? And how would you add initial condition into the DSolve[Thread that you have? Say we have x0[t] = 1 and x1[t] = 2? Thanks! $\endgroup$ – Mathhelp Oct 11 '20 at 5:15
  • $\begingroup$ There are some syntax rules regarding lists handling... $\endgroup$ – Cesareo Oct 11 '20 at 8:17
  • $\begingroup$ @Mathhelp Note that DSolve[{D[X, t] == A.X + b, cinits}, X, t] works without Thread. $\endgroup$ – Michael E2 Oct 11 '20 at 13:52
  • $\begingroup$ Yes. It is now fixed. Thanks. $\endgroup$ – Cesareo Oct 11 '20 at 15:04

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.