MathGroup Archive 2004

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

Search the Archive

Re: newbie question on functions

  • To: mathgroup at
  • Subject: [mg51761] Re: [mg51750] newbie question on functions
  • From: "David Park" <djmp at>
  • Date: Mon, 1 Nov 2004 02:52:41 -0500 (EST)
  • Sender: owner-wri-mathgroup at


First, if you check the attributes of Times and Log you will find they are
both Listable as are most basic built-in Mathematica operations.

{Flat, Listable, NumericFunction, OneIdentity, Orderless, Protected}

{Listable, NumericFunction, Protected}

Second, the Table function in the two routines isn't really doing anything
since there is no iterator as a second argument. You can calculate your
results directly and you can store them under a symbol, say ratio1 as
follows with some sample data.

list1 = Table[Random[Real, {2, 20}], {5}]
list2 = Table[x, {x, 1, 5}]

{14.5284, 4.74482, 3.10836, 10.8741, 19.8282}
{1, 2, 3, 4, 5}

ratio1 = Log[2, list1/list2]
{2.37297, 2.21692, 2.21481, 1.49147, 1.94953}

Now, ratio1 contains the results.

David Park
djmp at

From: Todd Allen [mailto:genesplicer28 at]
To: mathgroup at

Hi all,

     I have what is probably a nieve question, but it is giving me some
difficulty.  I am trying to generate a function in which I pass two columns
of information from a matrix to this function to perform some calculations.
I can successfully pass the data and get the resulting calculation......but
the problem is the function returns the results but does not save the
results in memory to perform subsequent calculations with.  How can I get
the function to keep the result?  Is there a way to assign the function
output to a new variable before mathematica discards the results.  Does this
behavior have anything to do with the Head of the function  being symbolic,
rather than say a list??

Below is the relevant code:



I appreciate any insight you might have.  Thanks.


  • Prev by Date: Re: Mathematica's (and others) ancient widget toolkit ... why?
  • Next by Date: Re: bimodal ditribution form counting signs of Pi digits differences
  • Previous by thread: Re: newbie question on functions
  • Next by thread: Re: newbie question on functions