Re: problem with symbol and function declaration
- To: mathgroup at smc.vnet.net
- Subject: [mg30225] Re: problem with symbol and function declaration
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Fri, 3 Aug 2001 00:55:57 -0400 (EDT)
- Organization: Universitaet Leipzig
- References: <9kavlj$c2q$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi, a) *don't* use such kind of definitions ! over bars, subscripts .. and friends are for Input/Output formating *not* for programming ! b) OverBar[x] = 2; test[xx_, sym_:x] = 2*OverBar[sym]*x /. x -> xx; test[1] work as expected. Your definition can't work because test[x_] = 2*OverBar[x]*x will never know that the pattern x_ should use first the symbol x and than replace the symbol x by the value of the pattern x_. Regards Jens Martin Richter wrote: > > Hi > > OverBar[x]=2; > test[x_] = 2*OverBar[x]*x; > test[1] > > gives > _ > 21 > > and not 4. So it is like Mathematica is looking at OverBar[x] as two symbols > and not one ? > Maybe it is a silly idea so use non ASCII letters for variables. > > Thanks for any comments > Martin > > --------------------------------------- > Please remove PET to reply by email