Mathematica Demystified

Chapter 4: Odds and Ends

Unlike the other chapters in this book, which are all focused on a single topic, this chapter will introduce a mix of functions that are useful in all sorts of situations.

4.1 Transforming Expressions

Quite often it is useful to put a mathematical expression into a different form. Perhaps looking at the expression in a different way will lend some critical insight. Mathematica has several functions that can help us do this. In Example 4.1.1, we use the Expand function to multiply out a product and name the result poly.

Example 4.1.1
n[15]:= (* expanding a polynomial *)        <b class="bold">poly = Expand [(1 +x)<sup3</sup> (x -2 y)]</b>Out[15]= x + 3 x<sup2</sup> +3 x<sup3</sup> +x<sup4</sup> -2 y 6 x y - 6 x<sup2</sup> y -2 x<sup3</sup> y

We can perform the opposite of Expand by using the Factor function. In Example 4.1.2, we factor poly and get right back to where we started.

Example 4.1.2
In[16]:= (* factoring a polynomial *)         <b class="bold">Factor [poly]</b>Out[16]= (1 + x)<sup3</sup> (x - 2 y)

Since poly is a polynomial in both x and y, it might be interesting to write it as a polynomial in one variable, with coefficients in the other. We can do this with the Collect function. In general, Collect takes two arguments. The first is the expression that we want to transform and the...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Cylindrical Lenses
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.