Re: Help Defining Variables (with long names)
- To: mathgroup at smc.vnet.net
- Subject: [mg16961] Re: Help Defining Variables (with long names)
- From: "David Bailey" <dave-bailey at freeuk.com>
- Date: Thu, 8 Apr 1999 02:32:52 -0400
- References: <7d73sq$dvv@smc.vnet.net> <7dbc9c$810$5@dragonfly.wolfram.com>
- Sender: owner-wri-mathgroup at wolfram.com
Underscores are used for pattern matching, so you get a mess if you try to use them in variable names. However, I do wish Wolfram Research would offer some sensible replacement. usingCapitalLettersCanBeVeryUgly David Bailey Martin Kraus wrote in message <7dbc9c$810$5 at dragonfly.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 > > >