Tuesday, May 24, 2011

Polynomial Derivative and Integral for HP 35S

This program calculates the coefficients of the derivative and the integral of a polynomial. The maximum degree of the polynomial can be is seven.

The variables of the polynomial are:

H x^7 + G x^6 + F x^5 + E x^4 + D x^3 + C x^2 + B x + A

Instructions:

1. Load the Polynomial. Press XEQ P001, enter the degree of the polynomial and load the coefficients from the highest degree to the constant.

2. Operation. To find the derivative, press XEQ P033. For an indefinite integral, press XEQ P083.

Program



' Start of program
' Messages in quotes can be typed by pressing the EQN key. Each letter is typed as so: RCL letter .
' To set/clear flag 10 press Gold Shift FLAGS. 1 for Set, 2 for Clear. "Type" 10 by pressing the decimal point followed by the zero.

P001 LBL P
P002 SF 10
P003 "DEGREE"
P004 PSE
P005 CF 10
P006 INPUT N
P007 1
P008 +
P009 STO M
P010 SF 10
P011 "X^"
P012 PSE
P013 RCL M
P014 1
P015 -
P016 PSE
P017 1
P018 +
P019 +/-
P020 STO I
P021 "COEF"
P022 PSE
P023 CF 10
P024 RCL(I)
P025 STOP

' STOP is entered by pressing R/S

P026 STO(I)
P027 DSE M
P028 GTO P010
P029 SF 10
P030 "DONE"
P031 CF 10
P032 RTN



' Derivative Routine

P033 1
P034 RCL+ N
P035 STO M

' Calculate the coefficients

P036 RCL M
P037 +/-
P038 STO I
P039 +/-
P040 -1
P041 RCL+ M
P042 STOx(I)
P043 DSE M
P044 GTO P036

' Shift the coefficients to the appropriate slots

P045 2
P046 1
P047 RCL+ N
P048 1000
P049 ÷
P050 +
P051 STO M

P052 RCL M
P053 IP
P054 +/-
P055 STO I
P056 RCL(I)
P057 1
P058 STO+ I
P059 R↓
P060 STO(I)
P061 ISG M
P062 GTO P052

P063 RCL N
P064 +/-
P065 1
P066 -
P067 STO I
P068 0
P069 STO(I)

' Display Routine

P070 RCL N
P071 STO M

P072 RCL M
P073 +/-
P074 STO I
P075 VIEW(I)
P076 DSE M
P077 GTO P072

P078 SF 10
P079 "DONE"
P080 PSE
P081 CF 10
P082 RTN



' Integral Routine

' Calculate the coefficients

P083 1
P084 RCL +N
P085 STO M

P086 RCL M
P087 +/-
P088 STO I
P089 +/-
P090 1/x
P091 STOx(I)
P092 DSE M
P093 GTO P086

' Shift the coefficients into the proper place
' The constant term is assigned 0 (technically, it is an arbitrary constant)

P094 1
P095 RCL+ N
P096 STO M

P097 RCL M
P098 +/-
P099 STO I
P100 1
P101 -
P102 RCL(I)
P103 x<>y
P104 STO I
P105 x<>y
P106 STO(I)
P107 DSE M
P108 GTO P097

P109 0
P110 STO A

' Display Routine

P111 RCL N
P112 2
P113 +
P114 STO M

P115 RCL M
P116 +/-
P117 STO I
P118 VIEW(I)
P119 DSE M
P120 GTO P115

P121 SF 10
P122 "DONE"
P123 PSE
P124 CF 10
P125 RTN

' End of Program

Memory: LN=433



Example

Find the derivative and integral of f(x) = x^3 - 2x^2 + 1

Derivative:
1. XEQ P001
2. Enter 3 at DEGREE prompt, then press R/S
3. "X^3" : 1, R/S
4. "X^2" : -2, R/S
5. "X^1" : 0, R/S
6. "X^0" : 1, R/S
7. XEQ P033. Press R/S after each coefficient.

Then f'(x) = 3x^2 - 4x

For the integral:
1. XEQ P001
2. Enter 3 at DEGREE prompt, then press R/S
3. "X^3" : 1, R/S
4. "X^2" : -2, R/S
5. "X^1" : 0, R/S
6. "X^0" : 1, R/S
7. Press XEQ P083.

Then the integral is .25x^4 - .6666666667x^3 + x

Recall that the variables of the polynomial are:

H x^7 + G x^6 + F x^5 + E x^4 + D x^3 + C x^2 + B x + A


  Casio fx-7000G vs Casio fx-CG 50: A Comparison of Generating Statistical Graphs Today’s blog entry is a comparison of how a hist...