clc
% first I need points that describe the path
% the path is a sequence of differentials
% define the path points
% first row will be x
% second row will be y
x = 0:0.001:1;
x
y = x
y = x;
path = [x;y];
path
dx = path(1,2:1001)-path(1,1:1000);
% evaluate the function everywhere along the path
S = x.^2 + y.^2;
sum(S.*dx);
path
sum(S(1:1000).*dx)
x = 0:0.0001:1;
y = x;
S = x.^2 + y.^2;
path = [x;y];
dx = path(1,2:10001)-path(1,1:10000);
sum(S(1:10000).*dx)
y = x.^2;
path = [x;y];
dx = path(1,2:10001)-path(1,1:10000);
sum(S(1:10000).*dx)
dy = path(2,2:10001)-path(2,1:10000);
sum(S(1:10000).*dy)
