Re: How to write a loop
- To: mathgroup at smc.vnet.net
- Subject: [mg2663] Re: How to write a loop
- From: carolafb at sbox.tu-graz.ac.at (Carola Friederike Berger)
- Date: Sun, 3 Dec 1995 02:54:25 -0500
- Organization: Graz University of Technology, Austria
Ian Collier (ianc at wri.com) wrote: : In article <48h4dh$rd5 at ralph.vnet.net>, "Enrico C. Walker" : <ewalke1 at gl.umbc.edu> wrote: : : > I need to raise a number to some large exponent - i.e. 245 ^ 500. : > I know that I may run into a problem by plugging it directly. so I'd : like to find the result : > by using some sort of programming loop such. : > : > DO 250 times : > begin : > : > x = x * 245 ^ 2 : > : > end : > PRINT X : > : > Can I do such programming in MATHEMATICA? Please advise. : > : > -RICO- : : There is no need to resort to loops. : : Any copy of Mathematica should be able to evaluate : : 245^500 : : without significant problems. It takes a matter of seconds on : the Macintosh Quadra 700 on my desk. : : I hope this helps. : : --Ian : : ----------------------------------------------------------- : Mathematica Training : Wolfram Research, Inc. : ----------------------------------------------------------- : On my IBM-Compatible 486-66 it took 0.22 seconds to evaluate the code given above (measured with: Timing[x = 1;Do[x = x*245^2,{250}]; x]). -- Carola Friederike Berger alias carolafb at sbox.tu-graz.ac.at