Graph of a Polynomial

Polynomials are power equations of the type most often written in the form of………

aX↑b + cX↑d + eX↑f + .. +g = 0

where a, c, e, and f are usually small whole, positive or negative numbers, and b, d, f, etc are interger exponents arranged in descending order of power.

Most often some one value, or several values, of X satisfies this relationship. Which is to say that such value of X, when substituted into the polynomial makes its overall value equal to the zero on the right hand side of the equal mark. These values of X are known as roots of the equation, or simply roots, and they can be rational or irrational numbers. Irrational numbers, you may recall, are those which cannot be expressed precisely. Some well-known examples are….

PI = 3.1415927.......
 e = 2.7182818.......

If equated to Y instead of 0, equations of this type can be plotted on coordinated X- and Y-axes paper, but the method is usually tedious for any equation over the second power, one where the first exponent, b, is greater than two. One of the purposes of plotting such an equation is to determine the points where the curve crosses, or touches, the X-axis. Such points, where the value of X makes Y = 0, are roots of the equation.

There may be as many real roots to a polynomial as represented by the power of the first term in X. Thus an equation of the second power can have two real roots, but it may also have none. An equation of the third power may have three real roots or one. It will not have less. An equation of the fourth power may have four, two, or no real roots. All of this depends upon the value of the last term of the equation. Its value can raise or lower the entire curve with respect to the coordinate axes,providing the other terms remain unchanged.

Algebra offers several methods of solving these equations. A few can be factored, and the like, but many of them can be solved (roughly) only by plotting and tedious trial and error calculations. Here is where the Timex shines. It can crunch numbers and speed them thru numerous and repetitious calculations. We will start by having the computer plot the significant part of the curve for us.

Program G-11 was devised to plot the curve of any power equation. Normally the TS2068 plots using pixels as though the lower left corner of the screen is the origin, the Y-axis the left edge, and the X-axis the bottom edge. Thus the normal Timex screen is the first quadrant. Hence we must first center the axes. In our case we arbitrarily moved the X-axis up by 86 pixels and the Y-axis to the right by 130 pixels. The values mentioned are incorporated into lines 20 and 140 of the program G-11.

Next there is a matter of scale. Power equations can develop very large positive or negative values of Y for relatively small values of X. For this reason vertical and horizontal scale factors are required. These are entered into the program in lines 100 and 110, as V and H. The corresponding scale markings on the graph appear in lines 70 and 80. The relationship between factor and scale marking is……

V - Factor    Y Scale Mark

    .2            200
    .4            100
    .8             50
   1.0             40
   2.0             20
   4.0             10
   8.0              5
  20.0              2

H - Factor    X Scale Mark

   5.0             20
  10.0             10
  20.0              5

For starters, use the combination of factor and scale mark, starting with the top-most pair. If the resulting curve is too pinched or compressed, select a combination further down the table. Line 135 prevents those annoying out-of-range error reports.

Note that the program lines subject to change with each new equation have been emphasized by having their command words in inverse lettering. Do not enter a new line by eradicating the old one. Bring the old one down and change it, leaving the inverse lettering intact.

Figure 1 shows the basic program, G-11, built around the equation…..

Y = 16X↑3 + 16X↑2 + 3X

Notice that its curve shows three real roots. If the equation had an additional constant term of say +1, the whole curve would move up with respect to the axes and it would have only one real root.

5 REM ** "G-11", 7-18-89, WF
10 REM ** GRAPH of a POWER EQUATION
20 PLOT 0,86: DRAW 0,-86: DRAW 255,0: DRAW 0,86: DRAW -255,0: DRAW 0,89: DRAW 255,0: DRAW 0,-89: PLOT 130,0: DRAW 0,175
40 FOR n=26 TO 146 STEP 20: PLOT 129,n: PLOT 131,n: NEXT n
50 FOR n=30 TO 230 STEP 20: PLOT n,87: PLOT n,85: NEXT n
60 PRINT AT 1,1;"GRAPH of.. Y";AT 12,30;"X"
70 PRINT AT 6,17;"+2";AT 16,17;"-2"
80 PRINT AT 9,2;"-5";AT 10,28;"+5"
100 LET V=20
110 LET H=20
120 FOR x=-1 TO 1 STEP .01
130 LET y=16*x*x*x+15*x*x+3*x
135 IF ABS (y*V)>85 THEN GO TO 150
140 PLOT x*H+130,y*V+86
150 NEXT x
200 PRINT AT 3,1;"Y = 16X↑3 + 16X↑2 +3X"
Figure 1 - graph of Y = 16X↑3 + 16X↑2 +3X
Figure 1 – graph of Y = 16X↑3 + 16X↑2 +3X

Program G-11A, Figure 2, shows the graph of a different equation…..

Y = 2X↑3 + 11X↑2 -31X - 180

This one has three real roots which happen to be x = -5, -4.5, and +4. They don’t usually come out in such nice little, rational numbers. The first two roots become apparent when the area from X = -6 to X = -4 is expanded by using a vertical factor of V = 4. See Figure 4, for a blow-up of this area, so treated. Figure 3 makes the curve look tangent to the axis. Its scale is too small.

G-11B, Figure 3, shows the same basic program with a fourth power equation……

Y = 6X↑4 + 5X↑3 -5X↑2 - 5X -1

The graph of this curve shows that it has four real roots. If the last term is changed from -1 to +3, all of the four real roots disappear. Make this substitution and observe the resulting curve.

Here are a few more polynomials of this variety to play around with……

Y = X↑2 - X - 5
Y = X↑4 - 13X↑2 + 35
Y = X↑3 - 4X↑2 - 2X + 7
Y = X↑3 - 4X↑2 - 2X - 3

Save this paper for future reference. Programs to evaluate these roots, with a high degree of precision, will be the subject of a future tutorial.

Warren Fricke

5 REM ** "G-11A", 7-18-89, WF
10 REM ** GRAPH of a POWER EQUATION
20 PLOT 0,86: DRAW 0,-86: DRAW 255,0: DRAW 0,86: DRAW -255,0: DRAW 0,89: DRAW 255,0: DRAW 0,-89: PLOT 130,0: DRAW 0,175
40 FOR n=26 TO 146 STEP 20: PLOT 129,n: PLOT 131,n: NEXT n
50 FOR n=30 TO 230 STEP 20: PLOT n,87: PLOT n,85: NEXT n
60 PRINT AT 1,1;"GRAPH of.. Y";AT 12,30;"X"
70 PRINT AT 6,17;"+100";AT 16,17;"-100": REM ** Y-SCALE
80 PRINT AT 9,2;"-10";AT 10,28;"+10": REM ** X-SCALE
100 LET V=.4
110 LET H=10
120 FOR x=-10 TO 10 STEP .1
130 LET y=2*x*x*x+11*x*x-31*x-180
135 IF ABS (y*V)>85 THEN GO TO 150
140 PLOT x*H+130,y*V+86
150 NEXT x
200 PRINT AT 3,1;"Y = 2X↑3 + 11X↑2 - 31X - 180"
5 REM ** "G-11B", 7-18-89, WF
10 REM ** GRAPH of a POWER EQUATION
20 PLOT 0,86: DRAW 0,-86: DRAW 255,0: DRAW 0,86: DRAW -255,0: DRAW 0,89: DRAW 255,0: DRAW 0,-89: PLOT 130,0: DRAW 0,175
40 FOR n=26 TO 146 STEP 20: PLOT 129,n: PLOT 131,n: NEXT n
50 FOR n=30 TO 230 STEP 20: PLOT n,87: PLOT n,85: NEXT n
60 PRINT AT 1,1;"GRAPH of.. Y";AT 12,30;"X"
70 PRINT AT 6,17;"+2";AT 16,17;"-2": REM ** Y-SCALE
80 PRINT AT 9,2;"-5";AT 10,28;"+5": REM ** X-SCALE
100 LET V=20
110 LET H=20
120 FOR x=-2 TO 2 STEP .01
130 LET y=6*x*x*x*x+5*x*x*x-5*x*x-5*x-1
135 IF ABS (y*V)>85 THEN GO TO 150
140 PLOT x*H+130,y*V+86
150 NEXT x
200 PRINT AT 3,1;"Y = 6X↑4 + 5X↑3 - 5X↑2 - 5X -1"
Figure 2 - graph of Y = 2X↑3 + 11X↑2 - 31X - 180
Figure 2 – graph of Y = 2X↑3 + 11X↑2 – 31X – 180
Figure 3 - graph of Y = 6X↑4 + 5X↑3 - 5X↑2 - 5X -1
Figure 3 – graph of Y = 6X↑4 + 5X↑3 – 5X↑2 – 5X -1
Figure 4 - partial graph of Y = 2X↑3 + 11X↑2 - 31X - 180 (expanded)
Figure 4 – partial graph of Y = 2X↑3 + 11X↑2 – 31X – 180 (expanded)

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.