function applyBC_RHDVECTOR_stiffnessMATRIX

% 26 May-------------maliheh------
% right hand side vector---or Program 9----week # 3--------here we apply
% boundary conditions on the matrix A and right hand side VECTOR

BCLEFT= 0;
BCRIGHT= 1;
N=11;
X= program2(BCLEFT,BCRIGHT,N);

E= zeros(2,N-1);
for i = 1 : N-1
    E(1,i)=i;
    E(2,i)=i+1;
end

E
%%  here we compute the right hand side vector  
   RHS= zeros(N,1); 
   for element= 1: N-1
       for i=1:2
               is= E(i,element);
               f_RHS= @(x)  -exp(x) * BASIS_function(is, X, x);
               RHS(is)= RHS(is)+ fem_num_integral_loc(f_RHS, X, E, element);
       end
   end
    
   RHS(1,1)= 0;
   RHS(N,1)= 0;
   RHS
%%  here we compute the matrix A    
   A= zeros(N,N); 
   for element= 1: N-1
       for i=1:2
           for j=1:2
               ip= E(i,element);
               jp= E(j,element);
               fp= @(x) basisp_function(ip,X,x) *  basisp_function(jp,X,x);
               A(ip, jp)= A(ip, jp)+ fem_num_integral_loc(fp,X,E,element);
           end
       end
   end
   A(1, 2:N)= 0;
   A(1,1)= 1;
   A(N, 1:N-1)=0;
   A(N, N)= 1;
   A
%%  Solvinig system and print out the 11 entries of C vector

   C= zeros(N,1);

   C= A\RHS;
   
   C

  

end


function X= program2(BCLEFT,BCRIGHT,N)
X= linspace(BCLEFT,BCRIGHT,N);
end