Off[General::spell1]; 
Clear[Differences,XY0,n];
Differences[XY0_] := 
Block[{k},
  XY = XY0;
  n = Length[XY]-1;
  X = Transpose[XY][[1]];
  Y = Transpose[XY][[2]];
  h = Table[0,{n}];
  d = Table[0,{n}];
  m = Table[0,{n+1}];
  a = Table[0,{n-1}];
  b = Table[0,{n-1}];
  c = Table[0,{n-1}];
  bta = Table[0, {n}];
  v = Table[0,{n-1}];
  s = Table[0,{n},{3}];
  Ch[x_]:= (Exp[x]+Exp[-x])/2;
  Sh[x_]:= (Exp[x]-Exp[-x])/2;
  h[[1]] = X[[2]] - X[[1]];
  d[[1]] = (Y[[2]]-Y[[1]])/h[[1]];
  For[k=2,k<=n,k++,
    h[[k]]   =  X[[k+1]] - X[[k]];
    bta[[k]] =  (tau Ch[tau h[[k]]] / Sh[tau h[[k]]])
         - (1 / h[[k]]);
    d[[k]]   = tau^2 (Y[[k+1]] - Y[[k]])/h[[k]];
    a[[k-1]] = (1 / h[[k]]) - (tau /Sh[tau h[[k]]]);
    b[[k-1]] = 2 (bta[[k-1]] + bta[[k]]);
    c[[k-1]] = (1 / h[[k]]) - (tau /Sh[tau h[[k]]]);
    v[[k-1]] = (d[[k]] - d[[k-1]]) ]; ];

Clear[TriDiagonal,a0,b0,c0,v0];
TriDiagonal[a0_,b0_,c0_,v0_] :=
Module[{k,t},
  a = a0; b=b0; c=c0; v=v0;
  For[k=2,k<=n-1,k++,
    t = a[[k-1]]/b[[k-1]];
    b[[k]] = b[[k]] - t c[[k-1]];
    v[[k]] = v[[k]] - t v[[k-1]];];
  m[[n]] = v[[n-1]]/b[[n-1]];
  For[k=n-2,1<=k,k--,
    m[[k+1]] = (v[[k]] - c[[k]] m[[k+2]])/b[[k]];];];

Clear[Coeffs];
 Coeffs:=
 Block[{},
  m[[1]]  = 0;
  m[[n+1]] = 0, ];

Clear[ComputeCoeff,d, h, bta, m, y];
ComputeCoeff[d_,h_, bta_,m_,y_] :=
Block[{k},
  For[k=1,k<=n,k++,
    s[[k,1]] = tau^2 Sh[tau h[[k]]];
    s[[k,2]] = (y[[k]]-m[[k]]/ tau^2 ) / h[[k]];
    s[[k,3]] = (y[[k+1]]-m[[k+1]]/ tau^2 ) / h[[k]];
    ]; ];

Clear[Sr, SP]
S1[x_] := If[x< X[[2]],
    ((m[[1]] Sh[tau (X[[2]]-x)] +
     m[[2]] Sh[tau (x-X[[1]])]) / s[[1,1]])
     + s[[1,2]](X[[2]]-x)+s[[1,3]](x-X[[1]]), 0] ;     
Sr[r_,x_] :=
  If[X[[r]]<=x && x<X[[r+1]],
   ((m[[r]]Sh[tau (X[[r+1]]-x)] +
     m[[r+1]]Sh[tau (x-X[[r]])]) / s[[r,1]])
     + s[[r,2]](X[[r+1]]-x)+s[[r,3]](x-X[[r]]), 0] ; 
Sn[n_,x_] := If[X[[n]]<=x,
   (( m[[n]]Sh[tau (X[[n+1]]-x)] +
     m[[n+1]]Sh[tau (x-X[[n]])]) / s[[n,1]])
     + s[[n,2]](X[[n+1]]-x)+s[[n,3]](x-X[[n]]), 0] ; 
SP[x_] := S1[x] +
      Sum[Sr[i,x], {i,2,n-1}] + Sn[n,x];

Clear[MakeSpline];
MakeSpline :=
Block[{},
  Differences[XY];
  TriDiagonal[a,b,c,v];
  ComputeCoeff[d,h, bta,m,Y] ];
On[General::spell1];

XY = {{0.,0.8},{0.5,0.8},{1.,1.2}, {8.,3.},{11.,6.},
     {18.,6.}, {20.5,3.5},{24.,3.}, {25.,0}}

Clear[tau];
tau=8;
MakeSpline;
dots = ListPlot[XY,PlotStyle->{PointSize[0.02]},
                DisplayFunction->Identity];
gr = Plot[SP[x],{x,0,26},
PlotRange->{{0,26},{0,7.1}}, AspectRatio -> 0.25,
DisplayFunction->Identity];
txt = StringForm["Tension Spline with tau =8"];
Show[gr,dots,DisplayFunction->$DisplayFunction,
PlotLabel->txt,AxesLabel->{"x","y    "}];
Show[gr,DisplayFunction->$DisplayFunction,
PlotLabel->txt,AxesLabel->{"x","y    "}];

Clear[tau];
tau=0.1;
MakeSpline;
dots = ListPlot[XY,PlotStyle->{PointSize[0.02]},
                DisplayFunction->Identity];
gr = Plot[SP[x],{x,0,26},
PlotRange->{{0,26},{0,7.1}}, AspectRatio -> 0.25,
DisplayFunction->Identity];
txt = StringForm["Tension Spline with tau =0.1"];
Show[gr,dots,DisplayFunction->$DisplayFunction,
PlotLabel->txt,AxesLabel->{"x","y    "}];
Show[gr,DisplayFunction->$DisplayFunction,
PlotLabel->txt,AxesLabel->{"x","y    "}];

Clear[tau];
tau=1;
MakeSpline;
dots = ListPlot[XY,PlotStyle->{PointSize[0.02]},
                DisplayFunction->Identity];
gr = Plot[SP[x],{x,0,26},
PlotRange->{{0,26},{0,7.1}}, AspectRatio -> 0.25,
DisplayFunction->Identity];
txt = StringForm["Tension Spline with tau =1"];
Show[gr,dots,DisplayFunction->$DisplayFunction,
PlotLabel->txt,AxesLabel->{"x","y    "}];
Show[gr,DisplayFunction->$DisplayFunction,
PlotLabel->txt,AxesLabel->{"x","y    "}];