# Mathematica accuracy errors when creating data

I created training data for a neural network and below are two errors I got

The only code that uses "FindRoot" command is the following

(*numerically searching for Gram point in its approximate region of the 5000th zero*)

grampoint[n_] := t /. FindRoot[RiemannSiegelTheta[t] - (10^12 + n - 1) Pi, {t,zeros[[5000]]}]


Also, when using the neural network to predict outputs I got the errors below

Overall, the trained neural network did not predict as accurately as I hoped. Is this got to do anything with these errors? Do this errors mean the data created was not accurate or what do they mean?

EDIT:

The code that precedes the first errors is below

simplifiedzeros = Import["/Users/user1/Documents/SummerProject/OdlyzkoZerosOnly.txt", "CSV"] // Flatten;

(*creating list of the 10^12 to 10^12+10^4 zeros (imaginary part)*)
zeros = 267653395647 + simplifiedzeros;

(*numerically searching for Gram point in its approximate region of 5000th zero*)
grampoint[n_] :=  t /. FindRoot[RiemannSiegelTheta[t] - (10^12 +n - 1) Pi, {t, zeros[[5000]]}];

(*distance between zero and gram point*)
distance[n_] := zeros[[n]] - grampoint[n - 1];

(*approximation to RiemannSiegelTheta function*)
sterlingtheta[t_] := (t/2) (Log[t/(2 Pi)]) - t/2 - Pi/8 + 1/(48 t)

(*features for neural net*)
feature1[n_] := {RiemannSiegelZ[grampoint[n - 1]],RiemannSiegelZ[grampoint[n]]};
feature2[n_] := Table[Cos[sterlingtheta[grampoint[n - 1]] - grampoint[n - 1] Log[j]]/
Sqrt[j], {j, 1, 10}];
feature3[n_] := Table[Cos[sterlingtheta[grampoint[n]] - grampoint[n] Log[j]]/
Sqrt[j], {j, 1, 10}];
feature4[n_] := Table[Sin[sterlingtheta[grampoint[n - 1]] - grampoint[n - 1] Log[j]]/
Sqrt[j], {j, 2, 10}];
feature5[n_] := Table[Sin[sterlingtheta[grampoint[n]] - grampoint[n] Log[j]]/
Sqrt[j], {j, 2, 10}];

(*the features for predicting distance zero[[n]]-gram[n-1]*)
features[n_] := Join[feature1[n], feature2[n], feature3[n], feature4[n], feature5[n]];

(*the 10,000 pieces of data of features and outputs*)
netdata = Table[features[n] -> distance[n], {n, 1, 10000}];

• FindRoot is giving the best answer possible at machine precision for grampoint[65]. You can check consecutive floating-point values for t this way: Block[{n = 65}, RiemannSiegelTheta[grampoint[n] {1 - $MachineEpsilon, 1, 1 +$MachineEpsilon}] - (10^12 + n - 1) Pi]. If that solution is unsatisfactory, then you should set WorkingPrecision to a number, perhaps, WorkingPrecision -> 16 or higher. (Can't get a better machine-precision result this way, tho.) If machine precision is satisfactory, try setting AccuracyGoal -> -Log10[(t*deriv /. t -> zeros[[5000]]) \$MachineEpsilon] Aug 20, 2021 at 16:02
• ...where deriv = D[RiemannSiegelTheta[t], t] Aug 20, 2021 at 16:04
• @MichaelE2 Thank you, I will give that a try. Maybe I should also manually set PrecisionGoal and AccuracyGoal to higher numbers like 16 too. Aug 20, 2021 at 16:14
• What causes the messages is AccuracyGoal being higher than the working precision can handle. The setting I suggested lowers it to the best, achievable accuracy possible at machine precision (and you might need to lower it, not raise it, a little more, since it's an approximation). PrecisionGoal should not be set higher than the working precision and probably should be a little less, since it's impossible to avoid roundoff error. You might look up arbitrary and machine precision numbers in Numbers if you don't know about them. Aug 20, 2021 at 16:27
• Aug 20, 2021 at 17:24