Introduction Functions  Environments:-  J  Matlab Mathematica Maple APL HP48G TI85 TI89
Function definitions in Maple
sample:= (a,b,n) ->[seq(a+i*(b-a)/n,i=0..n)] :
   
d := x -> [seq((x[i+1]-x[i]),i=1..nops(x)-1)]: 

mids:=x ->[seq((x[i]+x[i+1])/2,i=1..nops(x)-1)]: 

total := proc(t) 
  local j; 
  sum(t[j],j=1..nops(t));
  end:
 

Note: sum is a Maple primitive as used above. 

S_ := (y,ds) ->[0,csum(zip(times,y,ds))]: 

D_ := (y,x) -> zip(quotient,d(y),d(x)): 

where 

csum := proc(t) 
  local i,j,s; 
  for i from 1 to nops(t) 
  do s[i]:=sum(t[j], j=1..i) od: 
  seq(s[i],i=1..nops(t)); 
  end: 

times:=(x,y) -> x*y:
quotient:=(x,y) -> x/y:

In addition, to apply the plot function to a pair of 
data vectors requires that cartesian coordinates 
for the points be constructed first: 

id:=(x,y) -> (x,y): 
vs := (x,y) -> zip(id,x,y): 
samplot:=(x,y) -> plot(vs(x,y)):

A typical sequence to demonstrate the derivative of an integral is the original function: 
f := x -> exp(-x^2); 
x := sample(0.0, 3.0, 100):
y := eval(map(f,x)):
samplot(x,y); 
dx := d(x): 
ym := mids(y): 
Sy :=  S_(ym,dx): 
samplot(x,Sy); 
DSy := D_(Sy,x): 
xm := mids(x): 
samplot(xm,DSy);
The syntax of Maple forces the list operation expressions to look somewhat different from those in the article Sample Calculus.  While the functions sample, mids and d are equivalent, the componentwise division and multiplication require an additional zip function.  For a typical derivative, either enter  zip(quotient,d(y),d(x)) or use the  D_ function perform this combination.  S_ is also defined for convenience. The underscores ( _ ) are used since D is a very useful primitive in Maple

Since sum in Maple does not directly take a list argument, we define a total function to play the role of the sum function in Sample Calculus

 The functions can be defined and the Fundamental Theorem demonstrated by running the file  maplemm.ms in Maple (click to download).
Introduction Functions Environments:-  J  Matlab Mathematica Maple APL HP48G TI85 TI89