Wolfram ResearchPRODUCTSPURCHASEFOR USERSCOMPANYOUR SITES
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.

Blank (_)

Usage
Notes
Further Examples

Patterns, Rules, and Replacement

This rule can be used to replace the logarithm of a power in the usual way.

In[1]:=  

Out[1]=

Rules are applied using the slash-dot operator.

In[2]:=  

Out[2]=

As an aside, this rule is not built into Mathematica because it is not correct in general.

In[3]:=  

Out[3]=

However, the built-in function PowerExpand does such transformations.

In[4]:=  

Out[4]=

In[5]:=  

Patterns in Function Definitions

You can often simplify the definition of a function by putting the arguments in a suitable form and naming the important parts. In this case we are avoiding the use of [[]] (Part).

In[6]:=  

To make this definition without pattern matching, you would need to use a module, local variables, conditionals, and some complicated constructions to get at the right pieces.

In[7]:=  

In[8]:=  

Out[8]=

We clear the definitions.

In[9]:=  

Using FullForm

The output you see from Mathematica is designed for human eyes. Expressions that look the same may be structurally different. FullForm reveals the internal representation of expressions.

In[10]:=  

Out[10]//FullForm=

In[11]:=  

Out[11]//FullForm=

In[12]:=  

Out[12]//FullForm=

In this example, notice that the second square root is not transformed to become 1/s.

In[13]:=  

Out[13]=

FullForm shows that the representation of the square root depends on whether it is in the numerator or the denominator.

In[14]:=  

Out[14]//FullForm=

In[15]:=  

Out[15]//FullForm=

One rule is needed for each case, and these can be put together in a list.

In[16]:=  

Out[16]=


Any questions about topics on this page? Click here to get an individual response.Buy NowFree TrialMore Information



 © 2009 Wolfram Research, Inc.  Terms of Use  Privacy Policy |
Sign up for our newsletter: