# Different results from two identical sums?

Posted 11 months ago
1637 Views
|
2 Replies
|
0 Total Likes
|
 Hi all,I wrote two different ways to compute some given sums and try to measure the time in order to pick the best, which saves a lot of computational time! I needed to do that because these sums require time which go from minutes to hours.There are listed two methods, do not put too much attention in the math details, but what I compute and save in an output file they must be the same!First of all, I set globally the precision on my notebook with the following line: $PreRead = (# /. s_String /; StringMatchQ[s, NumberString] && Precision@ToExpression@s == MachinePrecision :> s <> "20." &); Then what I compute is the quantity Den[c] for several values of parameter T=12, ... in both two methods. Starting with this value we see differences in the result of Den[c] in the two methods, but these differences are not smaller than the precision I set which is 20 digits! I thought that should be differences but of a number which is smaller than 10^{-20}! These differences are bigger than 10^{-16}, which is my tolerance number for 0 in double precision.You can evaluate this notebook because the computation requires ~ 1 minute.Please help me, I don't find any useful informations about it on the internet. If you need more other details or info please ask me!Thank you so much, stay safe and have a good day! Answer 2 Replies Sort By: Posted 11 months ago  I don't know if it has anything to do with your problem, but I just discovered that NumberString does not always do what I would somehow expect: In:= StringMatchQ["1.220", NumberString] Out= False In:= StringMatchQ["3.13",NumberString] Out= False ` Answer Posted 11 months ago  Ciao Gianluca,I don't know what is the reason of NumberString, I copied and pasted this line from the following discussion: "How to set the working precision globally?$MinPrecision does not work".Now I document myself on the scope of every function in this line.Saluti, Nico Answer