[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Axiom-mail] sum()
From: |
Daniel Yokomiso |
Subject: |
Re: [Axiom-mail] sum() |
Date: |
Tue, 22 Jun 2004 12:00:35 -0300 |
On Tue, 22 Jun 2004 08:59:04 +0000, Martin Rubey <martin> escreveu:
> De: Martin Rubey <martin>
> Data: Tue, 22 Jun 2004 08:59:04 +0000
> Para: Marcus Better <marcusb>
> Assunto: Re: [Axiom-mail] sum()
>
> You tried:
>
> > f: Integer -> Integer;
> > f(0)==1; f(1)==2;
> > f(n)==sum(f(i)*f(n-i), i=0..(n-1))
>
> Try
>
> f: Integer -> Integer;
> f(0)==1; f(1)==2;
> f(n)==reduce(+,[f(i)*f(n-i) for i in 1..(n-1)])
>
> I have no good explanation why sum won't work.
"sum" doesn't work because your definition is different. The original has "i"
ranging from 0 to (n - 1), while yours ranges from 1 to (n - 1). Using "i" from
0 makes the definition incorrect.
> (Well, I know why it happens
> internally. I'm looking for a solution...)
>
> Martin
Best regards,
Daniel Yokomizo.