[Date Index]
[Thread Index]
[Author Index]
Re: For loop problem in mathematica
*To*: mathgroup at smc.vnet.net
*Subject*: [mg90221] Re: For loop problem in mathematica
*From*: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
*Date*: Wed, 2 Jul 2008 05:33:30 -0400 (EDT)
*Organization*: Uni Leipzig
*References*: <g4d2qf$emo$1@smc.vnet.net>
*Reply-to*: kuska at informatik.uni-leipzig.de
Hi,
Mathematica does what *you* want, and *if* you wish tho get
exact results and later use N[_,25] you have to live with
the very long number you create. Look what
(i = 1;
Nest[# + 1/(i++)^2 &, 0, 100]
Sqrt[6*x]) // Timing
gives. You mean
(i = 1;
Nest[# + 1/(i++)^2 &, N[0, 25], 100000]
N[Sqrt[6*x], 25]) // Timing
to avoid the infinite precision calculation.
But it will still be very slow.
Regards
Jens
PhysNova wrote:
> Hi,
> i wrote a simple program of evaluating Pi number in M6 to test cpu
> computation timing, to do this a simple for loop
>
> was used:
>
> x=0;For[i = 1, i < 10,000,000, i++, x = x + 1/(i^2)];N[Sqrt(6*x),25]//
> Timing
>
> the result was catastrophe! it take few minuates. but i first expect
> to do this very simple job in few
>
> seconds.computation time is just satisfactory up to 100000 cycle.
>
> could anyone interperet this falut?
> our get an idea to improve the result?
>
> Tanks
>
Prev by Date:
**Re: Possible Bug in Mathematica 6**
Next by Date:
**Re: Controling the color of line segments in a Log plot**
Previous by thread:
**RE: For loop problem in mathematica**
Next by thread:
**Re: For loop problem in mathematica**
| |