On 5/27/08, Adam Majewski <adammaj1 at o2.pl> wrote:
> >> f(z,c):=z*z+c$
> >> F(n, z, c) :=
> >> if n=1 then f(z,c)
> >> else f(F(n-1, c, z),c)$
> >> diff(F(n,z,c),z);
Well, how about this.
f (z, c) := z^2 + c;
F (n, z, c) := if integerp (n) then if n = 1 then f (z, c) else f (F
(n - 1, c, z), c) else 'F (n, z, c);
m (n, z, c) := at (diff (F (n, 'z, c), 'z), 'z = z);
I've made use of a couple of tricks here.
(1) use integerp to protect the recursion; if not a literal integer,
return a noun expression.
(2) use at to evaluate the derivative for a given value of z,
otherwise Maxima complains if z is something other than a symbol.
With the functions as defined above I get this:
m (3, z1, c1);
=> 2*(4*z1*(z1^2+c1)+1)*((z1^2+c1)^2+z1)
expand (%);
=> 8*z1^7+24*c1*z1^5+10*z1^4+24*c1^2*z1^3+12*c1*z1^2
+8*c1^3*z1+2*z1+2*c1^2
I seem to be getting different coefficients than you; dunno what's up with that.
HTH
Robert Dodier