Re: Help Defining Variables (with long names)
- To: mathgroup at smc.vnet.net
- Subject: [mg16754] Re: Help Defining Variables (with long names)
- From: Martin Kraus <mkraus at theorie3.physik.uni-erlangen.de>
- Date: Wed, 24 Mar 1999 02:23:59 -0500
- Organization: Regionales Rechenzentrum Erlangen, Germany
- References: <7d73sq$dvv@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Gutierrez Family wrote: > > 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 The problem is that "_" is not allowed in names of variables. However, it is an operator (Pattern operator); thus, your input is still a valid Mathematica expression. The recommended style is to use upper case letters to separate words in variable names: liquidDensityOfEthyleneGlycol = 1.114 Greetings Martin Kraus