HP Prime & TI36X Pro:  Part II - cubic curve analysis

Introduction

This module shows methods for analyzing a cubic function f(x) for extremes, slopes, inflection points, derivatives and definite integrals.  It is based on the cubic regression model from part I:

I show these methods using both the HP Prime and the TI36X Pro (a non CAS, non graphing) calculator.  I did this to show myself the differences in using the two devices.  As you might expect, the HP Prime has some more capabilities than the TI36X, however the TI36X was to me a bit easier to use without making operator errors.  

Help

If you are still getting familiar with the HP Prime or the TI-36x Pro, take some time to familiarize yourself with the units basic functions and in particular:

  • HP Prime:  Stats 2Var App, Function App, CAS, CAS variables, solve() and int() commands
  • TI36X:  data, stat-reg. table, poly-solv, sto→  and 2nd (integral) commands

HP Prime Graphing Calculator

** Before proceeding:  I am assuming you have completed part I curve-fitting and still have the x,y data and the cubic f(x) regression model  saved.  If not, run a cubic regression on:

xdata:  0.5-5.0 in 0.5 steps (10pt)

ydata: 0.6, 0.5, 1.4, 3.5, 4.5, 6.4, 7.4, 7.4, 6.9, 6.0


Using the cubic model (from Part I), find:

(a)   x,y coordinates for any extremum for the model f(x) over the x range {0.5,5.0}

(b)  the first derivative of the model with respect to x

(c.)  x,y coordinates for the maximum slope for the model in this range

(d)  The area under the model between the extremum


(a)   x,y coordinates for any extremum for the model f(x) over the x range {0.5,5.0}

One way to do this is to copy/paste the model (from Part I) into F1(X) in the Function App Symb view.  

Pressing Plot displays the F1(X) function.

Pressing Menu  Fcn 4Extremum will find the nearest extrema as shown.

There are two extrema located  at (0.53,.39) and (4.04,7.65).  

Another, interesting way to find the extrema and plot them is to use the EXTREMUM() command[1].  After loading in the cubic equation F1(X) above, you can use the EXTREMUM() command (Toolbox Fucntion 1EXTREMUM)  in Home or CAS to find the x and y coordinates (0.54,.39) and (4.04,7.66).  The 0.5 and 5.0 are initial guesses.

To see these extrema plotted with F1(X), enter the following into F2(X) in Symb view

Plot will show the following.  Note the “changeover point” at x=~2.3.  This will show up later when looking for max slope.  I believe at this point the Primes search routine considers the local extrema to be equidistant in the x direction.


(b)  the first derivative of the model with respect to x

HP Prime can help you find the derivative of f(x) if we first store the model into f(x).  Remembering that we saved the model into F1(X) before plotting, we can now save it into f(x) in the CAS screen.  

  • Type in f(x):=F1(x) , using lower case xs then Enter.
  • Check by typing f(x)  Enter to see the function
  • To find the derivative, type in f’(x)  Enter 

The first derivative, f’(x) = -1.01x^2 +4.62x -2.18

We could have also found the extrema for f(x) using a third method -  by setting f’(x)=0 and solving for  the x(s) or roots.  In CAS, typing solve(f’(x))  Enter yields the roots.  Substituting these back into f(x) generates the y values as shown.  

The extrema are (.53,.39), (4.04,7.65)


(c.)  x,y coordinates for the maximum slope for the f(x) model in this range

We should first check a plot of the curve  f’(x) between 0.5 and 5.  Open the Function app then return to the CAS screen -puts you in the “Function app”.  We can now save f’(x) into F2 by typing F2:=f’.  Pressing Plot gives f(x) and f’(x)

On inspection, f’(x) (red plot) appears to have one extreme between x=2 to 3.  As before, pressing Fcn 4extremum finds one at (2.29, 3.11).  So, the maximum slope is +3.11 at x=2.29.  To find the x,y coordinates, you could move the cursor directly up to the blue f(x) curve and read x,y as (2.29, 3.99).[2]

Another quick way to solve this is to set the second derivative,  f’’(x)=0 and solve for x.  In CAS, as above, solve(f”(x)) then plugging these into f’(x) and f(x) will calculate the x value, slope and y values as shown.

To see where we are now graphically, save f’’(x) into F3 by typing F3:=f’’.  Pressing Plot gives f(X), f’(X) and f”(X).

We can also take advantage of the SLOPE() command, like we did with EXTREMUM() in part a above.  Try setting F2(X) as SLOPE(F1) then Plot.  You should have a graph similar to above.


(d)  The area under the model f(x) between the extremum

The extremum were at x = {.53 and 4.04}.  The area or definite integral of f(x) can be computed graphically or with CAS.

Graphically, press Plot and select the F1(X) curve.  Press Fcn  SignedArea to enter the lower/upper x values  {.53 and 4.04}.  

Press Plot will show the shaded area with Signed area: 14.08 sq units.

Again, App related functions make this easy as well.  Entering F3(X):  AREA(F1,0.53,X) as shown then plotting gives a plot of the definate integral from lower limit (0.53) to X.  At X=4.04, F4(4.04) = 14.09 sq units.

 -------------

In CAS this can be done using a definite integral.  Typing int(f(x),x,0.53,4.04) or using the math template yields 14.08 as shown.  

To be fancy, you can also save the antiderivative into F4 and plot it along with the other curves.  A way[3] to do this in CAS is:

  • int(f(x),x) to create the antiderivative
  • g(x):= copy/paste the antiderivative here
  • F4:=g  stores g in F4

Here then are the four curves - f(X), f’(X) , f”(X) and int(f(x))

The values for int(f(x))  are 14.4 and 0.3 at 4.04 and 0.53 respectively, or a difference of ~14.1 square units.

TI-36X Pro Calculator

** Before proceeding:  I am assuming you have completed part I curve-fitting and still have the x,y data and the cubic f(x) regression  model saved. If not, run a cubic regression on:

xdata:  0.5-5.0 in 0.5 steps (10pt)

ydata: 0.6, 0.5, 1.4, 3.5, 4.5, 6.4, 7.4, 7.4, 6.9, 6.0


Using the cubic model (from Part I) , find:

(a)   x,y coordinates for any extremum for the model f(x) over the x range {0.5,5.0}

(b)  the first derivative of the model with respect to x

(c.)  x,y coordinates for the maximum slope for the model in this range

(d)  The area under the model between the extremum


(a)   x,y coordinates for any extremum for the model f(x) over the x range {0.5,5.0}

One method to approximately find the extrema is to use table 2:EditFunction with the f(x) saved.  In this case, set steps = 0.1.  A careful inspection shows a maximum somewhere between x=3.9 and 4.1

(x,  f(x)): (3.9, 7.619), (4.0, 7.651), (4.1, 7.649)

I am not sure precisely where this extremum is located or if there are more than one in the range {0.5 to 5.0}.  The next method precisely determines both f’(x) and the x,y extremum coordinates.


(b)  the first derivative of the model with respect to x

Another way to find the extremes for f(x) are to find the first derivative of f(x), set this = 0 and solve for x root(s).  I need to do the differentiation by “hand” but the calculator can help keep things precise and useful in later calculations.  

I know that f’(x) is roughly

f’(x) = (3)(-.33)x^2 +(2)(2.31)x -  2.18               or more precisely

f’(x) = (3)(a)x^2 +(2)(b)x - c

where a, b and c are saved coefficients from the f(x) model.  

I can now change a, b and c as shown:

a*3 sto→ a     -1.009324009

b*2 sto→ b     4.620979021

c can stay as 1*c

The precise equation is now f’(x) = ax^2+bx^2+c where a,b and c coefficients were just calculated for f’ and stored.

Coordinates of the extremum:

To solve for x we can use poly-solv on the f’(x) equation above with the temporarily changed coefficients:

poly-solve  1:ax^2+bx+c  check coefficients then SOLVE

Output:  x1=0.535…   x2=4.0437…  which are the two roots of f’(x)

Scroll down and store x1: z and store x2: t  for later use

QuadEQ-->f(x):  YES

Scroll  down then QUIT

To find the y coordinates of f(x) for these roots, first, rerun the cubic regression[4] 

stat-reg   6:cubic…   RegEQ-->f(x) YES  CALC to recalculate a-d.  

Then f(x) values can be computed with

table  1:f(   Enter.  Select z for f(z) which gives 0.386...

highlight f(z) Enter and change to f(t) which gives 7.655...

This results in the two f(x) extrema:  (0.535,0.386) and (4.044,7.655)


(c.)  x,y coordinates for the maximum slope for the model in this range

A way to scan the range of slopes or f’(x) in the 0.5-5 range is to use the table command with a formula edited to = f’(x).  

table 2:EditFunction  and edit the function as f’(x) =   3*ax^2+2*bx^1+c  Now, with step = 0.1, CALC provides f’(x) values.  

A maximum near (2.3, 3.11) seems to be the approximate x,y coordinates for the maximum slope.

A way to calculate the precise coordinates are to set f”(x) = 0 and solve for x.  By hand, f’’(x) = (3)(2)a*x +(2)(1)b, where a, b are saved f(x) coefficients (-.34..., 2.31...).  By algebra, 0 = 6ax +2b ⇒ x = -2b / 6a.

Enter -2*b/(6*a) on the stack[5]  which yields 2.2891… This is close to the 2.3 estimate above.  Return to table  1:f(  then paste in f(2.2891…) which gives 3.107…or the max slope.  

To determine f(2.2891…), rerun the regression,

stat-reg   6:cubic…   RegEQ-->f(x) YES  CALC  then

table  1:f(   Enter.  and then paste in f(2.2891…) which gives 4.0203...  

Putting it together, there is a maximum slope of +3.107 at (2.289, 4.020)


(d)  The area under the model between the extremum

This can be pretty straightforward to calculate if you have certain formulas and variables already saved.  

You may already have the f(x) formula somewhere on the stack.  If so, great but if not, type a*x^3+b*x^2+c*x+d   Enter to create one.

Check that you have the proper variables save using 2nd recall:

z = 0.53…, t = 4.04…, a = -0.33…, b = 2.31…, c = -2.18… and d = 0.94...

If you don't have the above, you may need to rerun the regression with stat-reg  6:cubic which will save a-d.  z and t were saved extremum from part (b) above.

Now, using 2nd  brings up the integral .  Use z, t as the lower/upper limits.  highlight the f(x) equation on the stack for the expression then Enter to execute.

Output:  14.11 sq units.



[1] HP Prime:  The App based commands, like Extremum(), Slope(), Area() offer handy shortcuts and often allow for enhanced graphing.

[2] HP Prime:  If you are familiar with f’(x) being a quadratic, you may guess that its extreme is the midpoint between its roots.  (0.53+4.04)/2 = 2.28

[3] HP Prime:  The AREA() command seems to be easier to use......

[4] TI36X:  This calculates the coefficients for f’(x) regression before using in the table command.

[5] TI36X:  Use the (-) key for -2, not the - (minus) key… 15 minutes of my life wasted...