[chronojump] Fixed variable names on UtilMath.LeastSquares



commit 503cbc51599d6c909fe78700a1e2d362c67e60fd
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Dec 18 16:40:21 2019 +0100

    Fixed variable names on UtilMath.LeastSquares

 src/utilMath.cs | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/src/utilMath.cs b/src/utilMath.cs
index 75d1c70e..2756d7c8 100644
--- a/src/utilMath.cs
+++ b/src/utilMath.cs
@@ -54,8 +54,8 @@ public class LeastSquares
         * plot(x, 11.51323 + 1.36524*x + -0.01752 * x^2)
         */
 
-       public bool CalculatedMaxY;
-       public double MaxY;
+       public bool CalculatedXatMaxY;
+       public double XatMaxY;
 
        //constructor
        public LeastSquares() {
@@ -80,10 +80,10 @@ public class LeastSquares
        {
                int numMeasures = measures.Count;
                CalculatedCoef = false;
-               CalculatedMaxY = false;
+               CalculatedXatMaxY = false;
 
                if(numMeasures < 3) {
-                       LogB.Error(string.Format("LeastSquares needs at least three values, 
has:",numMeasures));
+                       LogB.Error(string.Format("LeastSquares needs at least three values, has: {0}", 
numMeasures));
                        return;
                }
 
@@ -133,13 +133,14 @@ public class LeastSquares
                        Coef = coef;
                        CalculatedCoef = true;
 
-                       calculateMaxY();
+                       calculateXAtMaxY();
                } else {
                        LogB.Error("Determinant of matrix equal to zero");
                }
        }
 
-       private void calculateMaxY()
+       //this is the X where maxY is found
+       private void calculateXAtMaxY()
        {
                if(Coef[2] == 0)
                {
@@ -152,9 +153,9 @@ public class LeastSquares
                        return;
                }
 
-               //MaxY = -b / 2a
-               MaxY = - Coef[1] / (2 * Coef[2]);
-               CalculatedMaxY = true;
+               //XatMaxY = -b / 2a
+               XatMaxY = - Coef[1] / (2 * Coef[2]);
+               CalculatedXatMaxY = true;
        }
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]