|
[Date Index]
[Thread Index]
[Author Index]
Rule-based programming: declare variables to be a number
- To: mathgroup at smc.vnet.net
- Subject: [mg80751] Rule-based programming: declare variables to be a number
- From: Hendrik van Hees <hees at comp.tamu.edu>
- Date: Thu, 30 Aug 2007 23:48:51 -0400 (EDT)
I still work with Mathematica 4.0. I hope, somebody can answer my
question despite this.
I have written a simple rule-based program to evaluate traces of
SU(2)-Lie algebra (Pauli matrices) to help me to obtain the Lagrangian
of a chiral model, but that's not so important for my question.
My problem is the following: To get the usual rules with algebraic
expressions containing numbers and Lie-algebra variables, one needs to
define what happens when a Lie-algebra variable is multiplied by a
number. This works fine as long as I use really constant numbers like
1, 2, 1/2, etc.
However, of course, one needs this feature also for variable numbers,
say a coupling constant g. So I wrote Unprotect[NumberQ] and then said
NumberQ[g]:=True,
but then NumberQ[g^2] evaluates to False. So I have written a whole
bunch of rules to make powers of g also numbers. It works already quite
well, but is there a possibility to just declare a variable (like g) to
be a number, and then make Mathematica know, that expressions like g^2,
Sqrt[g], 1+g, etc. are also numbers?
--
Hendrik van Hees Texas A&M University
Phone: +1 979/845-1411 Cyclotron Institute, MS-3366
Fax: +1 979/845-1899 College Station, TX 77843-3366
http://theory.gsi.de/~vanhees/faq mailto:hees at comp.tamu.edu
Prev by Date:
Re: Special characters in the axis label?
Next by Date:
[Mathematica 6] Bug in Labeled, Center align option not accepted. And how to left justify label under object?
Previous by thread:
check inside a loop?
Next by thread:
[Mathematica 6] Bug in Labeled, Center align option not accepted. And how to left justify label under object?
|