The function that simplifies a sum doesn't take full advantage of sorting (sorting
places common terms next to each other). So the cost of simplifying a sum of n terms
is O(n^2). This should be more like n * log(n). It's mostly a trick, but sometimes,
tree_reduce("+", ...) is closer to n * log(n), I think (but I don't recall the details).
Of course, tree_reduce("+", create_list(float(log(i)*(-1)^i),i,1,n))) and
apply("+", create_list(float(log(i)*(-1)^i),i,1,n))) add the floats in a different order,
so results will vary. But for float(tree_reduce("+", create_list(log(i)*(-1)^i),i,1,n))),
tree_reduce is simplifying a *symbolic* (no floats) sum.
--Barton
-----maxima-bounces at math.utexas.edu wrote: -----
>Interesting,?but?why??Just?adding?integers?apply?is?faster?than
>tree_reduce.
>Are?there?general?guide-lines?when?to?use?what?
>
>Oliver