MathGroup Archive 2006

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

Search the Archive

Re: Beginner--How to simulate multiple returns for a function?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg66424] Re: Beginner--How to simulate multiple returns for a function?
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Fri, 12 May 2006 02:02:59 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <Pine.GSO.4.44.0605100054500.17163-100000@smc> <e3v0tt$pav$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

xiaochu wrote:
> Hi, All,
> 
> Another system's functions can have multiple returns, does
> Mathematica support this?

Sure. Multiple values are returned within a list. For example

In[1]:=
Solve[x^2 - 4 == 0, x]

Out[1]=
{{x -> -2}, {x -> 2}}

In[2]:=
NestList[#1^2 & , 2, 3]

Out[2]=
{2, 4, 16, 256}

In[3]:=
PrimeQ[Range[10]]

Out[3]=
{False, True, True, False, True, False, True, False,
   False, False}

Best regards,
Jean-Marc


  • Prev by Date: Automating PolarPlot with Polar Gridlines
  • Next by Date: Re: Applying rules to SparseArray
  • Previous by thread: Re: Beginner--How to simulate multiple returns for a function?
  • Next by thread: Re: Beginner--How to simulate multiple returns for a function?