       Re: Array from for-loop iterations

• To: mathgroup at smc.vnet.net
• Subject: [mg116886] Re: Array from for-loop iterations
• From: Valeri Astanoff <astanoff at gmail.com>
• Date: Thu, 3 Mar 2011 05:59:03 -0500 (EST)
• References: <ikl2vv\$sqd\$1@smc.vnet.net>

```On Mar 2, 10:34 am, Lengyel Tamas <lt... at hszk.bme.hu> wrote:
> Dear Mathworld Community,
>
> I am tackling a simple problem,
>
> I have written a simple for-loop using elements from an array of
> 3-dimensional vectors:
>
> f0=0.5;
> For[k = 1, k < 9, k++,
>
>  (vec[[k, 3]] - f0)^2 + (vec[[k, 1]] - f0) (vec[[k, 2]] - vec[[k, 1]]) -
> vec[[k, 2]] - f0) (vec[[k, 3]] - f0)
>     ]
>
> I don't know how to make an array out of the computed results.
>
>
> Thank you.
>
> Tam s

Why not simply this way :

results =
Table[(vec[[k, 3]] - f0)^2 + (vec[[k, 1]] - f0) (vec[[k, 2]] -
vec[[k, 1]]) - (vec[[k, 2]] - f0) (vec[[k, 3]] - f0), {k, 1, 8}]

--
Valeri

```

• Prev by Date: Re: Array from for-loop iterations
• Next by Date: Re: How to suppress (hide) RunThrough window under Windows?
• Previous by thread: Re: Array from for-loop iterations
• Next by thread: Re: Array from for-loop iterations