Question: recursive procedure function

Write a recursive procedure proc2 with option remember, to compute the function 
                             "f[n]"

 recursively defined by 
                           "f[0] = 0"

,   
                        "f[1] = -7*x^2"

,  
       "f[n] = -3*f[n - 2]^2 + (n + 21)*cos(2*f[n - 1])"

  for n>1.
Evaluate the first derivative of 
f[18];
 at  "x = 2*Pi"

 numerically by the two procedures, and compare running times.

Okay, so for this problem, here is what I have:

>proc2:=proc(n)
option remember;
if n=0 then 0
elif n=1 then -7*x^2;
elif n>1 then -3*f^2[n-2]+(n+21)*cos(2*f[n-1]);
end if;
end proc:

>proc2(18)

and I get this as my result: -3*f^2[16] + 39*cos(2*f[17])

which is true but what can I do to let the proc2 solve it all the way til they get n=0 or 1? 

and how can I plug in 2*pi in to x?

Please help! Thank you so much for your time!

Please Wait...