lunes, 10 de diciembre de 2012

Script para calcular el error de propagacion de una funcion

% Aporte de Diego Perez
syms fx x
syms F L E I
fx=(F*L^4)/(8*E*I);
dfF=diff(fx,F);
dfL=abs(diff(fx,L));
dfE=abs(diff(fx,E));
dfI=abs(diff(fx,I));
L=30;F=50;E=1.5*10^8;I=0.06;
eval(fx)
syms DfF DfL DfI DfE;
dfx=dfF*DfF+dfL*DfL+dfE*DfE+dfI*DfI;
DfF=2; DfL=0.1; DfE=0.01*10^8; DfI=0.0006;
eval(dfx)

%Aporte de Efrain Rojas
Programa para calcular error de propagación de una función


sábado, 10 de noviembre de 2012

FUNCION DIFERENCIAS DIVIDIDAS

Las entradas son dos vectores de cordenadas x,y  y el error (xint).
function diferencias_divididas(X,Y,xint)
n=length(Y);
fdd=zeros(n);

%llenando fdd con diferencias divididas
for i=1:n

   fdd(i,1)=Y(i);
end

for i=2:1:n
    for j=1:1:n+1-i
        fdd(j,i)=(fdd(j+1,i-1)-fdd(j,i-1))/(X(i+j-1)-X(j));
    end
end
Pol='';
Prod='';
for i=1:1:n-1
    Prod='';
    for j=1:1:i
        Prod=[Prod,'(X - ',num2str(X(j)),')'];
    end
    Pol=[Pol,'(',num2str(fdd(1,i+1)),')',Prod,' + '];
end
Pol=['F(x) = ',Pol,num2str(Y(1)),'\n\n'];

fprintf('Matriz de diferencias divididas:\n');
fdd
fprintf('Polinomio de Newton calculado:\n\n');
fprintf(Pol);

fint=0;
xprod=1;
sum=fdd(1,1);
for i=1:1:n-1
    fint=fdd(1,i+1);
    xprod=1;
    for j=1:1:i
        xprod=xprod*(xint-X(j));
    end
    fint=fint*xprod;
    sum=sum+fint;
end
fint=sum;
%graficando el polinomio de newton
fint1=0;
xprod1=1;
xn=1:0.01:max(X)+max(X)*xint;
yn=[];
for k=1:1:length(xn)
sum1=fdd(1,1);
for i=1:1:n-1
    fint1=fdd(1,i+1);
    xprod1=1;
    for j=1:1:i
        xprod1=xprod1*(xn(k)-X(j));
    end
    fint1=fint1*xprod1;
    sum1=sum1+fint1;
end
fint1=sum1;
yn(k)=fint1;
end

Error=abs((log(xint)-fint)/log(xint));

fprintf('Evaluando el polinomio en X = %f resulta: %f\n\n',xint,fint);
xg=1:0.1:max(X)+max(X)*xint;
yg=log(xg);
plot(xg,yg,'r')
hold on;
plot(X,Y,'bo');
hold on;
plot(xint,fint,'r+');
hold on;
plot(xn,yn,'b');
hold on;
plot(xint,log(xint),'ro');
hold off;
title('Representacion grafica de Ln(x) y el polinomio de Newton');
xlabel('X');
ylabel('Y = Ln(X)');
legend('Ln(x)','Puntos insertados','Valor interpolado','polinomio de Newton','valor real');
Vari=['X = ',num2str(xint),' Y = ',num2str(fint),' Er = ',num2str(Error),' Ea = ',num2str(Error*100),' %'];
text(xint+xint*.1,fint,Vari);
 Metodo de biseccion en java :)

public class Biseccion {
 
 /**
     *@autor: Andrea Ibañez Irusta
     * @param args
     */
          private double funcion(double x){
              // return Math.sqrt( x*x +1 ) -4;
               return (Math.exp(x)+Math.cos(Math.pow(x, 2)));
            
           }
          
           public double metodoDeBiseccion(double a, double b, double error){
               double c = 0.0;
               double fa;
               double fb;
               double fc;
               if((funcion(a) * funcion(b)) > 0){
                   System.out.println("Error en el intervalo, en ese intervalo no existen raices");
               }else{
                    c = (a + b) /(double) 2;
                   do{
                     
                       fa = funcion(a);
                       fb = funcion(b);
                       fc = funcion(c);
                       if((fa * fc) > 0){
                           a = c;
                           fa = funcion(a);
                           fb = funcion(b);
                            c = (a + b) /(double) 2;
                           fc = funcion(c);
                       }else if((fb * fc) > 0 ){
                           b = c;
                           fa = funcion(a);
                           fb = funcion(b);
                            c = (a + b) /(double) 2;
                           fc = funcion(c);

                       }


                   }while(Math.abs(fc) >= error);
               }
               System.out.println("valor de la funcion: "+funcion(c));
               System.out.println("raiz= "+c);
               return  c;


           }


        }

sábado, 27 de octubre de 2012

Método de Simpson 1/3


clear
clc
format long
disp ('Método de Simpson 1/3')
syms x
f = input('función: ');
b = input('límite superior: ');
a = input('límite inferior: ');
n = input('número de divisiones (par): ');
h = (b-a)/n;

%integracion normal
i = int(f);
x = b;
r = eval(i);
x = a;
r = r - eval(i);

%metodo de Simpson 1/3
for j=0:n;
    if(j == 0)
        x = a;
        s = eval(f);
    elseif(j == n)
        x = b;
        s = s+eval(f);
    elseif(rem(j,2) ==0)
        x = x+h;
        s = s+2*eval(f);
    else
        x = x+h;
        s = s+4*eval(f);
    end
end
s = h*s/3;
fprintf('resultado por simpson 1/3: %f\n',s)
fprintf('resultado por integración normal: %f\n',r)

jueves, 25 de octubre de 2012

DIFERENCIAS DIVIDIDAS

PROGRAMA PARA CALCULAR EL METODO DE NEWTON CON DIFERENCIAS DIVIDIDAS ES DECIR DE UN GRADO MAYOR


ESTO YA ESTA PROBADO CON UNA MATRIZ:


X=[1 4 6 5];

Y=log(X);

n=length(X);

fdd=zeros(n);

xint=2;

%llenando fdd con diferencias divididas

for i=1:n

fdd(i,1)=Y(i);

end



for
i=2:1:n

for j=1:1:n+1-i

fdd(j,i)=(fdd(j+1,i-1)-fdd(j,i-1))/(X(i+j-1)-X(j));

end

end

Pol='';

Prod='';

for i=1:1:n-1

Prod='';

for j=1:1:i

Prod=[Prod,'(X - ',num2str(X(j)),')'];

end

Pol=[Pol,'(',num2str(fdd(1,i+1)),')',Prod,' + '];

end

Pol=['F(x) = ',Pol,num2str(Y(1)),'\n\n'];



fprintf(
'Matriz de diferencias divididas:\n');

fdd

fprintf(
'Polinomio de Newton calculado:\n\n');

fprintf(Pol);



fint=0;

xprod=1;

sum=fdd(1,1);

for i=1:1:n-1

fint=fdd(1,i+1);

xprod=1;

for j=1:1:i

xprod=xprod*(xint-X(j));

end

fint=fint*xprod;

sum=sum+fint;

end

fint=sum;

%graficando el polinomio de newton

fint1=0;

xprod1=1;

xn=1:0.01:max(X)+max(X)*0.25;

yn=[];

for k=1:1:length(xn)

sum1=fdd(1,1);

for i=1:1:n-1

fint1=fdd(1,i+1);

xprod1=1;

for j=1:1:i

xprod1=xprod1*(xn(k)-X(j));

end

fint1=fint1*xprod1;

sum1=sum1+fint1;

end

fint1=sum1;

yn(k)=fint1;

end



Error=abs((log(xint)-fint)/log(xint));



fprintf(
'Evaluando el polinomio en X = %f resulta: %f\n\n',xint,fint);

xg=1:0.1:max(X)+max(X)*0.25;

yg=log(xg);

plot(xg,yg,
'r')

hold on;

plot(X,Y,'bo');

hold on;

plot(xint,fint,'r+');

hold on;

plot(xn,yn,'b');

hold on;

plot(xint,log(xint),'ro');

hold off;

title('Representacion grafica de Ln(x) y el polinomio de Newton');

xlabel('X');

ylabel('Y = Ln(X)');

legend('Ln(x)','Puntos insertados','Valor interpolado','polinomio de Newton','valor real');

Vari=['X = ',num2str(xint),' Y = ',num2str(fint),' Er = ',num2str(Error),' Ea = ',num2str(Error*100),' %'];

text(xint+xint*.1,fint,Vari);

domingo, 14 de octubre de 2012

viernes, 12 de octubre de 2012

Interpolacion de Lagrange

function y0 = lagrange_interp(x, y, x0)
% x is the vector of abscissas.
% y is the matching vector of ordinates.
% x0 represents the target to be interpolated
% y0 represents the solution from the Lagrange interpolation
y0 = 0;
n = length(x);
for j = 1 : n
    t = 1;
    for i = 1 : n
        if i~=j
            t = t * (x0-x(i))/(x(j)-x(i));
        end
    end
    y0 = y0 + t*y(j);
end

lunes, 8 de octubre de 2012

Programa que calcula el polinomio interpolador con comentarios

n=9;    %  número de puntos
syms x;  % define la variable simbólica para crear el polinomio
xn=[-5 -3 -2 -1 0 1 2 3 4 5];  % abscisas de los puntos a interpolar
yn=1./(1.+xn.^2);  % ordenadas de estas abscisas
plot(xn,yn,'*r')  %  dibuja los puntos a interpolar
hold on
p=0;  % inicializa el polinomio de interpolación que empezará a calcular
for i=1:n
    L=1;
    for j=1:n
        if j~=i
           L=L*(x-xn(j))/(xn(i)-xn(j));
        end
    end
    p=p+L*yn(i);  %  forma de Lagrange
end
p=simplify(p)
     pretty(p)   %  muestra el polinomio en pantalla
x=-5:0.01:5;
f=1./(1+x.^2);
plot(x,f);  %  dibuja la función a interpolar


fuente:  http://www.uam.es/personal_pdi/ciencias/barcelo/cnumerico/recursos/ProgramasMatLab.html

 METODO INTERPOLACION POR LAGRANGE

Un código sencillo para hacerlo es:


function y0 = lagrange_interp(x, y, x0)
y0 = 0;
n = length(x);
for j = 1 : n
t = 1;
for i = 1 : n
if i~=j
t = t * (x0-x(i))/(x(j)-x(i));
end
end
y0 = y0 + t*y(j);
end

En donde (x,y) en la entrada son los valores conocidos. x0 es el valor a interpolar.

la fuente es tomado  de :

http://www.lawebdelprogramador.com/foros/Matlab/1201500-S.O.S_Interpolacion_Lagrange_en_matlab.html

sábado, 25 de agosto de 2012

Teoria de Errores1

https://bubbl.us/
esta es la dirección un programa que nos ayuda a realizar mapas mentales de una forma facil
como pueden ver se puede exportar en formato "pdf" y también como "html"


viernes, 15 de junio de 2012

http://www.fileserve.com/file/rNEwhVe/rungeKutta.rar
Link de descarga Runge Kutta
grupo de:
Junior Manuel Muñoz Cuiza
Wilmer Mijhael Yucra Lecoña

jueves, 14 de junio de 2012

Hola somos el grupo que desarollara el metodo de Runge kutta de 4to orden, aca nuestro archivo http://www.mediafire.com/?s7v9fqtdb6z1fzm
Hola somos el grupo que desarollara el metodo de Runge kutta de 4to orden, aca nuestro archivo http://www.mediafire.com/?s7v9fqtdb6z1fzm

domingo, 10 de junio de 2012

Buenas para todos ........aquí les dejamos toda la información para la expo....
http://www.4shared.com/rar/xhpqm1Y8/SIMPSON.html]SIMPSON.rar

  Univ:CHOQUEHUANCA FERNANDEZ BASILIA ||LIPA PAUCARA MARIA ISABEL ||RUIZ SAMO MIGUEL ANGEL