Message Boards Message Boards

0
|
3127 Views
|
1 Reply
|
1 Total Likes
View groups...
Share
Share this post:
GROUPS:

Substituting exponents in an expression with a constant

Posted 11 years ago
Hello! Given an arbitrary algebraic expression in which some of the variables are raised to various integer exponential powers, how could one automatically transform the expression so that all exponents of ANY value are globally replaced with a SINGLE new constant value? For example, if the starting expression is (u^3)(v^4)(w^5) and the desired "global replacement exponent" is 9, then the desired result would be (u^9)(v^9)(w^9). If a particular variable does not have an exponent (i.e. has an implied power of 1) then it is not to be modified, but rather left as is in the original expression.  I am new to Mathematica, and I'm not sure if I need to do some kind of string manipulation on the symbolic equation, or if there are Mathematica functions to assist in this transformation.  I have seen that there are functions to extract portions of symbolic expressions, but I can not find anything specific that would help with this kind of unusual substitution.  Thanks in advance for any help!  
POSTED BY: R S
Mathematica has a powerful system for pattern matching and replacement. This is how most operations like this would be described.
Here for example is a pattern that takes any symbol to a numeric power and replaces it with the symbol to the 9th power:
sym_Symbol^pow_?NumericQ -> sym^9

The documentation center has more information about patterns and pattern matching:
http://reference.wolfram.com/mathematica/tutorial/Introduction-Patterns.html
POSTED BY: Sean Clarke
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract