Question: Why is this function evaluation so slow?

Consider a function f depending on a parameter k and a variable y

f:=(k,y)->k*s(y);

where s:=y->add(sin(1/y^i),i=1..1000000) is just some nasty function.

Now, why does it take a long time to evaluate f(0,y)? And how could I speed this up?

 

More generally, I would like to plug (varying) parameters into a function, simplify and then do analysis on the resulting function. How could I do that?

Please Wait...