Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #13225

Re: problem with append

From Bob Hanlon <hanlonr357@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: problem with append
Date 2013-01-21 05:05 +0000
Message-ID <kdiibf$n7m$1@smc.vnet.net> (permalink)
References <20130120062148.0CB436854@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


rr = {};
For[a = 2, a < 6, a++,
    For[b = 2, b < 6, b++,
      AppendTo[rr, a^b]]]

rr

Or

rr = Table[a^b, {a, 2, 5},
    {b, 2, 5}]//Flatten

Or

rr = Table[a^Range[2, 5],
    {a, 2, 5}]//Flatten


Bob Hanlon


On Jan 20, 2013, at 1:21 AM, Paolo cachecho <paolocach@gmail.com> wrote:

> hello i am new to mathmatica.i have the following problem if anyone could help.
>
> For[a = 2, a < 6, a++,
>    For[b = 2, b < 6, b++,
>  Appendto[rr = {}, a^b]]]
> rr
>
> but rr remains empty. how can i solve this
> thank you
>

Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Re: problem with append Bob Hanlon <hanlonr357@gmail.com> - 2013-01-21 05:05 +0000
  Re: problem with append David Bailey <dave@removedbailey.co.uk> - 2013-01-23 04:18 +0000

csiph-web