Bill Allombert on Sun, 14 Apr 2019 13:37:20 +0200


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

Re: Muller implementation don't know where is the problem


Hello Eduardo,

I found three problems:

> {
>   my(f1,f2,f3,d1,d2,g1,g2,a1,a2,a0,res,x,y,z,i,j,k,l,m);
>   
>   res = 0;
>   i = 0;
>   
>   for(i=1,10000000 

You need a comma here

>     f1 = f(a,N);
>     f2 = f(b,N);
>     f3 = f(c,N);
>     d1 = f1 - f3;
>     d2 = f2 - f3;
>     h1 = a - c;
>     h2 = b - c;
>     a0 = f3;
>     a1 = ( ( (d2 * h1 *h1) - (d1 * h2 * h2) ) / ( (h1 * h2) * (h1 - h2) ) );
>     a2 = ( ( (d1 * h2) - (d2 * h1) ) / ( (h1 * h2) * (h1 - h2) ) );
>     x = ( (-2 * a0) / (a1 + abs(sqrt(a1 * a1 - 4 * a0 * a2))) );
>     y = ( (-2 * a0) / (a1 - abs(sqrt(a1 * a1 - 4 * a0 * a2))) );
>   
>     if(x >= y,
>       res = x + c,
>       res = y + c
>     )

You need a semicolon here

>     l = floor(res * 1000);
>     m = floor(c * 1000);
>     if(l==m, break()); 
>     a = b;
>     b = c;
>     c = res;
>   );
>   
>   res    //==== Here is the error

GP comment characters are \\ not //

> }

Hope this help,
Bill