Showing posts with label SMALL. Show all posts
Showing posts with label SMALL. Show all posts

Sunday, 21 August 2016

FreeMat Code: Sample hen's method or raunge-kutta Method

x1=0;
y1=1;
h=0.05;
xf=0.25;
printf('x   y\n');
    while(x1<=xf)
    s1=-(x1*y1);
    x2=x1+h;
    y2=y1+(h*s1);
    s2=-(x2*y2);
    y2=y1+h*(s1+s2)/2;
    printf('%f %f\n',x1,y1);
    x1=x2;
    y1=y2;
    
end



For more,
Link:- https://github.com/ananya-datta/FreeMat-MATLAB-Programs

FreeMat code: Sample Newton-Rapson Method

x0=2.5;
epsilon=0.001;
delta=0.001;
n=5;
for (i=1:n)
    f0=(x0*sin(x0))+cos(x0);
    fd0=x0*cos(x0);
    
    x1=x0-(f0/fd0);
    if((x1-x0)/x1)<epsilon
        x1
        fx=(x1*x1)-25;
        fx
        i
    end
    x0=x1;
end


For more,
Link:- https://github.com/ananya-datta/FreeMat-MATLAB-Programs

FreeMat Code: Sample False position Method

x0=2;
x1=8;
e=0.001;
n=10;
f0=(x0*x0*x0)-(2*x0)-5;
f1=(x1*x1*x1)-(2*x1)-5;
j=1;
k=1;
x5=x1;
printf('iter   x0         x1         x2           f(x0)          f(x1)         f(x2)            error        \n'); 
 
 for (i=1:n)
    x2=((x0*f1)-(x1*f0))/(f1-f0);
    f2=(x2*x2*x2)-(2*x2)-5;
    error=x5-x2;
       printf('%d    %f   %f   %f     %f     %f      %f       %f  \n',i,x0,x1,x2,f0,f1,f2,error);     
  if(abs(f2)<e)     
     break;
  end
 if(f2<0 && f0>0 || f2>0 && f0<0)
        x1=x2;
        f1=f2;
        x5=x1;
    else
        x0=x2;
        f0=f2;
        x5=x0;
    end
     x3(j)=x2;
    j=j+1;
    x4(k)=error;
    k=k+1;
end
Root=x2
plot(x4,'r',x3,'g')



For more,
Link:- https://github.com/ananya-datta/FreeMat-MATLAB-Programs

FreeMat Code: Sample Gauss Elimination Method

n=3;
a=[3 2 3 18;2 1 1 10;1 4 9 16]
for(i=2:n)
    u=a(i,1)/a(1,1);
    for(j=1:(n+1))
        a(i,j)=a(i,j)-(u*a(1,j));
    end
end
a=a


i=n;
u=a(i,n-1)/a(n-1,n-1);
for(j=2:(n+1))
    a(i,j)=a(i,j)-(u*a(n-1,j));
end
a=a


x(n)=a(n,n+1)/a(n,n);
   for(i=1:(n-1))
         sum=0;
   for(j=(i+1):n)
       sum=sum+(a(i,j)*x(j));
   end
     x(i)=(a(i,n+1)-sum)/a(i,i);
  end
   printf(' x=%f \t y=%f \t z=%f\n',x(1),x(2),x(3));
    


For more,
Link:- https://github.com/ananya-datta/FreeMat-MATLAB-Programs

funny Cute Cat


Funny cat video watch in youtube.

Saturday, 20 August 2016

CUTE WHITE PUPPIES


CUTE WHITE SMALL DOG