(*^
::[ Information =
"This is a Mathematica Notebook file. It contains ASCII text, and can be
transferred by email, ftp, or other text-file transfer utility. It should
be read or edited using a copy of Mathematica or MathReader. If you
received this as email, use your mail application or copy/paste to save
everything from the line containing (*^ down to the line containing ^*)
into a plain text file. On some systems you may have to give the file a
name ending with ".ma" to allow Mathematica to recognize it as a Notebook.
The line below identifies what version of Mathematica created this file,
but it can be opened using any other version as well.";
FrontEndVersion = "Macintosh Mathematica Notebook Front End Version 2.2";
MacintoshStandardFontEncoding;
fontset = title, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M18, O486, bold, L3, r58981, g58981, b58981, e8, 24, "New York";
fontset = subtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M18, O486, bold, L2, r58981, g58981, b58981, e6, 18, "CalcAndMath";
fontset = subsubtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M18, O486, bold, L2, r58981, g58981, b58981, e6, 14, "New York";
fontset = section, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, grayBox, M18, O486, bold, L2, a10, 14, "CalcMath";
fontset = subsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, blackBox, M18, O486, bold, L2, a10, 12, "CalcMath";
fontset = subsubsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, whiteBox, M18, O486, bold, L2, a10, 12, "CalcMath";
fontset = text, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M18, O486, L2, 12, "CalcMath";
fontset = smalltext, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M18, O486, B65535, L2, 12, "CalcAndMath";
fontset = input, noPageBreakInGroup, preserveAspect, groupLikeInput, M36, N23, O486, bold, L2, 12, "Courier";
fontset = output, output, inactive, noPageBreakInGroup, preserveAspect, groupLikeOutput, M36, N23, O486, L2, 12, "Courier";
fontset = message, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M18, N23, O486, R65535, L2, 12, "Courier";
fontset = print, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M18, N23, O486, L2, 12, "Courier";
fontset = info, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M18, N23, O486, L2, 12, "Courier";
fontset = postscript, PostScript, formatAsPostScript, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeGraphics, M18, O486, l34, w282, h287, L2, 12, "Courier";
fontset = name, inactive, nowordwrap, nohscroll, noKeepOnOnePage, preserveAspect, M18, O486, italic, B65535, L2, 10, "Geneva";
fontset = header, inactive, noKeepOnOnePage, preserveAspect, M18, O486, L2, 10, "Times";
fontset = leftheader, inactive, L2, 12, "Times";
fontset = footer, inactive, noKeepOnOnePage, preserveAspect, center, M18, O486, L2, 12, "Times";
fontset = leftfooter, inactive, L2, 12, "Times";
fontset = help, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M18, O486, L2, 10, "Geneva";
fontset = clipboard, inactive, noKeepOnOnePage, preserveAspect, M18, O486, L2, 12, "New York";
fontset = completions, inactive, nowordwrap, noKeepOnOnePage, preserveAspect, M18, O486, L2, 12, "New York";
fontset = special1, inactive, nowordwrap, noKeepOnOnePage, preserveAspect, M18, O486, L2, 12, "New York";
fontset = special2, inactive, nowordwrap, noKeepOnOnePage, preserveAspect, center, M18, O486, L2, 12, "New York";
fontset = special3, inactive, nowordwrap, noKeepOnOnePage, preserveAspect, right, M18, O486, L2, 12, "New York";
fontset = special4, inactive, noKeepOnOnePage, preserveAspect, M18, O486, bold, superscript, R21845, G21845, B21845, L2, 12, "C&M";
fontset = special5, inactive, noKeepOnOnePage, preserveAspect, M18, O486, bold, superscript, R19708, G31200, B40959, L2, 12, "C&M";
paletteColors = 128; currentKernel;
]
:[font = section; inactive; dontPreserveAspect]
Name: Don Anglen
:[font = section; inactive; dontPreserveAspect]
Title: Slope Intercept
:[font = section; inactive; noPageBreak; dontPreserveAspect]
Description: This lesson solves and graphs linear equations, explains the slope-intercept form of a line, and explains some Mathematica language.
;[s]
3:0,0;125,1;136,0;148,-1;
2:2,16,11,Courier,1,14,0,0,0;1,16,11,Courier,3,14,0,0,0;
:[font = title; inactive; pageBreak; dontPreserveAspect]
Slope Intercept
:[font = text; inactive; dontPreserveAspect]
The slope-intercept equation of a line is y = mx + b.
The "m" is the slope of the line, and the "b" is the ordinate of the point where the line crosses the "y" axis. We will use the line y = 2x + 3, where m=2 and b=3 as the line we will use most frequently until we change the parameters "m" and "b" to work similar problems. This is text style: no operations will perform.
:[font = input; dontPreserveAspect]
This is input style: operations will occur.
:[font = text; inactive; dontPreserveAspect]
The ] on the right side are called "cells". Each cell is used for different parts of the output or problem.
:[font = input; dontPreserveAspect; startGroup]
Clear[b,m,x,f]
f[x_] = m x + b
m=2;
b=3;
Solve[f[x]==0,x]
:[font = output; output; inactive; dontPreserveAspect]
{{x -> -3/2}}
;[o]
3
{{x -> -(-)}}
2
:[font = text; inactive; dontPreserveAspect; endGroup]
When "m" is multiplied by "x" in Mathematica, a space implies the multiplication. The "==" symbol is the Mathematica operation for "=".
:[font = text; inactive; pageBreak; dontPreserveAspect]
Add this step to graph the linear function; "Plot[f[x],{x,-5,5}]"
:[font = input; dontPreserveAspect]
Plot[f[x],{x,-5,5}]
:[font = text; inactive; dontPreserveAspect]
Notice the solution of the function when f[x] = 0: -(3/2), is where the line crosses the x-axis.
:[font = text; inactive; pageBreak; dontPreserveAspect]
The width of the units on the "x" and "y" axes should be the same. To do that, add this step: "AspectRatio->Automatic".
:[font = input; dontPreserveAspect]
Plot[f[x],{x,-5,5},
AspectRatio->Automatic]
:[font = text; inactive; pageBreak; dontPreserveAspect]
To label the axes, add this step: AxesLabel->{"x","y"}.
:[font = input; dontPreserveAspect]
Plot[f[x],{x,-5,5},
AspectRatio->Automatic,
AxesLabel->{"x","y"}]
:[font = text; inactive; dontPreserveAspect]
The "m", coefficient of "x", is the "slope" of the line. The slope is the steepness of the line. The steeper the line, the larger the absolute value of m. Conversely, the larger the absolute value of m, the steeper the line.
:[font = input; pageBreak; dontPreserveAspect]
Plot[f[x],{x,-5,5},
AspectRatio->Automatic,
AxesLabel->{"x","y"}]
:[font = text; inactive; dontPreserveAspect]
With all the commands together, the program also works by pressing the enter key.
Since the slope "m" is a positive number, the line will go up and to the right.
:[font = text; inactive; pageBreak; dontPreserveAspect]
Now let's graph a line with m = -2.
:[font = input; dontPreserveAspect]
Clear[b,m,x,f]
f[x_] = m x + b
m=-2;
b=3;
Plot[f[x],{x,-5,5},
AspectRatio->Automatic,
AxesLabel->{"x","y"}]
:[font = text; inactive; dontPreserveAspect]
Notice the line rises up and to the left with a negative slope.
:[font = text; inactive; pageBreak; dontPreserveAspect]
To find the ordinate of a point on the line, choose a value for the independent variable x. x=4.
:[font = input; dontPreserveAspect]
2 4 + 3
:[font = text; inactive; dontPreserveAspect]
Substitute 2 in for m, 4 in for x, and 3 in for b in the linear line y = mx + b. The point (4,11) is on the line. In Mathematica the space between the 2 and the 4 tells the computer to multiply. In Mathematica, after the 3, press the enter key and the operation is performed.
:[font = input; dontPreserveAspect]
2 4 + 3
:[font = input; dontPreserveAspect]
N[%]
:[font = text; inactive; dontPreserveAspect]
The symbol (%) repeats the previous operation. The symbol (N) gives the ty the answer as a decimal. The symbol (N) works the problem out to a numerical number in scientific notation, if the answer is > one million.
:[font = text; inactive; dontPreserveAspect]
If x = 4000000, find y in y = mx + b.
:[font = input; dontPreserveAspect]
N[2 4000000 + b]
:[font = text; inactive; dontPreserveAspect]
The answer (8. 10ß) means the number (8) times the number 1000000. 10ß = 1000000. The exponent 6 tells you the number of zeros, or move the decimal point 6 places to the right of the (1). 8 times 1000000 = 8000000.
:[font = text; inactive; dontPreserveAspect]
Place different values in for "m" and "b" to work other problems now and some more difficult problems later.
:[font = text; inactive; pageBreak; dontPreserveAspect]
Find the ordinate of a point whose abscissa is (c + d). Substitute in for (x) in the original linear function (y = mx + b): y = 2(c + d) + 3.
:[font = input; dontPreserveAspect]
Expand[2 ( c + d) + 3]
:[font = text; inactive; dontPreserveAspect]
The point ({c + d},{3 + 2c + 2d}) is on the line
"y = 2x + 3". The Mathematica command (Expand)
multiplies polynomials.
:[font = text; inactive; dontPreserveAspect]
To list 11 points on the line use the command (Table).
:[font = input; dontPreserveAspect; startGroup]
Clear[m]
m=2
Table[{x,N[f[x]]},{x,-5,5}]
:[font = output; output; inactive; dontPreserveAspect; endGroup]
{{-5, -7.}, {-4, -5.}, {-3, -3.}, {-2, -1.}, {-1, 1.},
{0, 3.}, {1, 5.}, {2, 7.}, {3, 9.}, {4, 11.}, {5, 13.}}
;[o]
{{-5, -7.}, {-4, -5.}, {-3, -3.}, {-2, -1.}, {-1, 1.},
{0, 3.}, {1, 5.}, {2, 7.}, {3, 9.}, {4, 11.}, {5, 13.}}
:[font = text; inactive; dontPreserveAspect]
This is sloppy programming, even though it showed the correct answers. A less sloppy program would clear all the variables, and write the function again something like this.
:[font = input; dontPreserveAspect]
Clear[b,f,m,x,y]
f[x_] = m x + b
m=2;
b=3;
Table[{x,N[f[x]]},{x,-5,5}]
:[font = text; inactive; noPageBreak; dontPreserveAspect]
The last time I used the slope "m", I used -2. I cleared "m" to use my original equation y = mx + b, where m = 2 and b = 3. Remember to press the enter key to perform the program.
:[font = text; inactive; pageBreak; dontPreserveAspect]
Now let's find an approximation of the ordinate when the abscissa is an irrational number. The command "N" will do this for us. If x is 2`, what is y? In other words, if a point on the line y = 2x + 3 has an abscissa of 2`, what is the ordinate?
:[font = input; dontPreserveAspect]
N[2 Pi + 3,6]
:[font = input; dontPreserveAspect]
N[2 Pi]
:[font = text; inactive; dontPreserveAspect]
The point (6.28319,9.28319) is on the line.
:[font = text; inactive; dontPreserveAspect]
Substitute in the function f(x)= mx + b or in the equation y = mx + b, m=2, x=2`, b=3 and calculate y. In Mathematica the "6" tells the computer to give the anwser in 6 digits and ` is Pi. Remember to capitalize Pi.
:[font = text; inactive; pageBreak; dontPreserveAspect]
Now let's plot some points. To write the program again, you don't have to type it all in, you can use the copy and paste buttons. With the mouse, highlight the cell by pushing the mouse button and then push the copy button. Move the cursor to the position you want and push the paste button. Delete the Plot command and add the ListPlot command.
:[font = input; noPageBreak; dontPreserveAspect]
Clear[b,m,x,f]
f[x_] = m x + b
m=2;
b=3;
points = Table[N[f[x]],{x,-5,5}];
ListPlot[points,AspectRatio->Automatic,
AxesLabel->{"x","y"}]
:[font = text; inactive; dontPreserveAspect]
The points are a little small, so we will use the Plotstyle and PointSize commands to make them visible.
:[font = input; pageBreak; dontPreserveAspect]
Clear[b,m,x,f]
f[x_] = m x + b
m=2;
b=3;
points=Table[N[f[x]],{x,-5,5}]
ListPlot[points, PlotStyle->PointSize[.2],AspectRatio->Automatic,
AxesLabel->{"x","y"}]
:[font = text; inactive; dontPreserveAspect]
Nice points! Of course, these are a little large, but I thought you might like to see them. We will change the pointsize from .2 to .02.
:[font = input; pageBreak; dontPreserveAspect]
Clear[b,m,x,f]
f[x_] = m x + b
m=2;
b=3;
points=Table[N[f[x]],{x,-5,5}]
ListPlot[points, PlotStyle->PointSize[.02],AspectRatio->Automatic,
AxesLabel->{"x","y"}]
:[font = text; inactive; dontPreserveAspect]
Better.
:[font = text; inactive; pageBreak; dontPreserveAspect]
Mathematica will help explain mistakes in the formatting of your program. After pushing enter, if there is a beep, move the mouse to the open apple at the top.
With the mouse, darken in the "Why the beep", and an explaination appears; something like this.
:[font = input; dontPreserveAspect]
Clear[b,m,x,f]
f[x} = m x + b
m=2;
b=3;
Solve[f[x] == 0,x]
:[font = text; inactive; dontPreserveAspect]
The mistake is the "}" in the second step. The beep will say Mathematica could not understand the expression you tried to evaluate. It left the insertion bar where it got confused. The insertion bar will be before the "=" in the second command. Sometimes the computer will be even more presice in its explaination; something like this.
:[font = input; dontPreserveAspect]
8/0
:[font = text; inactive; dontPreserveAspect]
Mathematica printed that you can't divide by 0!!
:[font = text; inactive; pageBreak; dontPreserveAspect]
Let's use two points to find the equation of a line in the slope-intercept form. Select (4,11),(5,13). The slope m is the change in y divided by the change in x: (13-11)/(5-4).
:[font = input; dontPreserveAspect]
(13-11)/(5-4)
:[font = text; inactive; dontPreserveAspect]
The slope-intercept form of the line: y = mx + b. We found the slope 2. Either given point is on the line, so it will satisfy the equation of the line. To find b, the y-intercept, we can substitute either point in for x and y and solve for b. 11 = 2(4) + b.
:[font = input; dontPreserveAspect]
11-2(4)
:[font = text; inactive; dontPreserveAspect]
Now we have the equation y = mx + b: y = 2x + 3
:[font = input; dontPreserveAspect]
Clear[b,m,x,f]
f[x_] = InterpolatingPolynomial [{{4,11},{5,13}},x]
:[font = text; inactive; dontPreserveAspect]
Mathematica used the command "InterpolatingPolynomial" to find what y equals. y = 2x + 3.
:[font = text; inactive; pageBreak; dontPreserveAspect]
Another important concept in slopes is lines with slopes whose product is -1. Graph the lines
y = 2x + 3 and y = -(1/2)x + 3.
:[font = input; dontPreserveAspect]
Clear[f,g,x]
f[x_]=2 x + 3;
g[x_]=(-1/2) x + 3;
Plot[{f[x],g[x]},{x,-5,5}, AspectRatio->Automatic];
:[font = text; active; dontPreserveAspect]
These lines are perpendicular. Try some more examples.
:[font = text; inactive; pageBreak; dontPreserveAspect]
This project explains slopes of lines, Macintosh procedures, and Mathematica commands.
^*)