Re: Optimized for 0*x ?
- To: mathgroup at smc.vnet.net
- Subject: [mg6475] Re: [mg6461] Optimized for 0*x ?
- From: seanross at worldnet.att.net
- Date: Sun, 23 Mar 1997 13:23:05 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Mike Brewer wrote: > > If I execute an expression > a * x > > where a is exactly 0, and x is anything (e.g. Exp[y^2]), does mathematica > know not to evaluate x (which may require some processing)? The reason I > want to know this is because I have a set of variables which become > extremely small during the algorithm, and would like to save some processing > time by using Chop to reduce them to 0 exactly. > > Thanks, > > Mike In my experience, mathematica does not know to not process each element of an expression. This is because 0 * Infinity will return the result Indeterminate. I recommend you use a conditional such as: answer=If[a<=10^-16.,0.,a*x]