diff --git a/prog b/prog index 40726f1932f67cbe2490085d476a3057a09d688d..b08cb85c66804373374eeb1fa6118c3625e22929 100755 Binary files a/prog and b/prog differ diff --git a/src/main.c b/src/main.c index 63c65d726a55f27c3494c2813c1ea0651d759336..a021c1dd4dbec6d58a4bdabb671facd48675ac8e 100644 --- a/src/main.c +++ b/src/main.c @@ -40,7 +40,7 @@ int main() { printf("Sol Analytique : a: %f b: %f\n",p.x,p.y); point drt; drt.x=6; - drt.y=12; + drt.y=6; p = descenteGradient(0.0001,drt,v); printf("Sol Numérique : a: %f b: %f\n",p.x,p.y); diff --git a/src/main.o b/src/main.o index e530ed6fb5f4d5e167064c4719a53ea526c1b695..c859556f2e11d2af608ee11a801425a774358000 100644 Binary files a/src/main.o and b/src/main.o differ diff --git a/src/regressionLin.c b/src/regressionLin.c index a953f19b94f2d8db60566037007a2096806d2ff9..f8f98256a1f64694d77c92d7e67b144034db21da 100644 --- a/src/regressionLin.c +++ b/src/regressionLin.c @@ -37,20 +37,18 @@ point descenteGradient(double precision, point drt, vector pts){ double oldptx = 0; double oldpty = 0; double testSortie=1; - double lambda = 0.000001; + double lambda = 0.0001; while(testSortie > precision){ gradientx = 0; gradienty = 0; testSortie = 0; - //drt.x est a et drt.y est b + //pt.x est a et pt.y est b for(int i = 0; i < pts.length; i++){ gradientx += (pow(pts.content[i].x, 2) * pt.x) + (pt.y * pts.content[i].x) - (pts.content[i].x * pts.content[i].y); - gradienty += (pt.x * pts.content[i].x) - pts.content[i].y; + gradienty += (pt.x * pts.content[i].x) + pt.y - pts.content[i].y;//pt.y*pts.length } gradientx = gradientx * 2; - - gradienty += pt.y * pts.length; gradienty = gradienty * 2; @@ -58,14 +56,14 @@ point descenteGradient(double precision, point drt, vector pts){ oldpty = pt.y; pt.x = oldptx - (lambda * gradientx); - printf("ptx : %f\n",pt.x); +// printf("ptx : %f\n",pt.x); pt.y = oldpty - (lambda * gradienty); - printf("pty : %f\n",pt.y); + // printf("pty : %f\n",pt.y); //Sortie testSortie = sqrt(pow(pt.x - oldptx,2) + pow(pt.y - oldpty,2)); - printf("%f\n",testSortie); +// printf("%f\n",testSortie); } return pt; diff --git a/src/regressionLin.o b/src/regressionLin.o index e9296d06470bad1bdf54632539d602399c7cebbe..3aee4a395ff0de6aa84347b4a0fd3946c1502ec1 100644 Binary files a/src/regressionLin.o and b/src/regressionLin.o differ