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 Sidel Method

e=0.000001;
maxit=100;
n=3;
a=[20 1 -2 17;3 20 -1 -18;2 -3 20 25]
printf('Iter      x        y          z\n');
printf('-------------------------------------\n');
                        for(i=1:n)
                        x(i)=0;
                        end
                       for(iter=1:maxit)
                  big=0;
        for(i=1:n)
            sum=0;
            for(j=1:n)
                if(j~=i)
                    sum=sum+a(i,j)*x(j);
                 end
            end
                 temp=(a(i,n+1)-sum)/a(i,i);
                 relerror=abs((x(i)-temp)/temp);
                 
                 if(relerror>big)
                     big=relerror;
                     x(i)=temp;
                 end
             end
        if(big<=e)
            for(i=1:n)
                x(i); 
             end 
            break;
          end
        if(mod(iter+2,3)==0)                 
               printf('%d    %f   %f   %f\n',iter/3,x(1),x(2),x(3));
              end
          end
     for(i=1:n)
         x(i);
       end       
      printf('\n\n 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

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

FreeMat Code: Sample Bisection method program

x0=2;   x1=7;
d=25;
e=0.001;
y0=(x0*x0)-d;
y1=(x1*x1)-d;
i=0;
j=1;
k=1;
x5=x1;
   if(y0<0 && y1<0 || y0>0 && y1>0)
    starting value unsuitable
    x0
    x1
    yo
    y1
end
      printf('iter    x0         x1         x2           f(x0)          f(x1)         f(x2)       error\n');     
while ((x1-x0)/x1)>e 
    y0=(x0*x0)-d;
    y1=(x1*x1)-d;
    x2=(x0+x1)/2;
    y2=(x2*x2)-d;
   error=x5-x2;
        i=i+1;
    printf('%d    %f   %f   %f     %f     %f      %f        %f \n',i,x0,x1,x2,y0,y1,y2,error);  
    if(y0<0 && y2<0 || y0>0 && y2>0)
       x0=x2;
       x5=x0;       
    else
       x1=x2;
       x5=x1;       
    end    
    x3(j)=x2;
    j=j+1;
    x4(k)=error;
    k=k+1;
end
root=x2 
plot(x3,'r',x4,'g')
xlabel('iteration')
ylabel('roots')
legend('root','error')




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



    

funny Cute Cat


Funny cat video watch in youtube.

Saturday, 20 August 2016

ADECULES - Lighthouse Beautiful view



The video contains a beautiful sea and a lighthouse with light sun focus and greyish surrounding.

What is article marketing? Plus top 10 tips

In a nutshell article marketing is the term used for creating content (articles) with the aim of growing a brand or service (marketing), ideally resulting in more brand awareness or visitors to your website.

FUNNY IMAGE: HANGOUT ALEXAS FROG AND PINK PANTHER