(I have posted this also on StackExchange, but am posting it here just in case there are different people in these groups)
I am quite a newbie and it is taking me so much time to understand what I need to do to achieve something really simple and I still haven't found it.
What I want I think is simple. I run a dynamic model of a metabolic pathway in Mathematica and I calculate the values of several variables at steady-state for multiple conditions. In my model I have parameters that are constant. These have low precision just because it would cause quite some effort to put a bunch of zeros after each one (and it also makes the code look unappealing). (There must be a way I think to tell Mathematica to consider these numbers as high precision numbers, right?)
So for all the different conditions I calculate the variable values at steady-state. And I use ParallelTable quite often and I also use FindRoot and NDSolve.
An example of a relevant piece of script is:
tsol0 = ParallelTable[ NDSolve[Join[ Odes /. RateEqs /. CoAMATX /. ReplacePart[Parm, Position[Parm, C6AcylCarMAT][[1, 1]] -> C6AcylCarMAT -> k[[j]]] /. Parm2, InitialConditions], Vars, {t, 0, 1000000}], {j, 1, Length[k]}];
ssp0 = Table[ FindRoot[ Table[Odes[[i, 2]] == 0, {i, 1, Length[Odes]}] /. RateEqs /. CoAMATX /. ReplacePart[Parm, Position[Parm, C6AcylCarMAT][[1, 1]] -> C6AcylCarMAT -> k[[j]]] /. Parm2, ParallelTable[{Vars[[i]][t], (Vars[[i]][900000] /. tsol0[[j]])[[ 1]]}, {i, 1, Length[Vars]}]], {j, 1, Length[k]}];
Parm and Parm2 contain lists of constant parameters. Odes, RateEqs and CoAMATX are functions and equations that together define how all the variables should change in time. With tsol I calculate the values for all the variables for each time point. I do this for k conditions, in each of these conditions the constant parameter C6AcylCarMAT has different value, because I want to calculate the variable values in time for an increasing C6AcylCarMAT value. With ssp0 I want to find the steady-state value for each of the conditions by indicating that probably at around t=900000 mins the variable values should not change anymore. As a result, ssp0 is a table containing the steady-state values for all the (metabolite concentration-related) variables for each condition. (Each row is one specific condition and each column is one specific metabolite). The other steady-state variables I can calculate from the steady-state metabolite concentrations and Odes, RateEqs and CoAMATX.
Anyway long story. This all works, however I get precision-related warnings. Furthermore, my output values do not have the same amount of decimals. This is the warning/error I get below my ssp1 code e.g.:
FindRoot::lstol: The line search decreased the step size to within tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient decrease in the merit function. You may need more than MachinePrecision digits of working precision to meet these tolerances. >>
Plus I believe that I have huge error propagations, especially because some of the steady-state variable values are very large or very small and thus further calculations with these values cause quite some errors. And when I do my control analysis calculations, only in the conditions where some of the variable values are very large or very small, the checks don't come out well; so some of the values the identity matrix that need to be zero are not, they're like 0.6 etc instead of zero which is a huge error.
I just want to set at the beginning of the notebook:
1. That I want to set all the constant parameters (in Parm and Parm2 e.g.) at a very high precision (for instance 30)
2. That I want all the calculations in the notebook to be done with high precision
3. That I want all the results to be displayed with a high precision (thus e.g. 30 decimals).
Can you guys please help me? I have been trying lots of things and breaking my head for quite some time and I gave up now. I also tried
$PreRead = (# /. s_String /; StringMatchQ[s, NumberString] && Precision@ToExpression@s == MachinePrecision :> s <> "`50." &);
from the thread "How to set the working precision globally? $MinPrecision does not work" but that also didn't work (at least it did not display the results with all these decimals, so now i don't know for sure whether it worked or not).
I have attached my (already run) notebook file if that helps.
Thank you very much in advance,
Anne-Claire
Attachments: