% part c, problem 1, homework set 1
% this script takes in a vector, 
% sets periodic boundary conditions,
% and returns the result y so 
% that y_i = x_(i+1) - 2*x_i + x_(i-1)
 
  n = length(x);
  
  %allocating appropriate space for result
  y = zeros(1, n);
  
  %setting periodic boundary conditions
  xnew(1:n+2) = [x(n), x, x(1)]
  
  %solving for y using above formula
  i = 2:n+1;
  y(i-1) = xnew(i+1) - 2.*xnew(i) + xnew(i-1);




