Message Boards Message Boards

Setting global precision and decimals

Posted 10 years ago
Attachments:
6 Replies

Thank you very much! I will discuss this with my professor and let other students in my group recheck my code. (I might be missing something since I have been looking at it so much). I will keep you posted.

You could be running into ill conditioned problems. At which point you may need to think through carefully the formulation to see if the results make sense (sometimes they do, even if it seems that error terms are large). Also it might be possible that rescaling of variables will help.

POSTED BY: Daniel Lichtblau

Dear Daniel,

Thank you for looking further at my problem. I have indeed added the precision code for the parameter lists and the ssp calculation. It did indeed resolve the warning I had before. :-) Thank you. An increase in precision has not resulted in any change in my Identity matrix for the larger k values (the result with which I check whether all my calculations are ok). And I have yet also not found any mistake in my code. So still only for the situations where some of the variables are very small and very large (which occurs at the low k values) I do not obtain a perfect Identity matrix. I will continue working on it, simplifying and checking it.

When I have a better readable script I will resubmit and give an update.

Kind regards,

Anne-Claire

That notebook is a mess. It's impossible to read some of the colored highlighted code (and imagine if the reader was color blind). Then there are redefeinitions of all sorts of things. If you want serious attention put into your question, you'll need to do a much better job of pruning and isolating the problem(s).

I will recommend three things.

(1) Make the functions R1 etc. only defined on explicit `NumberQ arguments. This would be done (after quitting or at least clearing the current definitions) as

R1[V_?NumberQ, Kms1_?NumberQ, Kms8_?NumberQ, Kmp1_?NumberQ, 
 Kmp7_?NumberQ, Keq_?NumberQ, S1_?NumberQ, S8_?NumberQ, P1_?NumberQ, 
 P7_?NumberQ] := ...

(2) Set the parameters to high precision. For the shorter list this could be done as

Parm2 = SetPrecision[{VR1 -> 0.12, VR2 -> 0.2, VR3 -> 0.2, 
    VR4 -> 0.6}, 100];

(3) Run FindRoot at higher precision than default (which is machine precision). Could be done as in the example below.

ss1 = FindRoot[
  Table[Odes[[i, 2]] == 0, {i, 1, Length[Odes]}] /. RateEqs /. 
     CoAMATX /. Parm /. Parm2, t1, WorkingPrecision -> 50]

If you have further trouble I will advise that you pay serious attention to the first remarks when formulating any follow-up question(s). This notebook is way too long to go through, just to guess at what might be the problematic areas.

POSTED BY: Daniel Lichtblau

You should also try the changes I suggested. I did, and did not run into the problems mentioned in the first post.

The analysis of error propagation will still need to be done, of course. But at least you'll get further along in the computations to the point where that can proceed.

POSTED BY: Daniel Lichtblau
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract