function integral1d=integrate_in_1d(f, a, b)
% integration with simple rectanguls/box method
% int_a^b f(x) dx

N=100; %number of steps in the sum 
x=linspace(a,b,N);

integral1d=0;
for xi=x
    integral1d = integral1d + f(xi);
end
% in rectangles method we need to subtract last element
integral1d = integral1d-f(x(end));

%now we calculate the area
integral1d = integral1d*(b-a)/(N-1);


