Sunday, July 24, 2022

HP Prime: Curve Fitting to Approximate the Zeta Function

HP Prime:  Curve Fitting to Approximate the Zeta Function


Introduction



Here are three approximations for the zeta functions for the positive real numbers x.  For the test data, I used the interval 2 ≤ x ≤ 12.   


For the even integers, exact values are given, otherwise decimal approximations are given.


2,  ζ(2) = π^2 / 6

3,  ζ(3) ≈ 1.202056903

4,  ζ(4) = π^4 / 90

5,  ζ(5) ≈ 1.036927755

6,  ζ(6) = π^6 / 945

7,  ζ(7) ≈ 1.008349277

8,  ζ(8) = π^8 / 9450

9,  ζ(9) ≈ 1.002008392

10,  ζ(10) = π^10 / 93555

11,  ζ(11) ≈ 1.000494189

12,  ζ(12) = 691 * π^12 / 638512875


For x → ∞, ζ → 1


Here are results from three curve fits.  I have tried to include curve fits of at least 10^-2.


Inverse Regression:  Y = A / X + B


Y = 1.42232589936/X+0.81893671619


Average Absolute Error:  5.49240669397ᴇ−2





Logistic Regression:  Y = A / (1 - B * (e^(C * X))


Y = 1.00164385688/(1-2.09727867903*e^(-0.839946048322*X))


Average Absolute Error:  1.41745186091ᴇ−3





Custom Regression:  Y = A + B / X + C X + D X^2


Y = -0.269041227527+(3.20690850188/X)+0.163810293025*X-6.77810226165ᴇ−3*X^2


Average Absolute Error:  1.05418780589ᴇ−2


HP Prime Program:


EXPORT zetamatrix()

BEGIN

LOCAL R,C;

M1:=MAKEMAT(1,11,4);

M2:=MAKEMAT(approx(CAS.Zeta(I+1)),11,1);

FOR R FROM 1 TO 11 DO

M1(R,2):=approx(1/(R+1));

M1(R,3):=approx(R+1);

M1(R,4):=approx((R+1)^2);

END;


END;





Coming up:  Python Week:  August 1 to August 5, 2022

Next Post:  August 2, 2022


Eddie


All original content copyright, © 2011-2022.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


TI 84 Plus CE: Consolidated Debts

TI 84 Plus CE: Consolidated Debts   Disclaimer: This blog is for informational and academic purposes only. Financial decisions are your ...