Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Functions of Arrays

  • To: mathgroup at smc.vnet.net
  • Subject: [mg102621] Re: Functions of Arrays
  • From: Harutyun <amirjanyan at gmail.com>
  • Date: Mon, 17 Aug 2009 04:03:04 -0400 (EDT)
  • References: <h68nkj$13g$1@smc.vnet.net>

there are lots of ways to do this

a = Array[x, 5]
f[a_] := a.a; f[a]
f[a_] := Plus @@ (a^2); f[a]
f[a_] := Sum[a[[i]]^2, {i, Length@a}]; f[a]
f[a_] := Block[{sum = 0}, Do[sum += a[[i]]^2, {i, Length@a}]; sum]; f
[a]



  • Prev by Date: Re: Generating a list numnber in string format
  • Next by Date: Re: Generating a list numnber in string format
  • Previous by thread: Re: Functions of Arrays
  • Next by thread: Re: Functions of Arrays