Math 166
Computer Lab #1
Introducing Mathematica

Revised on 23 August 1996

Goal:  This lesson introduces Mathematica, and shows how it may be used to calculate with numbers and symbols, create plots and tables of functions, and record your comments about your work.

New Mathematica Concepts and Commands:  
  Entering commands;
  Variables and expressions; 
  Defining functions;
  Sin, Cos, Log, Sqrt; 
  N; 
  D and Integrate; 
  Solve;
  Plot and Show; 
  Table.

Introduction

Mathematica is a powerful software package which combines numerical computations, symbolic manipulation, graphics, and text.  The labs for this class are prepared in Mathematica's notebook format.  While running Mathematica, you can read the lab and experiment with the interactive exercises.  At the end of the notebook are a number of assigned problems, which should be worked out using Mathematica, printed, and handed in.

Getting Mathematica's Attention

A Mathematica  notebook is broken up into smaller areas called "cells".  These cells are of two types, "text cells", like this one, which contain information, and "command cells", which contain commands or formulas for Mathematica  to evaluate.

Mathematica  doesn't try to evaluate your formula until you signal it in a special way.  To get Mathematica  to pay attention to a formula, you must press the ENTER key on the extreme right of the keyboard, or else SHIFT RETURN (hold down the shift key and press RETURN). 

Mathematica uses the RETURN key by itself just to get a new line.  Thus you can continue a long command on the next line, or you can type several commands in a row, hitting RETURN after each one.  Mathematica  won't look at the commands you've typed until you press SHIFT RETURN.

Exercise:  Place your cursor just after the formula "6+9" below.  Click once to choose this formula.  Now press ENTER to get Mathematica  to carry out the operation.

6+9

Actually, you don't have to place the cursor just after the formula; anywhere in the formula, or even anywhere in the cell will do the trick.

Exercise: It's time for you to try entering a formula yourself.  For this, we need to make a new "command cell".  To do this, slowly move the cursor just below this paragraph of text until it changes to a horizontal bar.  That means you can insert a new cell there.  To start the cell, click the mouse.  Now type the formula "300 / 6".  Have Mathematica  evaluate this formula by pressing the ENTER key.

Variables and Expressions

Usually, we don't compute with numbers, but with variables, such as x, y, or t, and expressions or formulas involving those variables.  To give the variable x the value 17, simply type "x=17".  x will keep this value until you change it.  To check the value of x at any time, simply type "x".

Mathematica  allows you to define variables, carry out arithmetic operations on them, and optionally assign the result to a variable.   The arithmetic operations use special symbols:

+ and - mean addition and subtraction;
* means multiplication;  often the * can be replaced by a blank space.  2*x means the same as 2 x.
/ means division;
^ raises a number to a power; 3^2 is 9.

You may need to use parentheses, especially when defining a fraction.  For instance, if you want to divide x+1 by x, then you should write (x+1)/x, rather than x+1/x. 

Mathematica  uses  [ ]  to indicate the argument of a command; for example, Sin[x], Sqrt[7].

Another special symbol is %.  To Mathematica, this is an abbreviation for the result or output of the previous command, whatever it was.   For instance, suppose you want to average the numbers 63, 95, and 88.  If you add them up, but forget to divide by 3, then instead of repeating the command, you can just use % for the sum you just computed:

63+95+88
%/3

Mathematica  usually responds to a formula you type by printing out its value.  This is nice in most cases, but it means that if you type "x=198" then Mathematica  will print  back the value 198.  If this annoys you, you can always tell Mathematica  not to print such a value by ending the formula with a semicolon.  ENTER the following two assignments and note the difference in Mathematica's response:

x1 = 1976
x2 = 1983;

Exercise: The body mass index or BMI is a crude estimate of whether a person has a healthy weight.  As described in the August 1996 issue of Scientific American, the BMI is defined as the ratio of weight to the square of height, that is, 
  bmi = w / h^2
 A value of BMI less than 25 is desirable, and a value over 30 suggests that the person should try to reduce weight.

Unfortunately for us, w must be measured in kilograms, and h in meters.  But if a person weighs p pounds, then we can divide p by 2.2 to get the weight w in kilograms.  Similarly, if a person has a height of f feet and i inches, then we can convert this height to inches and divide by 39.4 to get the value h measured in meters.

Suppose Jeffrey has a height of 6 feet 1 inches, and weights 230 pounds.  Using Mathematica, finish and ENTER the definitions of the variables p, f, and i.   Note that
these three commands are all grouped in one cell, for convenience.

p =
f =
i =

Now write out and ENTER formulas to compute Jeffrey's weight w in kilograms and height h in meters, in terms of the variables p, f, and i.  Be careful!  You may need to use parentheses to compute the height properly.

w = 
h =

Finally, write out the formula for the BMI, and ENTER it.  If you have done your work correctly, you should be able to tell if Jeffrey should lose weight or not.

bmi =

To check your work, you may double-click on the following cell to open it.

p =230;
f =6;
i =1;
w=p/2.2
h=(f*12+i)/39.4
bmi=w/h^2

Converting Symbols to Numbers

A traditional calculator handles numbers only to a fixed degree of precision; however, Mathematica  can handle numbers of any precision and returns an answer in the most precise form possible.  For example, if we ask Mathematica  for the value of à12, we do not obtain the expected answer.  To do this, we use Mathematica's Sqrt[ expression ] function, which finds the square root of the expression between the square brackets.  Note that Mathematica  requires a capital letter to begin the name of Sqrt, and square brackets, not round or curly ones!  ENTER the following formula:

Sqrt[12]

The answer is not quite what we expect.  We wanted a decimal value, but, unlike a calculator, Mathematica  will only compute exact answers, unless told to give a numerical value.  In order to get a useful result, ENTER the following command, which asks Mathematica  to give us a numerical decimal value of the given expression.

N[ Sqrt[12] ]

The result is given to five significant digits which is the default number;  if we want more significant digits, we can ask Mathematica  to provide them for us.  For example,

N[ Sqrt[12],50 ]

Functions

We can think of a function as a formula which is given the value of one or more variables and produces a result.  A function can be thought of as a name for an expression.  But these names can be very handy abbreviations when you want to refer to the same expression several times.  Mathematica   has a very particular format that should always be used when defining a function.  For example, when defining a function f of one independent variable x, the form is:

Clear[ f, x]

f[ x_ ] := expression

The Clear command tells Mathematica   to disregard any previous information about the names f and x.  This is important because if you used either name earlier for some other quantity and you do not clear this information, then Mathematica  can become confused and be unable to handle your commands properly.

For example, to define a function like g(x)=x^2-2x-3, ENTER the commands:

Clear[g,x]
g[ x_ ] := x^2 - 2*x - 3

Notice that Mathematica  doesn't "say anything" after we enter this formula.  We are explaining the relationship between the variable and the functional result.  We won't see any particular results until we specify the value of the variable, or ask to see a plot or table.  Each time g is evaluated at some point, Mathematica  returns to the definition of g which you have provided to compute g at the given point.

You can pick any name you want for a function.  Often, we pick "generic" names like "f", "g", "f1" and so on.  One good rule for names is never to use capital letters.  This is because all of Mathematica's commands and functions have names that begin with a capital letter, and it's important that you never accidentally try to use such a name for one of your variables or functions.

Inside the square brackets of the function definition, you must put the name of the independent variable used to define the function; the name must have an underscore appended to it.  Thus, the variable x shows up on the left hand side of the function definition as "x_".  After the closing square bracket, you must use ":=" to signal the start of the formula.

Once you have defined a function, you can evaluate it in several ways.

For a direct evaluation, you simply type the function name, with numerical values replacing the arguments.  Thus, for example, we could evaluate our g function at the particular value x=2, by ENTERing the command:

g[2]

Sometimes, it may be more convenient to use a variable as the argument, as long as the variable has the proper value.  The variable name does not have to match the name used in the original definition of the function.  Also, you do not use the underscore character here; that's only for the function definition.  ENTER the commands:

y = 4;
g[y]

Sometimes, it is useful to define a function that depends on two or more arguments.  The rules are very similar.  For instance, to set up and evaluate a function that determines the area of a rectangle of a given height and width, ENTER the commands:

Clear[area, h, w]

area[h_, w_] := h*w

area[6, 10]

The functions we have seen so far are quite simple, taking one or two values, applying a formula, and returning a value.  Mathematica  also allows us to define much more complicated functions, somewhat like subroutines in a programming language.  We will see how this is done later.

Differentiation

The command D[expression, variable] differentiates the given expression with respect to the named variable.  For instance, we could differentiate the cosine function cos(x) with respect to x by ENTERing the following command :

D[ Cos[x], x].

If you have defined a function, such as func[x], then you can also compute its derivative by using the prime symbol: func'[x].  For instance, ENTER the following commands:

Clear[g, x]

g[x_] := 1 / (1+x^2)

g'[x]

Exercise.  Differentiate the function ( x^4 - x^2 + 1 )^5.  (Again you can double-click the following cell to check your answer.)

D[(x^4-x^2+1)^5,x]

Or we can use the prime command:

Clear[g,x]
g[x_]:=(x^4-x^2+1)^5
g'[x]

The D command can also be used to differentiate a function of several variables, which the prime notation can not do.   

On the other hand, the prime notation can be used in the Plot command, and certain other Mathematica  commands, where the D command would fail.

Integration

Mathematica  can compute the indefinite and definite integrals of a function, using the Integrate command.  For an indefinite integral, the command is 

  Integrate[ expression, variable].
  
For instance, to integrate the square root function Sqrt[x], ENTER the command:

Integrate[ Sqrt[x], x ]

This command returns a function, not a number, because we have asked for the indefinite integral.  Note that the "+ C"  (plus an arbitrary constant) is not included.

Exercise.  Compute the indefinite integral (or antiderivative)  of x sin(x):

Integrate[x*Sin[x],x]

The command Integrate[ expression, {x, xmin, xmax} ] will compute the definite integral of an expression involving x, over the interval [xmin,xmax].   We could integrate the natural logarithm function from 1 to 10 by ENTERing the command

Integrate[ Log[x], {x, 1, 10} ]

Note that the built-in Mathematica function for the natural logarithm function, ln x, is Log[x].  You can also use this
function to find the logarithm of x to other bases, but then you must give the Log function two pieces of information.  The logarithm of x in base 10, for example, is Log[10,x].

Exercise.  Compute the definite integral of x^3 from 0 to 2:

Integrate[x^3,{x,0,2}]

Graphs

The command Plot[ expression, {x,xmin,xmax}  ] will display a plot of the given expression, with the variable x ranging from xmin to xmax.

Let's make a plot  of the sine function from -Pi to Pi.  (Pi is a special name that Mathematica automatically understands). ENTER the following command:

Plot[ Sin[x], {x,-Pi,Pi} ]

Often, it is convenient to have a graph which shows two functions at the same time.  There are several ways to do this.

The first way uses the idea of a Mathematica  list which is just an array.  The syntax for a list is to  enclose the elements in curly brackets and separate the elements by commas.

In many cases, where a command expects one object, you can give several objects, as long as you separate them by commas, and group them with curly brackets; i.e., put them in a list.  In particular,  to get two functions on one plot, we use curly brackets to group them in the Plot command.  ENTER the following command:

Plot[  {x^2,  3*x} ,  {x, -1, 4} ]

A second way uses the fact that we can name the result of any Mathematica   command.  Even the output of a Plot command can be named, and thus saved for later use.  If you save a plot in this way, you can show it again using the Show command.  And the Show command works with more than one plot, showing them all on the same axis.  ENTER the following commands:

p1 = Plot[ x^2, {x,0,3} ]
  p2 = Plot[3*x, {x, -1, 4} ]
  Show[p1, p2]

One nice feature of this method is that the two functions can be plotted over different ranges.  A bad feature is that both plots show up separately before being combined.  There is a way to hide the first two plots, but we'll discuss that later.

Exercise. Plot both sin(x) and cos(x) from x=-Pi to x=Pi on one graph.

Plot[  {Sin[x],Cos[x]} ,  {x, -Pi,Pi} ]

Color makes graphs stand out. We tell Mathematica  to plot our function in color by using an option called PlotStyle in the Plot command.  There are actually many other options for the Plot command as entering ??Plot will demonstrate; options on Mathematica  commands are entered by typing the option name, an arrow "->", and the value of the option.  ENTER this command:

Plot[ Sin[x], {x, 0,10},
  PlotStyle->{ RGBColor[1.000, 0.000, 0.000] }]

We can also add a plot label to the graph by using the PlotLabel option.  ENTER this command:

Plot[ Sin[x], {x, 0,10},
  PlotStyle->{ RGBColor[1.000, 0.000, 0.000] },
  PlotLabel->"Graph of Sin(x)"]

The following is an example which uses color to distinguish between two functions on the same graph.   We give two functions, so we must specify two values of RGBColor enclosed in a list.  Note that "RGB" stands for "red", "green" and "blue".  The three numbers used to specify an RGBColor command are the amounts of these three colors to use in making the plot color.  Each amount must be between 0 and 1.  ENTER this command:

Plot[ {Sin[x], Sin[x]*Sin[2*x]}, {x, 0,10},
  PlotStyle->{ RGBColor[0.000, 1.000, 0.000],
               RGBColor[0.500, 0.000, 0.750] }]

Mathematica  can try to help you pick colors.  To do so, start a Plot command, but leave the RGBColor section empty, as in the following example.  (Don't ENTER this yet!)

Plot[ Sin[x]*Sin[3*x], {x, 0,10},
  PlotStyle->{ } ]

Now click between the two curly brackets after the PlotStyle command.  This will "park" the text cursor right where the RGBColor command should go.

Now click on the Action menu, and slide down to "Prepare Input".  Don't  unclick the mouse yet!  Slide over to the right, until you see a new submenu.  On that menu, move down to "Color Selector", and now let go of the mouse.  You will see color dials from which you can select an appropriate color.  Once your selection is made, the appropriate RGBColor command will appear in your text, right where you left the text cursor. Now you can ENTER the command to see the graph with the color you selected.

Note: If you have defined a function, such as fun[x], then you can easily plot the derivative function using the prime notation fun'[x].  ENTER the following commands:

Clear[fun,x]
fun[x_] := Sin[x]*Sin[3*x]
Plot[ fun'[x], {x,0,10} ]

If we give exactly the same command, using D instead of the prime symbol,  Mathematica  is unable to understand us.  ENTER the following commands:

Clear[f,x]
f[x_] := Sin[x]*Sin[3*x]
Plot[ D[ f[x], x], {x,0,10} ]

Mathematica  fails here because it gets confused between the two roles of the x variable: it is both a symbolic variable of differentiation, and a variable to be assigned values during plotting.   This is just one of the ways in which Mathematica  will sometimes seem like it is trying to drive you crazy!

Exercise. Plot both sin(x) and cos(x) from x=-Pi to x=Pi on one graph, using two colors of your choice.

Plot[{Sin[x],Cos[x]},{x,-Pi,Pi},PlotStyle->
  {RGBColor[0.364, 0.329, 0.946],
  RGBColor[0.942, 0.628, 0.333]}]

Tables

Many times we will  want to print out a table of the numerical values of some formula.  To do this in Mathematica  requires two commands, one to set up the table, and one to print it out in a tabular form.  Let's go straight to a specific example.  ENTER the following commands, which set up a table of the squares of the first 10 integers:

Clear[i]

Table[ i^2, {i, 1, 10}]

The Table command sets up the data, but doesn't print it out very nicely.  We'll see how to do that in a minute.  For the moment, let's just concentrate on the command.

The first quantity,  i^2, is the quantity to be printed on each line.

The second quantity, a list in curly brackets specifies the name of the index variable which will be increased with each new line of the table, and the values that variable will have on the first and last lines of the table.  In our example, the variable i will start out at 1 on the first line, and end up with a value of 10 on the last line.

Normally, we put a semicolon at the end of the Table command, and give its output a name  or simply use %.  This hides the ugly output of the Table command, and makes it possible to use the TableForm command to print a nice table.  ENTER the next commands and compare the output to that of the previous commands:

Clear[i, squares]

squares = Table[ i^2, {i, 1, 10}];

TableForm[squares, TableHeadings->{ None, 
                     {"Square"} } ]

Note that we could have also ENTERed:

Clear[i, squares]
Table[ i^2, {i, 1, 10}];
TableForm[%, TableHeadings->{ None, 
                     {"Square"} } ]

The TableForm command seems rather complicated.   The easiest way to use it is simply to copy an existing TableForm command and then modify it appropriately.

The important things to note are that the first item in the command is the name of the output of the Table command, squares (or %).  Then, under the TableHeadings command,   there is a list of the headings to use for each row and column of the table.  In this case the "None" refers to the fact that we don't want a heading for each row; for the column we have chosen the heading Square.

There can be any number of quantities printed on each line of the table; simply replace the single quantity in the Table command by a list in curly braces, and add more headings to the TableForm command.

Since we didn't say differently, the variable i will increase by 1 for each new line of the table.  If we want the table variable to increase by a different value, we simply include that increase (usually called the "increment") as the fourth item in the second set of brackets.

In this next example, we print two quantities instead of one (the integer and its square) and we make i increase by 2 for each line.  Note that we have used a list for the values to be printed on each line (i and i^2) as well as the headings for the two columns.  ENTER the commands:

Clear[i, squares]

squares = Table[ {i, i^2}, {i, -10, 10, 2}];

TableForm[squares, TableHeadings->{ None, 
                     {"Number", "Square"} } ]

The increment counter does not even have to be a whole number.

Thus, if we want to print out the sine and cosine of x, for x going from 0 to 3 by increments of 0.25, we would ENTER the following commands: :

Clear[ sctable, x]

sctable = Table[ {x, Sin[x], Cos[x]}, {x, 0, 3, 0.25} ];

TableForm[sctable, TableHeadings->{ None, 
                     {"X", "Sine(X)", "Cosine(X)"} } ]

Exercise:  Define the function f(x)=x^2+6x+7.  Set up and print a table of x, f(x), and the derivative f'(x), for x going from -7 to 1 in increments of 0.5; label the columns in your table.  (Hint:  use the prime command f'[x] for the derivative, not D[f[x],x] in this situation.)

Clear[f,x]
f[x_]:=x^2+6*x+7
Table[{x,f[x],f'[x]},{x,-7,1,0.5}];
TableForm[%,TableHeadings->{None,{"x","f(x)","f'(x)"}}]

Solving Equations

Mathematica  provides a command for solving equations called Solve.  The Solve command has the form:
  Solve[ equation, variable]
The equation must not use a single equal sign, but a double equal sign, like "==".

To find all the roots of the quadratic equation x^2+6x-7=0, ENTER the following command:

Solve[ x^2+6x-7==0, x]

If we have defined a function, we can  use that function in the Solve command.  In this next example, we define a function f[x], but then we actually look for a zero of the derivative, f'[x]; that is, we want to find the value of x for which f'(x)=0.  ENTER the following commands:

Clear[ f, x]
f[x_] := x^2 + 6*x -7
Solve[ f'[x] == 0, x]

Exercise: Find the three roots of the cubic equation  x^3 + 2x^2 - 11x - 12 = 0.

Clear[ f, x]
f[x_] := x^3+2*x^2-11*x-12
Solve[ f[x] == 0, x]

Exercise: Use the Solve command to find where the graphs of y=3x+3 and y=x^2-3x-4  cross.  You can verify your answer using the Plot command.

Clear[ f,g, x]
f[x_] := 3*x+3
g[x_]:=x^2-3*x-4
Solve[ f[x]==g[x], x]
Plot[{f[x],g[x]},{x,-3,10}]

There are many equations that Solve can't handle.   To see what happens in such a case, ENTER the command:

Solve[Cos[x]==x, x]

We will later see commands called NSolve and FindRoot that can help us in such a case.

Text

Mathematica  consists of two parts, the front-end, which accepts your input and displays results, and the kernel, which does the mathematical calculations. The front-end "sees" everything you type, and decides what to pass on to the kernel.  Mathematica  will assume, by default, that anything you type is a formula, which it will try to evaluate as soon as you type Enter or Shift Return. 

However, Mathematica  allows you to write any sort of messages or text  next to your formulas, to explain what you are trying to do, or to discuss the results.  To enter text, you must properly distinguish it from the usual command input.

First, you must set up a special "text cell" to contain the text.   Find a free spot where your new cell can go, place the cursor there and click.  Then, before typing anything in your new cell, go to the Style menu, choose the Cell Style submenu, and click on the Text format.  

Now anything you type within this cell will be considered text.  By the way, don't use Enter or Shift Return while typing text!  You can use Return by itself, but even that's not necessary, since Mathematica will automatically adjust your text to fit the screen.

Under the Style menu, you can also go to the Face submenu, to make the next words you type bold or italic.  There are other menus for text color, size, and so on.

You can create headings for your text by going to the Style menu, choosing the Cell Style submenu, and clicking on the Title, Subtitle, Section or Subsection format.

Once you have typed text, you can change its style.  First click at the beginning of the text, hold down the mouse button, sweep to the end of the text and let go.  This "selects" the text.  Then go to the Style menu and make your new choice.

Exercise.  Use the Style menu to dramatize the title and subtitle of the following text.  Put the telegraphic message in italics, and the names of various ships in bold.

Titanic sinks!
Hundreds feared missing.

The mighty ship Titanic has apparently sunk in the North Atlantic, off the coast of Newfoundland.  "We have struck an iceberg and are taking on water," was the last recorded telegraphic message from the ship.  Within hours, the ships Carnot and Leibniz were steaming towards the Titanic's position.

Getting Help

One way to get a quick reminder of how a command works is to type the name of the command, preceded by a question mark.  For instance, to see the general way of using the Solve command, ENTER the following command:

?Solve

A useful introduction to Mathematica can be found by going to the HELP menu, and choosing the item "Getting Started".

If you forget the name of a Mathematica command or can't get it to work properly, or want to learn how to do new things with it, you can go to the HELP menu and choose the "OPEN FUNCTION BROWSER" option.  The browser gives you a series of topics, such as "Mathematical Functions" and "Graphics and Sound".  You would choose the last one to find out more about the Plot function, for instance.

There is also a special Mathematica notebook, written especially for this class, called COMMANDS, which contains a list of useful commands, with examples.  This notebook is available on the same area as the regular lab notebooks for this class.

Problems to be handed in

The following exercises should be copied to a separate file, solved, printed out and turned in.  To make your copy, first select the text of the problems, go to the Edit menu, and choose "Copy".  Then go to the File menu and choose "New" to start a new file.  Then go to the Edit menu and select "Paste" to copy the selected lines into the new file.  Now go to the File menu and select "Save As..." to save your new file (and give it a name).  Give it a name like "lab1_answers".  

You may close the original lab file, or keep it open for reference.  After you have worked on your file for five or ten minutes, you should use the "Save" command to update the permanent version of your problem file; otherwise, all your work can easily be lost!

You can delete your mistakes from the problem file, but please retain your commands and the exact  Mathematica  output that answers the questions posed.  You should also enter any text that is appropriate to explain your answer, or to raise questions for your instructor (such as "Why didn't this command work?" or "What do these error messages mean?").

Math 166
Computer Lab #1
Name:_ _ _ _ _ _ _ _ _ _
Instructor:_ _ _ _ _ _ _ _ _

1.  Consider the function f(x) = x^3 -3x^2 -9x +22.

(a) Define the function f in Mathematica.  (Remember to use the Clear command for safety!)

(b) Use the Plot command to graph f(x) for -5 æ x æ 5.

(c) Use the Solve command to find the exact points where the graph crosses the x axis, and check this information with your plot.

(d) Use a Mathematica  command to compute the first derivative of this function.

(e) Use a Mathematica  command to find where this first derivative is zero.

(f) Plot f(x) and f'(x) on the same graph; label your plot.

2.  Consider the function f(x) = x^3 -3x^2 -9x +22.

(a) Define the function f in Mathematica.

(b) Using Mathematica  commands, determine the second derivative of this function. (Hint: the use of % may simplify your input here.)

(c) Using Mathematica  commands, integrate the second derivative two times.

(d) Explain why you do or do not get back the original function f.

3. The population of a particular herd of deer can be modeled by the function p(t)=4000+500 sin(2ºt-º/2) where t is measured in years.

(a) Make a table of values of 
  (i) t, 
  (ii) the  day of the year  corresponding to t   (i.e., the i-th day of the year assuming 365 days in year), 
  (iii) p(t), and 
  (iv) p'(t) for t=0 to 1 in increments of 0.05. Label the columns in your table.  (Hint: you may have to use the N command!)

(b) From your table answer the following questions:
    (i) On what day of the year is the population a maximum? In what month is this?
    (ii)  On what day is the population a minimum?
    (iii) On what day is the population growing the fastest?
    (iv)  On what day is the population decreasing the fastest?

(c) Plot the function p(t) for one year; label your axes and the plot.

4. When studying the definite integral, one learned that if f(x) Ñ 0 for a æ x æ b then Üab f(x) dx represents the area below the curve f(x) and above the x-axis.

(a.)  Let f(x)=ln x for x > 0; we want to determine the area under the curve ln x from x=1 to x=c.  Make a table of (i) c and (ii) the area under the curve f(x) from x=1 to x=c where c ranges from 1 to 5 in increments of 0.25.  Label your columns in your table.

(b.)  At different altitudes in the earth's atmosphere, sound travels at different speeds.  The speed of sound s(x) in meters per second can be modeled by

             -4x+341        0    æ x æ 11.5
              295           11.5 æ x æ 22
  s(x) =     (3/4)x+278.5  22   æ x æ 32
             (3/2)x+254.5   32   æ x æ 50 
            
where x is the altitude in kilometers.  
          
Plot s(x) for 0æ x æ50.  (Hint: use the Show command.)

(c)  We have also found that the average value that a function f(x) has over the interval [a,b] is found by computing 1/(b-a) Üab f(x) dx.  For the data in part (b), find the average speed of sound over the interval [0,50].