Можно, например, так:
fourierSum:=proc(f,x1,x2,n) local k,L,a,b,s;
L:=(x2-x1)/2;
a[0] := (int(f(x), x = x1 .. x2))/L;
a[k] := (int(f(x)*cos(k*Pi*x/L), x = x1 .. x2))/L;
b[k] := (int(f(x)*sin(k*Pi*x/L), x = x1 .. x2))/L;
s := unapply((1/2)*a[0]+sum(a[k]*cos(k*Pi*x/L)+b[k]*sin(k*Pi*x/L), k = 1 .. n), x);
end:
> fourierSum(x-> x^2, 0, 1, 10);
