| 
					
						 My source code below:
 
          public static void function_cx_1_func(double[] c, double[] x, ref double func, object obj)         {             // this callback calculates f(c,x)= (c0*x + c1*x^(2/3) + c2*x^(1/3) + c3)^3             // where x is a position on X-axis and c is adjustable parameter             func = System.Math.Pow((c[0] * x[0] + c[1] * Math.Pow(x[0], 2 / 3) + c[2] * Math.Pow(x[0], 1 / 3) + c[3]), 3);         }         static void Main(string[] args)         {             //             // In this example we demonstrate exponential fitting             // by f(x) = (c0*x + c1*x^(2/3) + c2*x^(1/3) + c3)^3             // using function value only.             //             // Gradient is estimated using combination of numerical differences             // and secant updates. diffstep variable stores differentiation step              // (we have to tell algorithm what step to use).             //             double[,] x = new double[,] { { 0 }, { 0.47 }, { 2.01 }, { 5.96 }, { 15 }, { 32.9 }};             double[] y = new double[] { 0.75, 3.2, 13.8, 53.7, 170.4, 387.8 };             double[] c = new double[] { 0.1, 0.1, 0.1, 0.1 };             double epsf = 0;             double epsx = 0.0000001;             int maxits = 0;             int info;             alglib.lsfitstate state;             alglib.lsfitreport rep;             double diffstep = 0.00001;
              //             // Fitting without weights             //             alglib.lsfitcreatef(x, y, c, diffstep, out state);             alglib.lsfitsetcond(state, epsf, epsx, maxits);             alglib.lsfitfit(state, function_cx_1_func, null, null);             alglib.lsfitresults(state, out info, out c, out rep);             System.Console.WriteLine("{0}", info); // EXPECTED: 2             System.Console.WriteLine("{0}", alglib.ap.format(c, 5)); // EXPECTED: [-0.22, 1.4, -0.23, 0.909]
              //             // Fitting with weights             // (you can change weights and see how it changes result)             //             double[] w = new double[] { 1, 1, 1, 1, 1, 1};             alglib.lsfitcreatewf(x, y, w, c, diffstep, out state);             alglib.lsfitsetcond(state, epsf, epsx, maxits);             alglib.lsfitfit(state, function_cx_1_func, null, null);             alglib.lsfitresults(state, out info, out c, out rep);             System.Console.WriteLine("{0}", info); // EXPECTED: 2             System.Console.WriteLine("{0}", alglib.ap.format(c, 5)); // EXPECTED:  [-0.22, 1.4, -0.23, 0.909]             System.Console.ReadLine();         }
  I hope the result is: EXPECTED:  [-0.22, 1.4, -0.23, 0.909], 
  But the actual output is as follows: 2 {0.13321,0.98960,0.98985,0.99026} 2 {0.13321,0.98960,0.98985,0.99026}
  Check into the formula found to be wrong. 
  How can i do?
  Thanks! 
					
  
						
					 |