I want parallelize one task, but got some stupid error. I don't know why i got it and how to fix it. I have 2 examples. One works:
Do[s[a] =
NDSolve[{y'[x] == y[x] Cos[a x + y[x]], y[0] == 1},
y, {x, 0, 5}], {a, 1, 10, .3}]
ListPlot[Table[{a, NIntegrate[y'[x]^2 /. s[a][[1]], {x, 0, 5}]}, {a,
1, 10, .3}], PlotRange -> All]
This fails:
Do[s[a] =
NDSolve[{y'[x] == y[x] Cos[a x + y[x]], y[0] == 1},
y, {x, 0, 5}], {a, 1, 10, .3}]
ListPlot[ParallelTable[{a,
N[Integrate[y'[x]^2 /. s[a][[1]], {x, 0, 5}]]}, {a, 1, 10, .3}],
PlotRange -> All]
Why? How can i fi it?
But if i change increment 0.3 to 0.5:
Do[s[a] =
NDSolve[{y'[x] == y[x] Cos[a x + y[x]], y[0] == 1},
y, {x, 0, 5}], {a, 1, 10, .5}]
ListPlot[Table[{a, NIntegrate[y'[x]^2 /. s[a][[1]], {x, 0, 5}]}, {a,
1, 10, .5}], PlotRange -> All]
Do[s[a] =
NDSolve[{y'[x] == y[x] Cos[a x + y[x]], y[0] == 1},
y, {x, 0, 5}], {a, 1, 10, .5}]
ListPlot[ParallelTable[{a,
N[Integrate[y'[x]^2 /. s[a][[1]], {x, 0, 5}]]}, {a, 1, 10, .5}],
PlotRange -> All]
Both examples works fine. I can't understand this. Can i fix it?