Linear Equations in Two Variables, Version A

Kenneth Levasseur
Mathematical Sciences
UMass Lowell
Kenneth_Levasseur@uml.edu

This is the first of a series of notebooks that will develop a single function in various ways.

Given certain kinds of data, you can determine the equation of a line.  Let's create a function that takes a slope, m,  and a point, P, and generates the equation of the line with slope m that passes through P.

The "slope -point formula" might be familiar to you.

EquationOfLine[m_,{s_,t_}]:=Simplify[(y-t)==m(x-s)];

If you've evaluated the cell above, the following cell should simply repeat the definition.  First you are told that EquationOfLine is a global name (it's context is Global`) - more on this later.

?EquationOfLine

Tests

Testing your function is important.  You should try to "break it" by trying to think of inputs that other users might try.

EquationOfLine[2,{1,-3}]

EquationOfLine[Pi,{Sqrt[2],-3}]

EquationOfLine[N[Pi],{N[Sqrt[2]],-3.0}]

EquationOfLine[0,{1,5}]

Does it work for symbolic input?  It appears to work fine.  Here are a few examples

EquationOfLine[m,{0,0}]

EquationOfLine[-1,{c,-c}]

We'll come back to this function in a couple of weeks.