![]() So wen PRNXT finds a root of the deflated polynomial, it then uses that root as the initial guess to PLGRR on the So you can feed PRNXT the return of PR1ST or PRNXT.Ī common question: Why is the original polynomial required by PRNXT, and not just the deflated one? A series of polynomial deflations leads to a deflated PRNXT also returns the original polynomial, the polynomial with the located root removed, and a new This is precisely what the PR1ST function returns. It requires three arguments (original polynomial, deflated polynomial, and a guess). The second function, PRNXT, finds the next root of the polynomial. Output is precisely what is needed to find more roots. When it finds a root, it returns the original polynomial, the polynomial with the located root removed (deflated), and a root. When it fails, I suggest running the function again to see if it will find a root – it uses a random initial Possible for it to fail and return an error. It will almost always find a root however, it is The first function, PR1ST, is used to find an initial root of a polynomial. These functions use the global variable ACC to specify how close to zero the polynomial must be to accept a root. They work on real or complex polynomials, and finds both real and complex roots. These two programs provide a way to find all the roots of a polynomial. The first element of the matrix is the coefficient on the highest RCL "X" STO "X" RTN Edit matrix LBL 96 FUNC 11ĮDIT "Enter data R/S" ├ " to end" PROMPT EXITALL RTN a polynomial of degree XĪ polynomial is represented as 1xn matrix of coefficients. RCL "CPM" STO "CPM" RTN Store/Recall variable "X" LBL 97 FS? 64 Return RCL "_M" RTN (EQCPLY) DSC: Evaluate Chararstic Polynomial of a Matrix: DET(M-X*I) I/O: N/A MVAR program VAR: CPM a square matrix VAR: X a real or complex number LAB: 24-25 FAQ: Can be used FAQ: Dosen't use INDEX UPD: LBL "EQCPLY" MVAR "CPM" MVAR "X" RCL "CPM" RCL "X" RCL "CPM" DIM? R↓ XEQ "MXIDN" × - DET RTN Store/Recall variable "CPM" LBL 98 FS? 64 LBL "MXDIAG" FUNC 11 REQ:free42>=2.5.24 L4STK REQ:free42>=3.0 LSTO "_M" D DIM? n m × Nġ 1 N X=Y? GTO 23 non 1x1 case RCL+ ST Y N+1 N XY N N+1ĭIM "_M" N N+1 - M is now an (N+1)xN matrix with D on first row RCL "_M" M N N+1 TRANS M N N+1 - M is now an Nx(N+1) matrix with D on first column STO "_M" R↓ 1 N+1 N ENTERĭIM "_M" 1 N+1 N - M is now an NxN matrix with D on the diagonal LBL 23 1 N+1 N - due to the resize reshuffle All done. NEWMAT X is an nx1 zero matrix SIGN X is now a constant matrix filled with 1s XEQ "MXDIAG" RTN (MXDIAG) DSC: Create diagonal matrix with given elements IN: X: matrix IN: X: diagonal matrix FAQ: Dosen't use INDEX FAQ: Uses all elements of X - even if it is not 1xn or nx1 UPD: REF: FAQ: This code is longer, but easier to understand - for me anyhow. GTO 28 RCL "_P" +/- RTN (MXTR) DSC: Compute matrix trace (sum of the diagonal elements) IN: X: Matrix OUT: X: trace FAQ: Dosen't use INDEX UPD: TC: ] => 16 LBL "MXTR" FUNC 11 REQ:free42>=2.5.24 L4STK REQ:free42>=3.0 LSTO "_M" M - M is an nxn matrix DIM? n n MĭIM "_M" 1+n n M - M is now an nx(n+1) matrix with original diag in first columnġ 1 1 1+n n M NEWMAT P 1+n n M - P is a 1x1 zero matrix SIGN P 1+n n M - P is a 1x1 identity matrix LSTO "_P" R↓ 1+n n M - P is a 1x1 matrix e_1ġ 1 1+n n - P is a 1x1 matrix e_1 XY 1+n 1 n - P is a 1x1 matrix e_1ĭIM "_P" 1+n 1 - P is now an 1x(1+n) e_1 row matrix RCL "_P" P 1+n 1 RCL "_M" M P 1+n TRANS X P 1+n - X is now an (n+1)xn matrix with original diag in first row × X 1+n 1 - X is now an 1xn matrix with original diag in first row RSUM X 1+n 1 - X is now a 1x1 matrix with the sum of the diag DET TR - DET of a 1x1 matrix is matrix element RTN (MXIDN) DSC: Create an XxX identity matrix IN: X: Size of matrix to make OUT: X: Identity matrix of size X FAQ: Dosen't use INDEX UPD: REF: FAQ: This code is longer, but easier to understand - for me anyhow. ![]() (MXCPLY) DSC: Compute matrix Characteristic polynomial IN: X: Matrix OUT: X: Characteristic polynomial LBL: 28 FAQ: Uses INDEX UPD: TC: ] => LBL "MXCPLY" FUNC 11 REQ:free42>=2.5.24 L4STK REQ:free42>=3.0 LSTO "_A" DIM? XEQ "MXIDN" LSTO "_M" LSTO "_I" R↓Ġ p_ STOEL ISG "_CTR" NOP J+ FC? 77
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |