Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1997
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1997

[Date Index] [Thread Index] [Author Index]

Search the Archive

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]


  • Prev by Date: Re: LogLogPlot
  • Next by Date: Leibniz upgrade released
  • Previous by thread: Optimized for 0*x ?
  • Next by thread: Volumes using Cylindrical Shells