MathGroup Archive 2004

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

Search the Archive

RE: Applying my function to elements of a vector


newVector = f[#] & /@ v

regards

F.Jaccard

-----Message d'origine-----
De : Gregory Lypny [mailto:gregory.lypny at videotron.ca]
Envoyé : mer., 21. juillet 2004 12:39
À : mathgroup at smc.vnet.net
Objet : [mg49464] Applying my function to elements of a vector


Hello everyone,

Say I've created a function, f[x_], which accepts a single scalar as
its argument.  I now want to apply that function to each element of a
vector, v, of length n, as in

	newVector = f[v],

but I get an error because my function f does not thread over the
elements of the vector as do built-in Mathematica functions such as
Log[].  How can I get my function to apply to each element of my
vector?

	Regards,

		Greg




  • Prev by Date: Re: simple problem with Map?!?
  • Next by Date: Re: 3D Pascal's Triangle (Cone?)
  • Previous by thread: Re: Applying my function to elements of a vector
  • Next by thread: RE: Applying my function to elements of a vector