I'm trying to solve a set of differential equations (in parallel) and then select specific parts of the solution. What I have at the moment (see below-I've simplified the differential equations, in fact they include matrices so that xx, yy and zz will be matrices) works, but uses a lot of memory. Ultimately, I only need the solutions of the differential equations at particular points- is there an efficient way to do this so that Mathematica only remembers the parts I need?
Thanks!
X = SparseArray[KroneckerProduct[{{0, 0, 0, 0, 0}, {0.5, 0, 0, 0, 0}, {1, 0, 0, 0,0}, {0, 0, 0, 0, 0}, {0, 1, 0.5, 0, 0}}, IdentityMatrix[3]]];
\[Rho]g = KroneckerProduct[{{0 , 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 1}}, {{1, 0, 0}, {0, 0, 0}, {0,
0, 0}}];
sol = ParallelTable[NDSolve[{xx'[t] == xx[t], yy'[t] == c*yy[t], zz'[t] == zz[t],xx[0]==\[Rho]g, yy[0] == \[Rho]g, zz[0] == \[Rho]g}, {xx, yy, zz}, {t, 0, 2000}], {c, 0, 1000,10}];
a1[x_, i_] := (xx[t] /. sol[[i, 1]])
a2[x_, i_] := (yy[t] /. sol[[i, 1]])
a3[x_, i_] := (zz[t] /. sol[[i, 1]])
answer[t1_, i_] := Total[X.Transpose[a1[t1, i] - a2[t1, i] - a3[t1, i]], 2]
choosevalues = Table[answer[t1, i], {i, 1, 101}, {t1, 500 + (i - 1)*10, 500 + (i -1)*10 + 1000, 10}];