MathGroup Archive 2004

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

Search the Archive

Re: multiple outputs from a function

  • To: mathgroup at
  • Subject: [mg52801] Re: [mg52753] multiple outputs from a function
  • From: Ben Kovitz <bkovitz at>
  • Date: Mon, 13 Dec 2004 04:23:20 -0500 (EST)
  • References: <>
  • Sender: owner-wri-mathgroup at

On Dec 11, 2004, at 2:22 AM, Ben Barrowes wrote:

> How do you write a function (or ?) in Mathematica which produces more
> than one output?
> Let's say I have some data and I want a single function to calculate
> the
> mean, variance, std, etc, more than one thing and return those? I know
> that there are builtin functions for those parameters, but the point is
> I want to define functions with more than one output.

Perhaps you want to return a list.  For example:

polarToXY[r_, c_] := {r Cos[c], r Sin[c]}

A list, indicated by braces, is "one thing" but it can contain as many
things as you like.

Ben Kovitz
Humboldt State University

  • Prev by Date: Re: Sorting question
  • Next by Date: Re: Suse 9.2 + mathematica 5.0 problem
  • Previous by thread: multiple outputs from a function
  • Next by thread: Re: multiple outputs from a function