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: [mg68445] RE: [mg68422] returning a variable's name, rather than the variable's contents
  • From: "David Park" <djmp at earthlink.net>
  • Date: Sat, 5 Aug 2006 03:46:47 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Michael,

I like this question because it involves the question of how to work
symbolically and numerically at the same time. Doing that is often the best
way to use Mathematica.

One answer is not to set values for your symbolic variables but do use rules
instead. Then you can have the best of both worlds. Here is one method for
doing that.

data = {a -> 1, b -> 2, c -> 3};

First@First@Sort[data, Part[#1, 2] >= Part[#2, 2] &]
c

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/



From: Michael Stern [mailto:stern at merrinmanagement.com]
To: mathgroup at smc.vnet.net


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





  • Prev by Date: Re: Converting Mathematics slides into PDF
  • Next by Date: Re: Converting Mathematics slides into PDF
  • 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