(15C) Nth Degree Polynomial Program
|
12-03-2019, 01:42 AM
(This post was last modified: 12-15-2022 02:55 AM by Gene.)
Post: #1
|
|||
|
|||
(15C) Nth Degree Polynomial Program
Hello all, this program calculates a y value for any degree polynomial (between 1 and 56 theoretically, or more with a memory expansion) given an x value and matrix A containing the coefficients of the expression. This is useful for using the SOLVE and ∫yx functions, and for using Linear regression to plot secant lines. The program uses Horner's Method, which is outlined on pg. 79 of the latest 15c manual. Unfortunately, this program completely obliterates the stack so don't put anything important in there!
If you're keying this program in manually; be mindful of the USER mode instructions. A handy trick for keying the program in at some location other than 000 is to add however many R/S instructions is necessary to make the line number a multiple of 10, making it much easier to compare line numbers and ensure accurate entry. Once finished (leave them in until after a test run) you may optionally execute GTO A in run mode followed by a BST in program mode to easily position the cursor on the extraneous instructions for removal. Usage
Code:
if you're using this 15c emulator and a DM15, you can simply copy this code as-is into a .15c file and upload it. Hope you enjoy!! |
|||
12-03-2019, 06:08 AM
Post: #2
|
|||
|
|||
RE: 15C Nth Degree Polynomial Program
15-lennyphelan
Can you provide some example from this program? Thank You Gamo |
|||
12-03-2019, 09:51 PM
(This post was last modified: 12-03-2020 02:05 AM by 15-lennyphelan.)
Post: #3
|
|||
|
|||
RE: 15C Nth Degree Polynomial Program
(12-03-2019 06:08 AM)Gamo Wrote: 15-lennyphelan No problem. Suppose I have the function f(x)=16x^5-4x^4+8x^2-4x-9 and I want to find ∫f(x)dx from 1 to 7 The coefficients of this polynomial in order of descending significance are 16, -4, 0, 8, -4, and -9 (notice there are six of them) I'm going to put the calc in user mode, execute f MATRIX 1, and dimension matrix A to 1x6 with 1, ENTER, 6, f DIM A, then load the coefficients into the matrix by typing 16 STO A, 4 CHS STO A, ... so on. As you're storing the constant term, the calc should display [A 1,6] as you're holding the button. Then I simply type 1, ENTER, 7, f ∫yx A. Sit back and relax for a minute. Mathematica tells me the answer is 301045.2, and with exact precision, so does my 15c! |
|||
11-06-2022, 02:15 PM
(This post was last modified: 11-06-2022 03:10 PM by Thomas Klemm.)
Post: #4
|
|||
|
|||
RE: 15C Nth Degree Polynomial Program
We don't have to use a separate counter.
The RCL user A skips the next command once the end of the matrix is reached. Make sure to set user mode while entering the program: Code: 001 - 42,21,11 LBL A Both SOLVE and \(\int_y^x\) fill the stack before calling the function. If the function is used otherwise add an ENTER command right after LBL A to fill the stack. For those using Torsten's HP-15C simulator: Code: 000 { } |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)