Post Reply 
Shammas Polynomials, Pade-Shammas Polynomials, Fourier-Shammas Series
09-05-2020, 01:39 PM
Post: #1
Shammas Polynomials, Pade-Shammas Polynomials, Fourier-Shammas Series
Hi All,

In the HHC2008 I introduced the Shammas Polynomials as ones that have non-integer powers. I used my last name to avoid conflict with other mathematicians who may use the same general name. I posted two articles on my web site. The first one shows how Shammas Polynomials approximate various common functions as well as some special functions. The second article shows how ordinary Pade polynomials approximate common functions.

I am working on other articles like:

1.Pade-Shammas Polynomials that incorporate using Shammas Polynomials in Pade polynomial approximations.

2. the Fourier-Shammas series where I use sequences similar to those in the Shammas Polynomials to create sine and cosine series used to fit common functions.

Click here to access the web page that has these articles.. It's a work in progress and I will add more articles in the next months.
Find all posts by this user
Quote this message in a reply
09-05-2020, 04:18 PM
Post: #2
RE: Shammas Polynomials, Pade-Shammas Polynomials, Fourier-Shammas Series
I did not see the HHC 2008. Interesting, lots of reading, lots of investigating.

Warning: on your site, the link to the code of Shammas Poly. is wrong (.zio instead of .zip)

Thibault - not collector but in love with the few HP models I own - Also musician : http://walruspark.co
Find all posts by this user
Quote this message in a reply
09-05-2020, 05:41 PM
Post: #3
RE: Shammas Polynomials, Pade-Shammas Polynomials, Fourier-Shammas Series
(09-05-2020 04:18 PM)pinkman Wrote:  I did not see the HHC 2008. Interesting, lots of reading, lots of investigating.

Warning: on your site, the link to the code of Shammas Poly. is wrong (.zio instead of .zip)

Link was corrected. Thanks!
Find all posts by this user
Quote this message in a reply
09-05-2020, 08:28 PM
Post: #4
RE: Shammas Polynomials, Pade-Shammas Polynomials, Fourier-Shammas Series
Hi, Namir

Just a suggestion for your reference function, to estimate Ψ(x)

On page 10, your code use: (BTW, your formula had typos, with 2 excess ')')

Ψ(x) = Γ'(x) / Γ(x) ≈ (Γ(x+h) - Γ(x-h))/(2h) / Γ(x)

The problem is Γ(x) have growth rate even faster than e^x
Much more weight is placed to Γ(x+h), and less to Γ(x-h), thus over-estimated Γ'(x).

Instead, we can flatten the curve, and use an equivalent formula (*)

Ψ(x) = (lgamma(x))' ≈ (lgamma(x+h) - lgamma(x-h)) / (2h)

XCas> h := 0.001
XCas> digamma_1(x) := (Gamma(x+h) - Gamma(x-h)) / (2h) / Gamma(x)
XCas> digamma_2(x) := (lgamma(x+h) - lgamma(x-h)) / (2h)
XCas> rel_err(x) := 1 .- [digamma_1(x), digamma_2(x)] ./ Psi(x)

XCas> for(k:=10; k<100; k+=10) {print(k, rel_err(k));}

10, [-8.96829302599e-07, 8.19068590729e-10]
20, [-1.49615930911e-06, 1.45581324773e-10]
30, [-1.92596196058e-06, 5.6931570569e-11]
40, [-2.26519091839e-06, 3.20117266028e-11]
50, [-2.54765957997e-06, 3.02801117513e-11]
60, [-2.79093496314e-06, 2.03200789528e-11]
70, [-3.00534823494e-06, 2.88802315396e-12]
80, [-3.19750830902e-06, 1.85684800869e-12]
90, [-3.37196553724e-06, -4.30255830963e-12]

(*) Googled "matlab lgamma", the equivalent function is named gammaln()
Find all posts by this user
Quote this message in a reply
09-06-2020, 03:05 AM
Post: #5
RE: Shammas Polynomials, Pade-Shammas Polynomials, Fourier-Shammas Series
THanks for your feedback.

:-)

Namir
Find all posts by this user
Quote this message in a reply
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
09-06-2020, 05:10 PM
Post: #7
RE: Shammas Polynomials, Pade-Shammas Polynomials, Fourier-Shammas Series
(09-06-2020 02:20 PM)pinkman Wrote:  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],'2+(2/I)','I')
F1:='ACOS(X)'

From Namir's article, page 30-31, we should have 8 coefficients.
Code:
c := [ 1.58002850493741, -449.524818312817, 34304.7929190518, -471342.719845201,
       2249062.47202831, -4666165.32624902, 4350327.34390859, -1495738.54253386 ]

Again, from the article, F2 have root-mean-square error of 0.0104, or 0.6°
However, F2 is bad when when x ≈ 1. We expected F2(1) = sum(c) ≈ acos(1) = 0

XCas> sum(c)       → 0.075438067317       // or, 4.3° error

XCas> shammasp(coef, f) := coef * extend([1], map(range(1,length(coef)), f))
XCas> f2 := shammasp(c, k -> x^(2+2/k))
XCas> f1 := acos(x)
Find all posts by this user
Quote this message in a reply
09-06-2020, 06:12 PM
Post: #8
RE: Shammas Polynomials, Pade-Shammas Polynomials, Fourier-Shammas Series
Yes I copied the wrong line from the Prime. Message edited, thanks.

Thibault - not collector but in love with the few HP models I own - Also musician : http://walruspark.co
Find all posts by this user
Quote this message in a reply
09-06-2020, 06:37 PM
Post: #9
RE: Shammas Polynomials, Pade-Shammas Polynomials, Fourier-Shammas Series
I appreciate Albert's feedback and corrections. I uploaded the corrected files for the Pade Approximation.

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




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