Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #7883
| From | Sseziwa Mukasa <mukasa@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: How to simplify this code with variable number of nesting loops? |
| Date | 2012-01-16 12:02 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <jf13kc$5m4$1@smc.vnet.net> (permalink) |
| References | <201201150951.EAA19677@smc.vnet.net> |
Do[some computations,Evaluate[Table[{a[k],a[k-1]+1,2 k-1},{k,g}]]
On Jan 15, 2012, at 4:51 AM, Rex <aoirex@gmail.com> wrote:
> Considering an array a[i], i=0,1,...,g, where g could be any given
> number, and a[0]=1.
>
> for a[1]=a[0]+1 to 1 do
> for a[2]=a[1]+1 to 3 do
> for a[3]=a[2]+1 to 5 do
> ......
> for a[g]=a[g-1]+1 to 2g-1 do
> ###some computations here###
>
> The problem is that everytime we change the value of g, we need to
> modify the code, those loops above. So this is not a good code.
>
> Any advice would be greatly appreciated.
>
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: How to simplify this code with variable number of nesting loops? Sseziwa Mukasa <mukasa@gmail.com> - 2012-01-16 12:02 +0000
csiph-web