Symbolic and Numeric Calculations, Roots Finding,
File Input and Output

Mathematica  has a powerful array of functions that solve equations symbolically and ways to simplify expressions.  Many people use Mathematica because it removes the tedium of doing algebra with pencil and paper---and perhaps more importantly it doesn't make errors!  However, one frustrating aspect is getting Mathematica to represent an expression in exactly the form you desire.  Sometimes it is possible with patience,practice and skill---and sometimes you have to give up and accept that the form of the expression will not be ``neat and compact.''

Operations on Polynomials, Rational Expressions, and Simplification of Expressions

A good way to gain familiarity with Mathematica's operations to do symbolic algebra is to look though the categories in the Built-in Functions section in the Help Browser.  Look though the names of functions  under Algebraic Computation--they have names that are fairly indicative of their purpose.

PaulENomeal  =  (1  +  2  a  +  3  x  +  4  z)^4

FatPEN  =  Expand[PaulENomeal]

Factor[FatPEN]

PaulinX  =  Collect[FatPEN, x]

Coefficient[PaulinX, x, 0]

PaulSpiffedUp  =  
      Sum[
Simplify[Coefficient[PaulinX, x, i]] x^i,  {i, 
          0, 20}]

Simplify[PaulSpiffedUp]

RashENell  = (((x + y))/((x - y))) +  (((x - 
                y))/((y + x)))

Apart[RashENell]

Together[RashENell]

Apart[Together[RashENell]]

Numerator[Together[RashENell]]

Simplify[RashENell]

Factor[RashENell]

One common hurdle is getting Mathematica  to remove roots:

RootBoy  =  (Sqrt[(((x + y))^2)])

Simplify[RootBoy]

Note in the following statement that "x ∈ Reals" means "x is a real number" and "&&" is the "Logical And" operator.

Simplify[RootBoy,  
      x ∈  Reals  &&  y  ∈  Reals]

Simplify[RootBoy,  
      x ≥  0  &&  y   ≥  0]

Brute force; clever ,but not a good idea follows:

RootBoy /. Sqrt[(expr_)^2] ->  expr

Calculus

AMessyExpression  =  Log[x Sin[x]]/((1/x))

Limit[AMessyExpression, x -> 0]

DMess  =  D[AMessyExpression, x]

Integrate[DMess, x]

Integrate[DMess, {x, 0, E}] // N

(AMessyExpression /. x -> e)  -  (AMessyExpression /. 
          x -> 0)

(AMessyExpression /. x -> E)  -  
      Limit[AMessyExpression, x -> 0]

E Log[E Sin[E]] // 
      N

Integrate[Sin[x]/Sqrt[(x^2  +  a^2)], x]

Integrate[Sin[x]/Sqrt[(x^2  +  a^2)], x, 
      Assumptions -> a  ≥  0]

Integrate[Sin[x]/(Sqrt[(a^2) + (x^2)]), x, 
      Assumptions -> Re[a^2] > 0]

UglyInfiniteIntegral  =  
      Integrate[Sin[x]/Sqrt[(x^2  +  a^2)], {x, 0,  ∞}, 
        Assumptions -> Re[a^2] > 0]

N[UglyInfiniteIntegral /. a -> 1]

Now we will introduce the Taylor expansion capabilities in Mathematica:

Series[AMessyExpression, {x, 0, 4}]

FitAtZero  =  
      Series[AMessyExpression, {x, 0, 4}] // Normal

Plot[{AMessyExpression, FitAtZero}, {x, 0, 3}, 
      PlotStyle -> {{Thickness[0.02], Hue[1]}, {Thickness[0.01], 
            Hue[0.5]}}]

Solving Equations

TheEquation  =  a x^2  +  b x  +  c

Note the use of Equal (==) rather than Set (=) in the following; using "=" will produce an error message.

TheZeroes  =  Solve[TheEquation  == 0, x]

Note that the roots are given as Rules. Now we ask Mathematica to verify that the solutions it found are indeed roots to the specified equation. Here is a prototypical example of using Replace (/.) to accomplish this:

TheEquation /. TheZeroes

Simplify[TheEquation /. TheZeroes]

More examples of using Solve:

a[i_]  :=  i + 1

TheQuinticEquation  =  Sum[a[i] x^i, {i, 0, 5}]

Solve[TheQuinticEquation == 0, x]

Quad1  =  a x^2  +  y  +  3
Quad2  =  a y^2  + x  +  1

Solve[{Quad1 == 0, Quad2 == 0}, {x, y}]

Numerical Solutions

Integrate[Sin[ x]/Sqrt[(x^2  +  a^2)], x]

Integrate[Sin[ x]/Sqrt[(x^2  +  a^2)], {x, 0, 1}]

NIntegrate[(Sin[ x]/Sqrt[(x^2  +  a^2)]) /. a -> 1, {x, 
        0, 2 Pi}]

Plot[
NIntegrate[
        Sin[ x]/Sqrt[(x^2  +  a^2)],  {x, 0, 
          2 Pi}]
, 
{a, 0, 
        10}]

Plot[{AMessyExpression, FitAtZero}, {x, 0, 3}, 
      PlotStyle -> {{Thickness[0.02], Hue[1]}, {Thickness[0.01], 
            Hue[0.5]}}]

NSolve[AMessyExpression == 0, x]

FindRoot[AMessyExpression == 0, {x,  .5, 1.5}]

FindRoot[FitAtZero == 0, {x,  .5, 1.5}]

FindRoot[AMessyExpression == 0, {x, 2.5, 3}]

File Input and Output

AMessyExpression  >>  AFile.m

Clear[AMessyExpression]

<< Afile.m

The next statement retrieves the content of Afile.m, but does not associate it with any name (in particular, with AMessyExpression!):

AMessyExpression

AMessyExpression   =  <<  AFile.m

AMessyExpression

The next statement introduces the "show file" command, !!

!!  Afile.m

Close["ANewFileName"]

AFileHandle  =  
      OpenWrite["ANewFileName", FormatType -> OutputForm]

RandomPairs  =  Table[{Random[], Random[]}, {i, 20}]

Write[AFileHandle, RandomPairs]

!! ANewFileName

Write[AFileHandle, MatrixForm[RandomPairs]]

!! ANewFileName

Close[AFileHandle]

Using Packages

Fortunately, others have gone to the trouble of writing files full of useful stuff--and you can load this stuff into Mathematica for your very own use.  Some people produce useful stuff and you can buy it, which is nice if you find it valuable--and you can write stuff and gain value by selling it, which might be even more nice.
Mathematica comes with a group of Standard Packages, that you can load in to do special tasks.  The Packages are listed under "Add-ons & Links" in the Help Browser.  For example, take a look at the specialized package under "Miscellaneous" called "World Plot"...

<< Miscellaneous`WorldPlot`

\(\(\(WorldPlot[{{"USA", "France", "Germany", "Italy", "Belgium", "Luxembourg", "Switzerland"}, {RGBColor[1, 0, 0], 
          RGBColor[0, 0.5, 0], RGBColor[0.5, 0, 0], \ RGBColor[0, 0, 0], 
          RGBColor[0.4, 0.4, 0.1], RGBColor[0, 0, 0.5], 
          RGBColor[0.9, 0.6, 0.6]}}]\)\(\ \)\)\)

\(\(\(WorldPlot[{{"USA", "France", "Germany", "Italy", "Belgium", "Luxembourg", "Switzerland"}, {RGBColor[1, 0, 0], 
          RGBColor[0, 0.5, 0], RGBColor[0.5, 0, 0], \ RGBColor[0, 0, 0], 
          RGBColor[0.4, 0.4, 0.1], RGBColor[0, 0, 0.5], 
          RGBColor[0.9, 0.6, 0.6]}}, 
      WorldProjection -> Mollweide]\)\(\ \)\)\)

\(\(\(WorldPlot[{{"USA", "France", "Germany", "Italy", "Belgium", "Luxembourg", "Switzerland"}, {RGBColor[1, 0, 0], 
          RGBColor[0, 0.5, 0], RGBColor[0.5, 0, 0], \ RGBColor[0, 0, 0], 
          RGBColor[0.4, 0.4, 0.1], RGBColor[0, 0, 0.5], 
          RGBColor[0.9, 0.6, 0.6]}}, 
      WorldProjection -> LambertAzimuthal]\)\(\ \)\)\)