Post Reply 
Shammas Polynomials, Pade-Shammas Polynomials, Fourier-Shammas Series
09-06-2020, 02:20 PM (This post was last modified: 09-06-2020 06:11 PM by pinkman.)
Post: #6
RE: Shammas Polynomials, Pade-Shammas Polynomials, Fourier-Shammas Series
I like the game of polynomial generation with decimal powers.
I created a Shammas polynomial generator, that can be used in Home view of the HP Prime.

Code:

EXPORT SHAMMASP(AL,FI,VA)
BEGIN
 LOCAL I:=1, S:=AL(1), P, A;
 LOCAL LL := SIZE(AL);
 LOCAL L := LL(1); 
 WHILE I < L DO
  P := EVAL(CAS(subst(FI,VA,I))); 
  A := AL(I+1);
  S := S + A*'X'^P;
  I := I+1; 
 END;

 RETURN S;
END;

Usage:

SHAMMASP(A_coeffs, P_formula, Name_of_var_in_P_formula)
A_coeffs: vector of A coefficients
P_formula: formula for generating powers
Name_of_var_in_P_formula: as said, ie 'I' in '2+2/I'
Return value: generated polynomial

Generates a polynomial using a vector of A0 to An coefficients, and the formula to generate the powers.

Example:
SHAMMASP([1,1,2,3],'(1/I^2)','I')
Result : 1+1*X^1+2*X^0.25+3*X^0.111111111111

You can then use the result with the Function app, or in any calculation.

Example for the arc cosine approximation and the A+B/i form:
F2:=SHAMMASP([1.58,−449.52,34304.79,−471342.72,2249062.47,−4666165.33,4350327.34,−1495738.54],'2+(2/I)','I')
F1:='ACOS(X)'

   
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Shammas Polynomials, Pade-Shammas Polynomials, Fourier-Shammas Series - pinkman - 09-06-2020 02:20 PM



User(s) browsing this thread: 1 Guest(s)