Introduction Functions  Environments:-  J  Matlab Mathematica Maple APL HP48G TI85 TI89
Function definitions in Mathematica                   See also:    MathTools
sample[a_,b_,n_] := N[Range[a,b,(b-a)/n]] /.  0->0.0 

d[x_List] := Drop[x,1] - Drop[x,-1]

mids[x_List] := (Drop[x,1] + Drop[x,-1]) / 2 

sum[x_List] := Apply[Plus,x] 

S[x_List]:=FoldList[Plus, 0.0, x ] 

plot[x_List, y_List] := ListPlot[Transpose[{x,y}], PlotJoined ->True]

A typical sequence to demonstrate that the derivative of the integral  returns the original function might consist of 

              x = sample[0,3,100]; 
               y = Exp[-x^2]; 
              Iy = S[mids[y]*d[x]]; 
            DIy = d[Iy]/d[x]; 
          yplot = plot[x,y]; 
        DIplot = plot[mids[x],DIy]; 
        Show[yplot,DIplot]; 

 This user-defined plot function corresponds to the two-argument Matlab function plot(x,y).  After completing multiple plots, they can be superimposed by the MathematicaShow function.  Except for this difference in multiple plots, Sections 2 through 6 of Sample Calculus should directly transliterate using these definitions.  Of course, the Matlab periods are unnecessary since arithmetic operations are automatically listable in Mathematica and function arguments use square brackets. 
 File sampcalc.nb is a notebook to run the sample calculus functions.
Introduction Functions Environments:-  J  Matlab Mathematica Maple APL HP48G TI85 TI89