Re: How to make series of variables with indexes?
"Bill Page" <[email protected]>
| Newsgroups | gmane.comp.mathematics.axiom.user |
|---|---|
| Message-ID | <[email protected]> |
2008/7/9 Соловьев Александр Александрович : > > Yes, it does help. Thanks a lot. And one more question about subscript(). Why it doesn't work in sum() context? I.e. > > sum(subscript(a,[i]), i=0..3) > > gives 4ai instead of sum a0 + a1 + a2 ... > Arguments of functions are always evaluated before calling the function. In this case 'subscript(a,[i])' is evaluated first to yield the name 'a_i' before calling 'sum'. Instead of 'sum' you can use: reduce(+,[subscript(a,[i]) for i in 0..3]) The expression for list comprehension [x for y in z] evaluates x only after substitution. Regards, Bill Page. _______________________________________________ Axiom-mail mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/axiom-mail