MathGroup Archive 2006

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

Search the Archive

Re: returning a variable's name, rather than the variable's contents

  • To: mathgroup at smc.vnet.net
  • Subject: [mg68436] Re: [mg68422] returning a variable's name, rather than the variable's contents
  • From: János <janos.lobb at yale.edu>
  • Date: Sat, 5 Aug 2006 03:46:34 -0400 (EDT)
  • References: <200608040759.DAA01103@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On Aug 4, 2006, at 3:59 AM, Michael Stern wrote:

>
> There must be a simple way to do this but it eludes me. Take for  
> example the
> following:
>
>
>
> In[2]:= a=1;b=2;c=3;
>
>
>
> In[3]:= Max[a,b,c]
>
>
>
> Out[3]= 3
>
>
>
> What would I do if I wanted Out[3] to equal "c" ?
>
>
>
> Thanks in advance,
>
>
>
> Michael Stern
>
>

Here is a real newbie approach without assignments:

In[1]:=
eqns = {a -> 1, b -> 2,
    c -> 3}
revs = {1 -> a, 2 -> b,
    3 -> c}
Out[1]=
{a -> 1, b -> 2, c -> 3}
Out[2]=
{1 -> a, 2 -> b, 3 -> c}

In[3]:=
Max[a, b, c] /. eqns /. revs
Out[3]=
c

János


  • Prev by Date: Re: How to treat this false singular point?
  • Next by Date: near Planck's mass
  • Previous by thread: Re: returning a variable's name, rather than the variable's contents
  • Next by thread: Re: returning a variable's name, rather than the variable's contents