HP Forums
(42S) Chebyshev Polynomial - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (42S) Chebyshev Polynomial (/thread-8641.html)



(42S) Chebyshev Polynomial - Eddie W. Shore - 07-07-2017 05:11 AM

The trigonometric definition is used to calculate T_n(x):

For |x| > 1, cosh (n * acosh x)
For |x| ≤ 1, cos (n * acos x)
Code:

00 {42-Byte Prgm}
01 LBL “CHEBY”
02 “N”
03 PROMPT
04 STO 00
05 “X”
06 PROMPT
07 STO 01
08 ABS
09 1
10 X≥Y?
11 GTO 00
12 RCL 01
13 ACOSH
14 RCL* 00
15 COSH
16 GTO 01
17 LBL 00
18 RCL 01
19 ACOS
20 RCL* 00
21 COS
22 LBL 01
23 END

Examples:

T_4(2) (n = 4, x = 2). Result: 97

T_4(0.5) (n = 4, x = 0.5) Result: -0.5