Not sure about what you meant, but could this solve your problem.
% -------- f) Draw Function (elastica)
\begin{scope}[xshift=0cm, yshift=1cm, rotate=0, scale=1]
\draw [color=magenta!55,fill=gray!55,domain=0:2,samples=50] plot (\x,{-\x/2+\x*\x*\x/24}) -- (2,0) -- (0,0);
\foreach \x in {0,0.05 ...