Graphs of iterated functions in Weierstrass's approximation theorem
I have a problem while drawing the following functions:
Here is my code:
import graph;
size(8cm,6cm,false);
real F(real x){return sin(x)sin(pix);}
typedef real integral(real);
integral G(int n){return new real(real x){
return ((1-x^2)^n)/(simpson(new real(real t){return (1-t^2)^n;},-1,1));}; }
integral Pnx(int n){return new real(real x){ // I think it is right!
return simpson(new real(real t){return F(t)*G(n)(t-x);},0,1);}; }
draw(Label("$x$",EndPoint),(-2,0)--(2,0),Arrow);
draw(Label("$y$",EndPoint),(0,-2)--(0,4),Arrow);
int smooth=400;
path f=graph(F,0,1,smooth);
draw(f,brown);
pen pe[]={red,green,blue,cyan,magenta,pink,gray};
pe.cyclic=true;
path g;
for (int i : new int[]{5,10,15,20,25,30,35}){
g=graph(G(i),-1,1,smooth);
draw(g,pe[i]);
}
// path h=graph(Pnx(5),0,1,smooth); // can't draw
// draw(h,blue); // can't draw
The output:
Question:
Is my computer weak to draw this function?



Questions tagged [asymptote]
Asymptote is a TeX-aware vector graphics language with built-in 3D capabilities. This tag, which is compatible with the [diagrams] tag, may be used for questions about drawing diagrams. It is also appropriate for questions about the asymptote package, which allows Asymptote code to be included directly in .tex files.
And anybody are free to answer to such questions using alternative drawing tools, like for example,
– g.kov Jul 22 '20 at 18:05metapostorpstricks.