public static void Main(string[] args)
Console.WriteLine("Welcome to the COVid OVERALL DEATHS Calculator per Month");
double error_cuadrado_total, error_cuadrado_total_viejo,
variable_criterio = 0.0001;
double[] r = new double[12];
double[,] jacobiana = new double[12, 2];
double[,] matriz = { { 0, 0, 0, 0, 0 },
double[] deaths= {1830, 8071, 17839, 18919, 17726, 13232, 14107, 14187, 13804, 31343, 27052, 17512};
double[] mes = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
Console.WriteLine("\n\nPlease introduce a Month from 1 (April-2020) to 15 (June-2021):");
month= double.Parse(Console.ReadLine());
Console.WriteLine("\n\nPlease introduce an aproximate forecast quantity of DEATHS from set month, according to your knowledge:");
forecast= double.Parse(Console.ReadLine());
double[] x = {month, forecast};
error_cuadrado_total_viejo = variable_criterio * 2;
error_cuadrado_total = 0;
while (Math.Abs(error_cuadrado_total - error_cuadrado_total_viejo)
error_cuadrado_total_viejo = error_cuadrado_total;
error_cuadrado_total = 0;
for (int i = 0; i < 12; i = i + 1)
r[i] = x[0] * 1407 + 7153 - x[1];
error_cuadrado_total = error_cuadrado_total + r[i] * r[i];
for (int i = 0; i < 2; i = i + 1)
for (int j = 0; j < 2; j = j + 1)
for (int k = 0; k < 12; k = k + 1)
= matriz[i, j] + jacobiana[k, i] * jacobiana[k, j];
for (int i = 0; i < 2; i = i + 1)
for (int j = 0; j < 1; j = j + 1)
for (int k = 0; k < 12; k = k + 1)
matriz[i, 2] = matriz[i, 2] - r[k] * jacobiana[k, i];
for (int reng = 0; reng < 2; reng = reng + 1)
pivote = matriz[reng, reng];
for (int colu = 0; colu < 3; colu = colu + 1)
matriz[reng, colu] = matriz[reng, colu] / pivote;
for (int reng_elimi = 0; reng_elimi < 2; reng_elimi = reng_elimi + 1)
factor = matriz[reng_elimi, reng];
for (int colu_elimi = 0; colu_elimi < 3;
colu_elimi = colu_elimi + 1)
matriz[reng_elimi, colu_elimi]
= matriz[reng_elimi, colu_elimi]
- factor * matriz[reng, colu_elimi];
Console.WriteLine("\n\nAccording to the tendency from the accumulated data of cases, in the Month "+x[0]+" there were or will be approximately "+x[1]+" sumed DEATHS.");
Console.WriteLine("Set Forecast has a Quadratic Error of "+error_cuadrado_total+".");
Console.WriteLine("\n\nIf the Error is bigger than 0, try a closer forecast, in order to reach the precise quantity of DEATHS for the given Month.");