---
# System prepended metadata

title: Interpolation
tags: [mma code snippet, mma]

---

# Interpolation
###### tags: `mma code snippet` `mma`


```wlscript
xVec = Range[0, 10 \[Pi], 0.1];
dataVec = {#, Sin[#]^2 (1 - Cos[#])} & /@ xVec;
f = Interpolation[dataVec, InterpolationOrder -> 0]
SmoothdataVec = {#, f[#]} & /@ xVec;

g[x_] := NIntegrate[f[\[Xi]], {\[Xi], 0, x}] + f[0]
Plot[{f[x], Sin[x]^2 (1 - Cos[x])}, {x, 0, 10 \[Pi]}, 
 PlotStyle -> {{Red, Thickness[0.02]}, Black}]
Plot[{g[x], 1/6 (3 x - 3 Cos[x] Sin[x] - 2 Sin[x]^3)}, {x, 0, 
  10 \[Pi]}, PlotStyle -> {{Red, Thickness[0.02]}, Black}]
Plot[{f'[x], 2 (1 - Cos[x]) Cos[x] Sin[x] + Sin[x]^3}, {x, 0, 
  10 \[Pi]}, 
 PlotStyle -> {{Red, Opacity[0.5], Thickness[0.01]}, Black}]


```