On Fri, 24 Nov 2006, Jaime E. Villate wrote:
> On Fri, 2006-11-24 at 11:22 +0100, Hugo Coolens wrote:
>> zth[1]:1/(1+s);
>> zth[m]:(1+zth(m-1)*s)/(1+s*(1+zth(m-1)));
>>
>> I hoped that xmaxima would produce (1+2*s)/(1+3*s+s^2) when entering
>> zth[2];
>>
>> but it doesn't, can anyone here explain me why it doesn't and how to
>> make
>> xmaxima produce the expected result using recursion.
>
> You have two syntax errors:
> 1. in the definition of zth[m] you must use := instead of :
> 2. on the right-hand side of the definition of zth[m], you must
> use square brackets for zth[m-1], instead of round parenthesis.
>
> Jaime Villate
Thanks for the quick reply, I changed the syntax as you suggested but
entering zth[2]; gives:
zth(1) s + 1
------------------
(zth(1) + 1) s + 1
and not:
(1+2*s)/(1+3*s+s^2)
as I hoped
Is there a way to make maxima "expand" the expression i.e. subsituting
zth(1) by its previously defined value 1/(1+s)
regards,
hugo