Re: How I can I optimize the following code in order to get very short running time

*To*: mathgroup at smc.vnet.net*Subject*: [mg125107] Re: How I can I optimize the following code in order to get very short running time*From*: "Oleksandr Rasputinov" <oleksandr_rasputinov at ymail.com>*Date*: Wed, 22 Feb 2012 05:28:23 -0500 (EST)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com

On Tue, 21 Feb 2012 11:10:37 -0000, Liwen Zhang <gearss8888 at gmail.com> wrote: > How I can I optimize the following code in order to get very short > running time? > > Time1 = AbsoluteTime[]; > n = 3000; > Do[Do[x = > Sin (45.0)*ArcSin (0.5)*Sqrt (5.0)*ArcTan (2.5555);, {n}], {n}]; > Time2 = AbsoluteTime[]; > Print[Time2 - Time1]; > There are a variety of code optimization techniques in Mathematica. However, this code accomplishes nothing more than setting x = 287.49375 ArcSin ArcTan Sin Sqrt nine million times. Since the value itself is not meaningful (Mathematica uses square brackets for function calls, not parentheses) and there is no apparent reason to set this repeatedly (let alone millions of times), the question naturally arises: what actual problem was this supposed to be a minimal example of? If you post a realistic and workable example, perhaps we can help, but attempting to optimize the above is futile.