Subject: Package descriptive, working with frequency lists
From: Jaime Villate
Date: Tue, 11 Dec 2012 15:06:56 +0000
On 12/11/2012 01:23 PM, Barton Willis wrote:
> To avoid a Maxima /misfea//ture/, the variable p needs to be declared
> local. Without the local declaration,
> Maxima checksif p is a global array before it checks if p is a locally
> defined list.
>
> frequ_mean(x) := block([sum:0, total:0],
> local(p),
> for p in x do
> (sum: sum+p[1]*p[2],
> total: total+p[2]),
> sum/total)$
I didn't know that. Thanks, Barton.
One more consequence of the confusion array vs list.
(%i2) a[2]:5$
(%i3) a:[7,8]$
(%i4) a[2];
(%o4) 5
(%i5) second(a);
(%o5) 8
Regards,
Jaime