You are on page 1of 6

# hp calculators

## HP 40gs Finding the symbolic derivative of a function

The Computer Algebra System

Symbolic Differentiation

Practice using the DERIV command

Practice obtaining partial derivatives

hp calculators

HP 40gs Finding the symbolic derivative of a function

The Computer Algebra System

The HP 40gs contains a computer algebra system (CAS) that is able to solve a wide range of problems. To access the CAS, make
sure the HP 40gs is in the home view by pressing the Tkey. When in the home view, the display will look similar to the one shown
below.

Figure 1

Press !CAS to start the CAS. The screen will now appear as shown below.

Figure 2

Symbolic differentiation

There are three basic differentiation commands DERIV, DERVX and d/dx. The command DERIV takes two arguments: the
expression to be differentiated and the variable with respect to which we want to differentiate. DERVX is provided as a shorter way to
perform differentiation when the variable of differentiation is X. d/dx allows for a more general differentiation of a given expression,
including nested expressions as shown in an example below. The CAS differentiation commands are shown in Figure 3 below.

Figure 3

Practice using the DERIV command

Example 1: Find the symbolic derivative of sin(x) with respect to the variable x.

Solution: Press T, then press the menu key labeled !CAS to select the Computer Algebra System. Press the menu key labeled
!DIFF to select the list of differentiation and integration commands. The DERIV command is highlighted as in Figure 3,
so there is no need to use the W or X keys to move to it, just press the !#OK# menu key to copy the command to the
display. The display will look like Figure 4, with two fields separated by a comma, to tell you that two inputs are
needed, the function to differentiate, and the variable to differentiate with respect to.

Figure 4

Enter the function to be differentiated by pressing the keys:
hp calculators - 2 - HP 40gs Finding the symbolic derivative of a function

hp calculators

HP 40gs Finding the symbolic derivative of a function

FD

Move to the second field and enter the variable to be differentiated with respect to by pressing the keys:

YD

To perform the differentiation, press and the calculator will display the symbolic result COS(x), as shown in
Figure 5:

Figure 5

Answer: The differential of the function sin(x) with respect to x is cos(x), a well-known result.

Note that the command DERVX can be used instead of DERIV, if the variable is the CAS independent variable. DERVX requires
only the function or expression to be differentiated, but not the name of a variable.

Practice obtaining partial derivatives

Example 2: Obtain the partial derivative of the expression y cos(x+y) with respect to the variable y.

Solution: Press T, then press the menu key labeled !CAS to select the Computer Algebra System. Instead of selecting DERIV
or DERVX, just press the C key. To enter the expression to be differentiated, press the keys:

!2Y!2GD+!2

The D key is a shortcut for entering the variable X, but the letter Y used in this example had to be entered using
ALPHA. The display should now show the differential expression as in Figure 6.

Figure 6

It can be interesting to see how the differentiation proceeds, a step at a time. To see this, set step-by-step mode.
Setting modes is described in detail in the module on Understanding CAS modes. To set step-by-step mode, press
@ to select the CAS MODES display. Use the W X Y and Z buttons to highlight Step/Step, and press the
CHK menu key to check this item, as in Figure 7 below. Then press the !#OK# menu key to complete the action and

Figure 7

hp calculators - 3 - HP 40gs Finding the symbolic derivative of a function

hp calculators

HP 40gs Finding the symbolic derivative of a function

Press to see the first step of the differentiation, as shown in Figure 8.

Figure 8

Press again to see the second step, which gives the final result of the differentiation, as shown in Figure 9.

Figure 9

Answer: The partial derivative of y sin(x+y) with respect to y is cos(x+y) y sin(x+y).

Use the CAS modes menu again to clear step by step mode.

Example 3: Find the derivative of the function X
2
SIN(X) using the DERVX command

Solution: T !CAS
!DIFFX`DK*FD

Figure 10

`

Example 4: Find the derivative of the function X
2
SIN(X) using the d/dx command. Notice how this command works through the
derivative one step at a time.

Solution: T !CAS
CDYDK*FD

hp calculators - 4 - HP 40gs Finding the symbolic derivative of a function

hp calculators

HP 40gs Finding the symbolic derivative of a function

Figure 12

`

Figure 13

`

Example 5: Find the derivative of the function shown below, illustrating the use of the COLLECT function.

Solution: T !CAS
C!yYCDYDK*!yKW/D*!y

Figure 15

`

Figure 16

```
hp calculators - 5 - HP 40gs Finding the symbolic derivative of a function

hp calculators

HP 40gs Finding the symbolic derivative of a function