home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: sci.math.symbolic
- Path: sparky!uunet!walter!qualcom.qualcomm.com!antonio
- From: antonio@qualcomm.com (Franklin Antonio)
- Subject: obscure Mathematica question
- Message-ID: <1992Oct27.222733.22398@qualcomm.com>
- Organization: Qualcomm, Inc., San Diego, CA
- Date: Tue, 27 Oct 1992 22:27:33 GMT
- Lines: 45
-
-
- I apologize for the not-very-explicit subject line. I really don't know
- how to describe this question, because i'm obviously missing a concept.
-
- I have a situation where I know that some variables can only take on
- the values 0 or 1. Therefore, for these specific variables, I know
- that when raised to any positive integer power, they stay the same.
- Therefore, I would like to simplify by substituting X in place of X^2
- or X^3 or X^4, etc.
-
- In a program that someone sent me, the following statements appear,
- which seem to tell Mathematica about this situation...
-
- Unprotect[Power]
- w[i_]^(2) := w[i]
- w[i_]^(3) := w[i]
- w[i_]^(4) := w[i]
- w[i_]^(5) := w[i]
- w[i_]^(6) := w[i]
- w[i_]^(7) := w[i]
- w[i_]^(8) := w[i]
-
- Now my question... I had expected that when I evaluated an expression
- containing w[3]^5, for example, this should simplify to w[3], because
- of the above definitions. This, however, does not happen.
-
- If i write a simple expression, such as w[4]^3 + w[3]^4, and evaluate it,
- it comes back w[3] + w[4] as expected. Complex expressions however,
- still contain powers of these variables, and this keeps these expressions
- from simplifying properly. (LOTS of terms would combine if Mathematica
- understood that all exponents on these w's could be dropped.)
-
- There seem to be times where one needs to help Mathematica along by telling
- it explicitly what to do next, and maybe this is one of those times?
-
- What do I do to tell Mathematica to make these substitutions? I figure
- I could use /. to tell it to use a rule explicitly, but what I don't
- understand is why/how it is that it sometimes doesn't know about these
- definitions that i've installed in power, and whether there is a way
- to say HEY YOU, please actually USE these definitions you have.
-
- There is SO MUCH i need to know to use Mathematica effectively! The books
- are so difficult to use, because there's no index by "concept whose name
- i don't even know".
-
-