I am preparing a note for Weierstrass's approximation theorem. There I am stuck with the graphs of the iterated functions generated in the process. How do I draw them in tikz? Following are my data:
I need the graphs for n = 5, 15, 25 and 35. I have made the graphs in Desmos for your compliance. Please find it here. Following is an MWE:
\documentclass{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{tikz}
\begin{document}
\begin{align*}
f(x) &= (\sin x)(\sin \pi x), && 0\le x\le 1\\[1ex]
Q_n(x) &= \frac{(1-x^{2})^{n}}{\int_{-1}^{1}(1-t^{2})^{n}\,dt}, && -1\le x\le 1\\[1ex]
P_n(x) &= \int_{0}^{1}f(t)Q_{n}(t-x)dt, && 0\le x\le 1.
\end{align*}
\begin{tikzpicture}[xscale=10, yscale=2]
\draw (-0.05,0) -- (1.1,0) node[right] {$x$};
\draw (0,-1.2) -- (0,1.2);
\draw [ultra thin, domain=0:1,samples=5000] plot (\x, {sin(\x r)*sin(pi*\x r)});
\draw (0,1) node[left] {\scriptsize$ (0,1) $} (0,-1) node[left] {\scriptsize$ (0,-1) $};
\end{tikzpicture}
\end{document}

Q_nhas a numerator\int_{-1}^1(1-t^2)^n\,\mathrm{d}t(note the^n). And you cannot do numerical integration easily with LaTeX, so I am not sure if this is a good idea anyway. – May 28 '20 at 16:39[0,1]into 500 subintervals. For eachxfrom 0 to 500 plot the area off(t)Q_{n}(t-x)using Riemann sum subdividing[0,1]into say 10 subintervals? Total number of calculation will be 5000 in that case. – Subhajit Paul May 28 '20 at 17:29pgfplotsif you need a LaTeX plot here. – May 28 '20 at 17:35