Try
fact[0]:1 ; not := and also 0!=1
fact[n]:=n*fact[n-1];
realize that this creates an array so that when
you compute fact[50] once, fact[49] is computed and stored.
RJF
Valerij Pipin wrote:
> Hello,
> Thanks a lot for a small lecture given in reply to Carl.
> Can I ask the question?
>
>
>>PS Though the Maxima language doesn't have pattern-matching or
>>destructor-based function definition, it does have something vaguely
>>related:
>>
>> fact[0]:=0;
>> fact[n]:=n*fact[n-1];
>>
>>Note the square brackets instead of parentheses.
>
> How this one could be connect with pattern-matching task. Also, in my system I
> have
> (C8) fact[0]:=0;
>
> Improper parameter in function definition for fact:
> 0
> -- an error. Quitting. To debug this try DEBUGMODE(TRUE);)
>
> best regards,
> valerij
> _______________________________________________
> Maxima mailing list
> Maxima@www.math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima