This is an example of a problem I have retrieving functions from a file I save using ParalleDo.
(*save data to a file in ParallelDo loop*)
myF[x_] := 2 + x^2 + 3 x^3;
fileName = StringTemplate["D:\\mathematica\\file`1`.m"];
ParallelDo[
theDeriv = D[myF[x], x];
Export[fileName[i], Definition@theDeriv],
{i, 1, 5}
];
And if I retrieve the function while in this notebook using:
fileName = StringTemplate["D:\\mathematica\\file`1`.m"];
deriv = Import[fileName[1]]
It returns the derivative:
2 x + 9 x^2
However if I first close Mathematica then re-open this notebook and just retrieve the function by first executing Import, it returns what looks like unusable temporary variable names:
2 Notebook$$16$203416`x + 9 Notebook$$16$203416`x^2
If I just use Do this does not happen but I need to run much more complicated code saving many files and would like to do so in parallel. Can someone help me to get this to work in parallel?
Thank you.