MathGroup Archive 1998

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

Search the Archive

Re: Questions about functions.


  • To: mathgroup@smc.vnet.net
  • Subject: [mg11822] Re: Questions about functions.
  • From: Paul Abbott <paul@physics.uwa.edu.au>
  • Date: Tue, 31 Mar 1998 02:28:40 -0500
  • Organization: University of Western Australia
  • References: <6esdkf$57j@smc.vnet.net> <6f1lvm$f9n@smc.vnet.net> <6fi7ca$4ri@smc.vnet.net>

El alchemista wrote:

> 1 - How can I convert the sequence of all arguments of a function  into
> a list ?              In vain I tried      f[x__] := List @@ x

How about the following?

  In[1]:= f[x__]:={x}
  In[2]:= f(1,2,3)
  Out[2]= {1,2,3}

> 2 - How can I make functions which use their own names , for instance so
> that   s[e,f]   for some symbol   s   and all expressions    e , f
> becomes    (s+e)(s+f)  ?

Not quite sure what you want here.  Note that Head gives you the head of
an expression:

  In[3]:= Head[s[a,b]]
  Out[3]= s

Cheers,
	Paul 

____________________________________________________________________ 
Paul Abbott                                   Phone: +61-8-9380-2734
Department of Physics                           Fax: +61-8-9380-1014
The University of Western Australia            Nedlands WA  6907       
mailto:paul@physics.uwa.edu.au  AUSTRALIA                            
http://www.pd.uwa.edu.au/~paul

            God IS a weakly left-handed dice player
____________________________________________________________________



  • Prev by Date: Re: Speed of writing in Mathematica 3.01
  • Next by Date: Re: Questions about functions.
  • Prev by thread: Re: Questions about functions.
  • Next by thread: Re: Questions about functions.