@@ -56,9 +56,8 @@ public static (double A, double B) Line(double[] x, double[] y)
5656 /// </summary>
5757 public static Func < double , double > LineFunc ( double [ ] x , double [ ] y )
5858 {
59- var parameters = SimpleRegression . Fit ( x , y ) ;
60- double intercept = parameters . Item1 , slope = parameters . Item2 ;
61- return z => intercept + slope * z ;
59+ ( double Intercept , double Slope ) = SimpleRegression . Fit ( x , y ) ;
60+ return z => Intercept + Slope * z ;
6261 }
6362
6463 /// <summary>
@@ -99,10 +98,8 @@ public static (double A, double R) Exponential(double[] x, double[] y, DirectReg
9998 /// </summary>
10099 public static Func < double , double > ExponentialFunc ( double [ ] x , double [ ] y , DirectRegressionMethod method = DirectRegressionMethod . QR )
101100 {
102- var parameters = Exponential ( x , y , method ) ;
103- var a = parameters . Item1 ;
104- var r = parameters . Item2 ;
105- return z => a * Math . Exp ( r * z ) ;
101+ ( double A , double R ) = Exponential ( x , y , method ) ;
102+ return z => A * Math . Exp ( R * z ) ;
106103 }
107104
108105 /// <summary>
@@ -122,10 +119,8 @@ public static (double A, double B) Logarithm(double[] x, double[] y, DirectRegre
122119 /// </summary>
123120 public static Func < double , double > LogarithmFunc ( double [ ] x , double [ ] y , DirectRegressionMethod method = DirectRegressionMethod . QR )
124121 {
125- var parameters = Logarithm ( x , y , method ) ;
126- var a = parameters . Item1 ;
127- var b = parameters . Item2 ;
128- return z => a + b * Math . Log ( z ) ;
122+ ( double A , double B ) = Logarithm ( x , y , method ) ;
123+ return z => A + B * Math . Log ( z ) ;
129124 }
130125
131126 /// <summary>
@@ -146,10 +141,8 @@ public static (double A, double B) Power(double[] x, double[] y, DirectRegressio
146141 /// </summary>
147142 public static Func < double , double > PowerFunc ( double [ ] x , double [ ] y , DirectRegressionMethod method = DirectRegressionMethod . QR )
148143 {
149- var parameters = Power ( x , y , method ) ;
150- var a = parameters . Item1 ;
151- var b = parameters . Item2 ;
152- return z => a * Math . Pow ( z , b ) ;
144+ ( double A , double B ) = Power ( x , y , method ) ;
145+ return z => A * Math . Pow ( z , B ) ;
153146 }
154147
155148 /// <summary>
@@ -396,8 +389,8 @@ public static Func<double, double> CurveFunc(double[] x, double[] y, Func<double
396389 /// </summary>
397390 public static Func < double , double > CurveFunc ( double [ ] x , double [ ] y , Func < double , double , double , double > f , double initialGuess0 , double initialGuess1 , double tolerance = 1e-8 , int maxIterations = 1000 )
398391 {
399- var parameters = Curve ( x , y , f , initialGuess0 , initialGuess1 , tolerance , maxIterations ) ;
400- return z => f ( parameters . P0 , parameters . P1 , z ) ;
392+ var ( P0 , P1 ) = Curve ( x , y , f , initialGuess0 , initialGuess1 , tolerance , maxIterations ) ;
393+ return z => f ( P0 , P1 , z ) ;
401394 }
402395
403396 /// <summary>
@@ -406,8 +399,8 @@ public static Func<double, double> CurveFunc(double[] x, double[] y, Func<double
406399 /// </summary>
407400 public static Func < double , double > CurveFunc ( double [ ] x , double [ ] y , Func < double , double , double , double , double > f , double initialGuess0 , double initialGuess1 , double initialGuess2 , double tolerance = 1e-8 , int maxIterations = 1000 )
408401 {
409- var parameters = Curve ( x , y , f , initialGuess0 , initialGuess1 , initialGuess2 , tolerance , maxIterations ) ;
410- return z => f ( parameters . P0 , parameters . P1 , parameters . P2 , z ) ;
402+ var ( P0 , P1 , P2 ) = Curve ( x , y , f , initialGuess0 , initialGuess1 , initialGuess2 , tolerance , maxIterations ) ;
403+ return z => f ( P0 , P1 , P2 , z ) ;
411404 }
412405
413406 /// <summary>
@@ -416,8 +409,8 @@ public static Func<double, double> CurveFunc(double[] x, double[] y, Func<double
416409 /// </summary>
417410 public static Func < double , double > CurveFunc ( double [ ] x , double [ ] y , Func < double , double , double , double , double , double > f , double initialGuess0 , double initialGuess1 , double initialGuess2 , double initialGuess3 , double tolerance = 1e-8 , int maxIterations = 1000 )
418411 {
419- var parameters = Curve ( x , y , f , initialGuess0 , initialGuess1 , initialGuess2 , initialGuess3 , tolerance , maxIterations ) ;
420- return z => f ( parameters . P0 , parameters . P1 , parameters . P2 , parameters . P3 , z ) ;
412+ var ( P0 , P1 , P2 , P3 ) = Curve ( x , y , f , initialGuess0 , initialGuess1 , initialGuess2 , initialGuess3 , tolerance , maxIterations ) ;
413+ return z => f ( P0 , P1 , P2 , P3 , z ) ;
421414 }
422415
423416 /// <summary>
@@ -426,8 +419,8 @@ public static Func<double, double> CurveFunc(double[] x, double[] y, Func<double
426419 /// </summary>
427420 public static Func < double , double > CurveFunc ( double [ ] x , double [ ] y , Func < double , double , double , double , double , double , double > f , double initialGuess0 , double initialGuess1 , double initialGuess2 , double initialGuess3 , double initialGuess4 , double tolerance = 1e-8 , int maxIterations = 1000 )
428421 {
429- var parameters = Curve ( x , y , f , initialGuess0 , initialGuess1 , initialGuess2 , initialGuess3 , initialGuess4 , tolerance , maxIterations ) ;
430- return z => f ( parameters . P0 , parameters . P1 , parameters . P2 , parameters . P3 , parameters . P4 , z ) ;
422+ ( double P0 , double P1 , double P2 , double P3 , double P4 ) = Curve ( x , y , f , initialGuess0 , initialGuess1 , initialGuess2 , initialGuess3 , initialGuess4 , tolerance , maxIterations ) ;
423+ return z => f ( P0 , P1 , P2 , P3 , P4 , z ) ;
431424 }
432425 }
433426}
0 commit comments