Re: "Accumulate" in Mathematica 6
- To: mathgroup at smc.vnet.net
- Subject: [mg82877] Re: "Accumulate" in Mathematica 6
- From: Szabolcs Horvát <szhorvat at gmail.com>
- Date: Fri, 2 Nov 2007 03:27:03 -0500 (EST)
- References: <200710301049.FAA20459@smc.vnet.net> <email@example.com> <firstname.lastname@example.org>
Oskar Itzinger wrote:
> Taken - so it's speed. Does that imply we can expect in the future a whole
> bunch of
> speed-optimized functions for doing a similar thing for, say, Times, Divide,
> any other function one can dream of?
> BTW, your mileage may vary - but in my code I've certainly much more
> occasions to
> use Fold/FoldList with other functions than Plus [as per the new
> Accumulate]. So,
> since Fold/FoldList plays a reasonably important role in functional
> wouldn't speeding *them* up be more useful in general than providing just
> optimized functions?
Speeding them up for the general case is probably not at all simple,
otherwise it would have already been done.
Or do you mean that FoldList should check if its first argument is Plus,
and switch to the fast algorithm used by Accumulate if necessary? This
might not be such a good idea, because Accumulate and
Rest@FoldList[Plus, 0, #]& differ in more than just speed. The fast
algorithm used by Accumulate results in reduced precision, so Accumulate
takes an (unfortunately undocumented) option Method that allows for
In:= x = ConstantArray[.1, 10^5];
(example taken from the doc page of Total)
This option could not be included in the more general FoldList.
Prev by Date:
Re: Re: datelistplot - log axis for values
Next by Date:
Re: Mathematica 6 Graphics Options
Previous by thread:
Re: Re: Re: "Accumulate" in Mathematica 6
Next by thread:
Can you get a package back to a notebook easily?