MathGroup Archive 1999

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

Search the Archive

Re: Help Defining Variables (with long names)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg16760] Re: Help Defining Variables (with long names)
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Wed, 24 Mar 1999 02:24:03 -0500
  • References: <7d73sq$dvv@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Gutierrez Family <gutierrez_fam at geocities.com> wrote in message
news:7d73sq$dvv at smc.vnet.net...
> Hello to all.
>
> I'm new to Mathematica and have a very basic question (one that I
> haven't found an answer to using the online help - I'm probably
> looking
> in the wrong place).
>
> What is the best way to declare variable with a 'long name'?  I am
> currently using the underscore to separate the words.  For example:
>
> liquid_density_of_ethylene_glycol=1.114
>
> Unfortunately, I run into trouble when performing basic arithmetic.
> For
>
> example, if I multiply '4*liquid_density_of_ethylene_glycol', I expect
> to get 4.456.  Instead I get '4_ethylene_glycol_of liquid_density'.
> This is after receiving 'Set::write : Tag Times in _ethylene_glycol_of
> liquid_density is Protected.'.
>
> Can someone please advise?  Thank you very much for your time.
>
> -- Daly Gutierrez


Daly,


Don't use underscore - it has a special use in Mathematica as a blank place
holder to do with pattern matching and replacement (* see (A) below*)
I should initial capitals for the components.

LiquidDensitOfEthyleneGlycol

The error message suggests that you had tried to make an assignment of the
form

4 x = 9

The reason for this is that the full form of 4 x  is  Times[4,x] and so Mathematica 
is being asked to make a definition for the protected function Times.

(A)
_         any expression
n_       an expression temporarilly called n
_h       any expression with head h ( h[1,2] and, special usage, _Integer is
any   integer)
n_h     an expression with head h, temporarilly called n

Allan


---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565







  • Prev by Date: Printing Graphics fm Mathematica J
  • Next by Date: subgraph ismorphism (and MCS) in mathematica
  • Previous by thread: Re: Help Defining Variables (with long names)
  • Next by thread: Re: Help Defining Variables (with long names)