I am an beginner in using dynamics as well as mathematica. I am trying to ask mathematica to solve and plot the solution of X'=AX with dynamic every time my matrix A updates. However the Dsolve behaves weirdly and giving a bunch of errors.
Attached is my code
DynamicModule[{a = 3, b = 2, c = 2, d = 3, X, A, system, sol, f},
Row[{
A = {{Dynamic[a], Dynamic[b]}, {Dynamic[c], Dynamic[d]}};
Column[{
Row[{Text["a : "], InputField[Dynamic[a]]}],
Row[{Text["b : "], InputField[Dynamic[b]]}],
Row[{Text["c : "], InputField[Dynamic[c]]}],
Row[{Text["d: "], InputField[Dynamic[d]]}],
Dynamic[A]
}],
X[t_] = {x[t], y[t]};
system = Dynamic[X'[t] == A.X[t]];
(*system=X'[t]\[Equal]{Dynamic[a]*X[t][[1]]+Dynamic[b]*X[t][[2]],
Dynamic[c]*X[t][[1]]+Dynamic[d]*X[t][[2]]}*),
Print["
"],
sol = DSolve[system, {x, y}, t];
particularsols =
Partition[
Flatten[Table[{x[t], y[t]} /. sol /. {C[1] -> i,
C[2] -> j}, {i, -2, 8, 3}, {j, -2, 8, 3}]], 2];
ParametricPlot[Evaluate[particularsols], {t, -3, 3},
PlotRange -> {-3, 3}]
}]
]


DSolveonce is efficiency - it should be faster to substitute in coefficients than to re-solve every time. For the second part of your question, the tutorial I linked probably has better answers. I guess it could be done that way, with some fixes, though I couldn't figure it out. If you want multiple things to re-evaluate automatically,Manipulateis generally much easier to use. I will update the answer to include a version usingManipulate. – MelaGo May 15 '19 at 21:27