Linear Equations in Two Variables, Version D

Kenneth M. Levasseur
Department of Mathematical Sciences
University of Massachusetts Lowell
Lowell, MA 01854
Kenneth_Levasseur@uml.edu

Loading the LinearEquations Package

You won't find a definition of EquationOfLine in this notebook.  At this stage it's been put into a package simply called LinearEquations.nb.  You should open this notebook in order to look at it after reading this notebook.  The hyperlink in this cell should work if you've placed the package into the AddOns/Applications directory of your Mathematica directory.

This is the best way to load a package.  Needs will check the current value of Contexts[] and if the arguement isn't already listed, the appropriete package is loaded.

Needs["LinearEquations`"]

If you're unfamiliar with a package you've just loaded, one way to start learning about it is to look at the names of the functions that are defined within it.  Naturally, you would expect extensive documentation for large packages, and that is normally what you will find.  This small package has no documentation.

?LinearEquations`*

You can see from the list of names that in addition to EquationOfLine, there are a few other functions that one would expect to be related to linear equations.  It's easy to see what an individual function does.

?XIntercept

This is where the usage statments are crucial.  They provide this documentation.  Let's try this function

XIntercept[y==5x-3]

Documentation isn't adequate if users get confused.  If you thought the following would work, it's my fault.

XIntercept[5x-3]

Tests

At each stage of development, you should continue to test your functions.

EquationOfLine[5,-1]

EquationOfLine[5,-1,PlotLine->True]

You should be able to provide the default and things should still work.

EquationOfLine[-5.7,104.8,PlotLine->False]

Undefined option values should revert to the default

eq=EquationOfLine[-π,4,PlotLine->Maybe]

{XIntercept[eq],YIntercept[eq]}

There was a problem with some equations with real constants not simplifying very well.  StandardFormOfLine will take care of that.

?StandardFormOfLine

StandardFormOfLine[eq]

StandardFormOfLine[y+2.457==3.45 x +3.5]

There had been a problem with not being able to reset the default of PlotLine.  Now it works.  The solution is described in LinearEquations.nb

SetOptions[EquationOfLine,PlotLine->True]

EquationOfLine[{3,5},{6,-1}]

I can actively suppress the plot now.

EquationOfLine[{3,5},{6,-1},PlotLine->False]

SetOptions[EquationOfLine,PlotLine->False]

Horizontal Line Tests

heq=EquationOfLine[{2,5},{6,5}]

XIntercept[heq]

YIntercept[heq]

StandardFormOfLine[heq]

EquationOfLine[{1,5},{2,5},PlotLine->True]

Limitations

There are still three I didn't fix.  I wouldn't be surprised if there are more.

Vertical Lines

Still not fixed.  The equation is ok, but the plot doesn't get done.

EquationOfLine[{1,5},{1,-3},PlotLine->True]

Symbolic input

This can also be fixed with slightly more advanced programming

EquationOfLine[m,{7,0},PlotLine->True]

Range of plot is rigid

The range of the plot isn't adaptive and so the line might not appear in the graph.  This was my choice initially  and could be fixed, possibly with another option

EquationOfLine[1,100,PlotLine->True]

The Package

You should now jump to the package LinearEquations.nb.