Graphing in 1D and 2D

Graphing Package

1.	RationalGraph
	2.	Graph2D
	3.	Graph1D

Designed for educational applications: Calculus, Precalculus, etc.

Nonpolynomial Functions: Rational Functions, Piecewise Defined Functions, Certain Trigonometric Functions, Functions with Singularities
	1.	Create Graphs as They Appear in Math Textbooks	
	2.	Reduce Confusion
	3.	Improve Learning about Graphing Functions with Singularities

Distinguish Between Plotting and Graphing

▲	Plot are continuous

▲	Graphs use auxiliary graphics (Standard Math Conventions):
		1.	Small Empty Circles
		2.	Small Filled Circles
		3.	Dashed Vertical Asymptotes
		4.	Dashed Polynomial Asymptote with RationalGraph

Examples of Graphing Versus Plotting Singular Functions

Plot of a built-in function with a discontinuity

Plot[Sign[x - 1], {x, -5, 5}, 
        PlotStyle -> Red];

Graph of the above built-in functions

Graph2D[Sign[x - 1], {1}, {x, -5, 5}, 
        PlotStyle -> Red];

Another Plot of a Function With a Discontinuity

Plot[Abs[Sign[x - 1]], {x, -5, 5}, 
        PlotStyle -> Red];

Graph Indicating the Need for Specifying the Discontinuity

Graph2D[Abs[Sign[x - 1]], {1}, {x, -5, 5}, 
        PlotStyle -> Red];

Plot of a Function With a Hole in its Domain

Plot[(E^(-(1/(x - 1)))), {x, -5, 3}, 
        PlotStyle -> Red, PlotRange -> {-1, 5}];

Graph of a Function With a Hole in its Domain

Graph2D[(E^(-(1/(x - 1)))), {1}, {x, -5, 3}, 
        PlotStyle -> Red, PlotRange -> {-1, 5}];

RationalGraph: Graphing Ratios of Polynomials

No need to specify singularities (breaks in the graph at the real zeros of the denominator, where rational functions are not defined) in this case

?RationalGraph

Use PolynomialQuotient[p,q,x] to plot the asymptotic behavior

Programming Consideration: Assign attribute HoldFirst to RationalGraph

Graph of a Rational Function With Holes at x = -1 and x = 10 and a horizontal asymptote

RationalGraph[((1 - 6 x + (x^2)) (x + 1) (x - 
                  10))/((-9 + 7 x - 8 (x^2) + (x^3)) (x + 
                  1) (x - 10)), {x, -15, 15}, 
        PlotStyle -> Red];

Graph of a Rational Function With Holes at x = -1 and x = 2 and a cubic asymptote

RationalGraph[((2  (x^9) - 3  (x^7) + 15  x - 17) (x + 
                  1) (x - 2))/(((x^6) - 2  (x^3) + 1) (x + 
                  1) (x - 2)), {x, -3, 3}, 
        PlotRange -> {-40, 50}, PlotStyle -> Red];

Graph2D: Graphing Functions With Singularities

?Graph2D

Programming Considerations: Turn off certain messages since we want to capture limits that evaluate to ComplexInfinity, ∞, -∞, and Indeterminate.  Biggest problem: Calculating Limits

Graph of a Piecewise Defined Function

f[x_] := 
        If[x < 1, (1/(1 - x)), If[x > 1, x + 2, -3]];

Graph2D[f[x], {1}, {x, -5, 5}, PlotRange -> {-5, 16}, 
        PlotStyle -> Red];

Required Workarounds

Limit[f[x], x -> 1, Direction -> +1]

oneZero[x_, x0_]:=If[x < x0, 1, 0];

Limit[oneZero[x, 1]*f[x], x -> 1, Direction -> 1]

Limit[f[x], x -> 1, Direction -> -1]

zeroOne[x_, x0_] := If[x < x0, 0, 1];

Limit[zeroOne[x, 1]*f[x], x -> 1, 
      Direction -> -1]

Graph of a the Greatest Integer Function (7 steps, no compositions) versus Plot of Floor

gif[
          x_] := 
If[-4 ≤ 
            x < -3, -4, 
          If[-3 ≤ x < -2, -3, 
            If[-2 ≤ x < -1, -2, 
              If[-1 ≤ x < 0, -1, 
                If[0 ≤ x < 1, 0, 
                  If[1 ≤ x < 2, 1, 
                    If[2 ≤ x < 3, 2, 
                      3]]]]
]]];

Graph2D[gif[x], Range[-3, 3], {x, -3.5, 3.5}, 
        PlotRange -> {-5, 5}, PlotStyle -> Red];

Plot[Floor[x], {x, -3.5, 3.5}, PlotRange -> {-5, 5}, 
        PlotStyle -> Red];

Graphs of Functions with Holes in their Definition

Graph2D[
        (1/(1 + (E^(-1/x)))), {0}, {x, -20, 20}, 
        PlotStyle -> Red, PlotRange -> {0, 1}];

Graph2D[((E^((1/(x - 1))))/((E^x) - 1)), {0, 1}, {x, -2, 3}, PlotRange -> {-30, 50}, 
        PlotStyle -> Red, 
        VerticalAsymptote -> Thickness[ .007]];

Graph2D[(x^x), {0}, {x, 0, 2}, AxesOrigin -> {0, 0}, 
        PlotRange -> {{- .5, 2}, {- .5, 2}}, 
        PlotStyle -> Red];

Graph2D[(2 
               Csc[x + (π/2)]*(∏_(i = 0)^6)(x - i) (x + 
                      i))/((∏_(i = 0)^6)((x^2) - 
                  (i^2))), {{-((3  π)/2), -(π/2), -6, -5, -4, -3, -2, -1, 1, 2, 3, 4, 5, 
            6, (π/2), ((3  π)/2)}, {0}}, {x, -2 π, 2  π}, 
        PlotRange -> {-12, 12}];

Graph1D: Graphing One-Dimensional Inequalities

?Graph1D

Graph1D[((x - 1) (x + 2) (x - 3))/((x + 
                    1) (x - 1) (x - 2) (x + 3)) ≤ 
          0, {x, -4, 4}];

Graph1D[(x^2) (Sqrt[(x^2) - 4]) ≥ 0 && 
          x ≠ -4, {x, -6, 6}, 
        PlotStyle -> RGBColor[0, 0, 1]];

Options: Holes, Rims, Plugs

{Hole, Rim, Plug} /. Options[Graph2D]

Recall:

Graph2D[Sign[x - 1], {1}, {x, -5, 5}, 
        PlotStyle -> Red];

Graph2D[Sign[x - 1], {1}, {x, -5, 5}, PlotStyle -> Red, 
        Hole -> AbsolutePointSize[6], Rim -> AbsolutePointSize[8], 
        Plug -> AbsolutePointSize[8]];

Graph2D[Sign[x - 1], {1}, {x, -5, 5}, 
        PlotStyle -> {Red, Thickness[ .006]}, 
        Hole -> {AbsolutePointSize[5], Peacock}, 
        Rim -> {AbsolutePointSize[8], Blue}, 
        Plug -> {AbsolutePointSize[8], Blue}];

Warning Messages, Error Messages, and Diagnostics

Omitting the list of Singularities in Graph2D

Graph2D[Sign[x - 1], {x, -5, 5}]

Value of Singularity Lies Outside Plotting Range: Graph2D

Graph2D[Sign[x - 1], {1}, {x, -5, 5}, 
        PlotRange -> {-2, 1/2}];

Value of Singularity Lies Outside Plotting Interval: Graph1D

Graph1D[(x^2) ((x^2) - 4) ≥ 0, {x, -3, 1}, 
        PlotStyle -> Blue];

Corrected Graphing Interval:

Graph1D[(x^2) ((x^2) - 4) ≥ 0, {x, -3, 3}, 
        PlotStyle -> Blue];