I think the problem is due to the fact that gcd by itself (not as a function
call) is a symbol that controls simplification (its default value is subres;
try ? gcd for details.) So you would want to prevent gcd from being
evaluated when it is passed as a function name to map, by adding a quote:
(%i1) map('gcd,[4,12],[5,3]);
(%o1) [1, 3]
Viktor
-----Original Message-----
From: maxima-bounces at math.utexas.edu [mailto:maxima-bounces at math.utexas.edu]
On Behalf Of praimon
Sent: Tuesday, June 19, 2007 10:23 AM
To: Maxima mailing list
Subject: mapping gcd
Hello Maxima list,
I'm still a novice with maxima and having a problem understanding the
following.
This works as I expect:
(%i20) map(lcm,[4,12],[5,3]);
(%o20) [20, 12]
But not this:
(%i21) map(gcd,[4,12],[5,3]);
(%o21) [subres(4, 5), subres(12, 3)]
I've tried changing the default from subres, but no luck.
I can work around like so:
(%i22) create_list(gcd([4,12][i],[5,3][i]),i,1,length([4,12]));
(%o22) [1, 3]
but prefer the conciseness (and speed?) of the original form.
I'm sure I'm missing something very obvious.
Thanks for any help.
_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima