Post Reply 
gaussian quadrature
08-25-2015, 12:26 PM
Post: #5
RE: gaussian quadrature
Already solved

As you said I put the point to take the number as Real rather than exact and have solved two problems , which did not work when i = 1 and the problem of the loop. Although I do not see the relationship between the loop and the latter problem that the variable a0 can be real or exact.


The corrections program that works is
Code:
#pragma mode( separator(.,;) integer(h64) )

coeficientes();

EXPORT Cuadratura_Gaussiana()
BEGIN
 
    local n:=3;
    M1:=makemat(0,n,4); 
    
    coeficientes(n);    
    msgbox("Orden de las columnas: c_i, r_i , F(r_i), c_i*F(ri)");
    editmat(M1);
end;

#cas
coeficientes(nr):=
BEGIN
    // Cálculo de las raices y los coeficientes para la cuadratura gaussiana de de nr términos
    local i,a0;
    M2:=zeros(legendre(nr)); //raices del polinomio
    // Cálculo de los coeficientes de ponderacion
    for i from 1 to nr do
         M1(i,2):=M2(i);//  raiz del polinomio;
         X:=M2(i);
         a0:=subst(diff(legendre(nr)),X=0);  
         M1(i,1):=2.[/b]/((1-M2(i)^2)*(a0^2));//coeficiente;
    end;
    
END;
#end


In relation to program 1 , I have not noticed any particular pattern in failure . It happens also in other programs which use CAS.funtion( ) sometimes makes the call to CAS successfully and some not.

Every time I like least this calculator , since to do something that comes out of the most basic , even as simple as this program is a headache..

In any case thank you very much for your help Didier
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
gaussian quadrature - Antonio - 08-23-2015, 07:01 PM
RE: gaussian quadrature - Didier Lachieze - 08-24-2015, 03:18 PM
RE: gaussian quadrature - Antonio - 08-25-2015, 09:23 AM
RE: gaussian quadrature - Didier Lachieze - 08-25-2015, 11:42 AM
RE: gaussian quadrature - Antonio - 08-25-2015 12:26 PM



User(s) browsing this thread: 1 Guest(s)