Saturday, May 19, 2018

Calculus/TI-84 Plus CE: Derivatives of kth Order


Calculus/TI-84 Plus CE:  Derivatives of Kth Order

Introduction

Can we find a general formula for a derivative of nth order?

d^n/dx^n f(x) = ?

The Power Function x^n

From calculus, we find that:

f(x) = x^n

d/dx x^n = n * x^(n - 1)

d^2/dx^2 x^n = n * (n – 1) * x^(n – 2)

d^3/dx^3 x^n = n * (n – 1) * (n – 2) * x^(n – 3)

d^4/dx^4 x^n = n * (n – 1) * (n – 2) * (n – 3) * x^(n – 4)

Note that for order k,

d^k/dx^k x^n = (n * (n – 1) * (n – 2) * (n – 3) * … * (n – (k – 1)) ) * x^(n – k)

d^k/dx^k x^n = (n * (n-1) * (n-2) * … * 1)/((n-k) * (n-k-1) * … * 1) * x^(n – k)

d^k/dx^k x^n = n! / (n – k)! * x^(n – k)

With the gamma function property Γ(z + 1) = z!,

d^k/dx^k x^n = Γ(n + 1)/Γ(n – k + 1) * x^(n – k)

The above formula allows us to calculate the kth derivative of x^n, even when k is not an integer. 

TI-84 Plus CE Program NDERPOW

"2018-05-18 EWS"
Disp "D^K/DX^K X^N"
Input "POWER (N):",N
Input "VALUE    :",A
Input "ORDER (K):",K
If N≥K
Then
N!/(N-K)!*A^(N-K)→D
Else
0→D
End
Disp D

The program NDERPOW calculates the numerical derivative of d^k/dx^k x^n.  For this particular program, k must be an integer since non-integers are not accepted on the TI-84 Plus’ factorial function. 

The Exponential Function e^(a*x), where a is a constant

f(x) = e^(a*x)

d/dx e^(a*x) = a * e^(a*x)

d^2/dx^2 e^(a*x) = a^2 * e^(a*x)

d^3/dx^3 e^(a*x) = a^3 * e^(a*x)

d^4/dx^4 e^(a*x) = a^4 * e^(a*x)

With the order k…

d^k/dx^k e^(a*x) = a^k * e^(a*x)

Just like the last case, k does not have be an integer. 

TI-84 Plus CE Program NDEREXP

"2015-05-18 EWS"
Disp "D^K/DX^K e^(A*X)"
Input "COEFF (A):",A
Input "VALUE    :",X
Input "ORDER (K):",K
A^K*e^(A*X)→D
Disp D

The program NDEREXP calculates the numerical derivative of d^k/dx^k e^(a*x).

The Sine Function sin(a*x) and the Cosine Function cos(a*x)

We are working radian angle measure.

f(x) = sin(a*x)

d/dx sin(a*x) = a * cos(a*x)

d^2/dx^2 sin(a*x) = -a^2 * sin(a*x)

d^3/dx^3 sin(a*x) = -a^3 * cos(a*x)

d^4/dx^4 sin(a*x) = a^4 * sin(a*x)

Notice a pattern, alternating between sin and cos.  To the kth order (k is an integer),

d^k/dx^k sin(a*x) =

(-1)^int(k/2) * a^k * cos(a*x), when k is odd

(-1)^int(k/2) * a^k * sin(a*x), when k is even

If we put the piecewise function into one statement:

d^k/dx^k sin(a*x) = (-1)^int(k/2) * a^k * ( 2*frac(k/2)*cos(a*x) + 2*frac((k+1)/2)*sin(a*x) )

Note that:

2 * frac(k/2) = 1 for all odd integers k, 0 for all even integers k

Likewise, 2 * frac((k + 1)/2) = 0 for all odd integers k, 1 for all even integers k

And, (-1)^int(k/2) produces a pattern of 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, …

TI-84 Plus CE Program NDERSIN

"2018-05-19 EWS"
Disp "D^K/DX^K sin(A*X)"
Radian
Input "COEFF (A):",A
Input "VALUE    :",X
Input "ORDER (K):",K
(­1)^iPart(K/2)*A^K*(2*fPart(K/2)*cos(A*X)+2*fPart((K+1)/2)*sin(A*X))→D
Disp D

Similarly,

f(x) = cos(a*x)

d/dx cos(a*x) = -a * sin(a*x)

d^2/dx^2 cos(a*x) = -a^2 * cos(a*x)

d^3/dx^3 cos(a*x) = a^3 * sin(a*x)

d^4/dx^4 cos(a*x) = a^4 * cos(a*x)

Likewise:

Notice a pattern, alternating between sin and cos.  To the kth order (k is an integer),

d^k/dx^k sin(a*x) =

(-1)^int(k/2 + 1/2) * a^k * sin(a*x), when k is odd

(-1)^int(k/2 + 1/2) * a^k * cos(a*x), when k is even

If we put the piecewise function into one statement:

d^k/dx^k cos(a*x) = (-1)^int(k/2 + 1/2) * a^k * ( 2*frac(k/2)*sin(a*x) + 2*frac((k+1)/2)*cos(a*x) )

TI-84 Plus CE Program NDERCOS

"2018-05-19 EWS"
Disp "D^K/DX^K cos(A*X)"
Radian
Input "COEFF (A):",A
Input "VALUE    :",X
Input "ORDER (K):",K
(­1)^iPart((K+1)/2)*A^K*(2*fPart(K/2)*sin(A*X)+2*fPart((K+1)/2)*cos(A*X))→D
Disp D

NDERSIN and NDERCOS are numeric derivatives for sine and cosine, respectively.  Note for NDERSIN and NDERCOS, the calculator is set to Radian mode, and K (order) should be an integer. 

Eddie

All original content copyright, © 2011-2018.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.  Please contact the author if you have questions.

TI 84 Plus CE: Consolidated Debts

TI 84 Plus CE: Consolidated Debts   Disclaimer: This blog is for informational and academic purposes only. Financial decisions are your ...