Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Evaluate an infinite sum using the Weniger transformation
ResourceFunction["WenigerSum"][f,{i,imin,∞}] numerically evaluates the sum using the Weniger transformation. |
"ExtraTerms" | 15 | number of terms to use in the Weniger transform |
"Terms" | 15 | number of terms to sum directly |
"Type" | Automatic | the type of Weniger transformation to use |
WorkingPrecision | MachinePrecision | the precision used in internal computations |
"T" | t-transformation, gn=Sn-Sn-1 |
"U" | u-transformation, gn=(n+1)(Sn-Sn-1) |
"V" | v-transformation, gn=-(Sn+1-Sn)(Sn-Sn-1)/(Sn+1-2Sn+Sn-1) |
"D" | d-transformation, gn=Sn+1-Sn |
Evaluate the alternating harmonic series:
In[1]:= |
|
Out[1]= |
|
Compare with the closed form:
In[2]:= |
|
Out[2]= |
|
Use 25 terms for the Weniger transformation:
In[3]:= |
|
Out[3]= |
|
Compare with the exact result:
In[4]:= |
|
Out[4]= |
|
Set "Terms" to 0 so that all terms are used in extrapolation:
In[5]:= |
|
Out[5]= |
|
Compare with the exact result:
In[6]:= |
|
Out[6]= |
|
Directly sum the first 25 terms before applying the Weniger transformation:
In[7]:= |
|
Out[7]= |
|
Compare with the exact result:
In[8]:= |
|
Out[8]= |
|
Show the results of the different Weniger transformations on an alternating series:
In[9]:= |
|
Out[9]= |
|
Show the results of the different Weniger transformations on a non-alternating series:
In[10]:= |
|
Out[10]= |
|
Use a higher setting of WorkingPrecision:
In[11]:= |
|
Out[11]= |
|
Compare with the exact result:
In[12]:= |
|
Out[12]= |
|
Use the Weniger d-transform to evaluate the Dirichlet eta function:
In[13]:= |
|
Compare with the built-in DirichletEta:
In[14]:= |
|
Out[14]= |
|
Plot the relative error:
In[15]:= |
|
Out[15]= |
|
Use the Weniger v-transform with NIntegrate to numerically evaluate an oscillatory integral:
In[16]:= |
|
In[17]:= |
|
Out[17]= |
|
Compare with the exact result:
In[18]:= |
|
Out[18]= |
|
Directly summing the first few terms of a series usually does not give sufficient accuracy:
In[19]:= |
|
Out[19]= |
|
In[20]:= |
|
Out[20]= |
|
Using the Weniger transform on a series often gives better results:
In[21]:= |
|
Out[21]= |
|
In[22]:= |
|
Out[22]= |
|
WenigerSum may give finite results for formally divergent series:
In[23]:= |
|
Out[23]= |
|
Compare with the exact result:
In[24]:= |
|
Out[24]= |
|
Numerically evaluate a formally divergent oscillatory integral:
In[25]:= |
|
Out[25]= |
|
Compare with the exact answer:
In[26]:= |
|
Out[26]= |
|
In[27]:= |
|
Out[27]= |
|
This work is licensed under a Creative Commons Attribution 4.0 International License