Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Evaluate the Stieltjes-Jacobi polynomial
| ResourceFunction["StieltjesJacobiE"][n,a,b,x] gives the Stieltjes-Jacobi polynomial  | 
 is the polynomial whose roots are the additional abscissas in Jacobi-Kronrod quadrature, apart from the abscissas that are the roots of the Jacobi polynomial
 is the polynomial whose roots are the additional abscissas in Jacobi-Kronrod quadrature, apart from the abscissas that are the roots of the Jacobi polynomial  .
. is a polynomial of degree n+1.
 is a polynomial of degree n+1.Compute the 2nd Stieltjes-Jacobi polynomial:
| In[1]:= | ![ResourceFunction["StieltjesJacobiE"][2, a, b, z]](https://www.wolframcloud.com/obj/resourcesystem/images/9d3/9d3a68d3-524a-49a1-8296-13dcb7312c01/7244d1850a7b285a.png) | 
| Out[1]= |  | 
Plot  over a subset of the reals:
 over a subset of the reals:
| In[2]:= | ![Plot[ResourceFunction["StieltjesJacobiE"][10, 2, 2, x], {x, -1, 1}]](https://www.wolframcloud.com/obj/resourcesystem/images/9d3/9d3a68d3-524a-49a1-8296-13dcb7312c01/47989ad7b1a0904a.png) | 
| Out[2]= |  | 
Evaluate numerically:
| In[3]:= | ![ResourceFunction["StieltjesJacobiE"][9, 1, 3, 1.5]](https://www.wolframcloud.com/obj/resourcesystem/images/9d3/9d3a68d3-524a-49a1-8296-13dcb7312c01/2dc43c70c295e840.png) | 
| Out[3]= |  | 
Evaluate to high precision:
| In[4]:= | ![N[ResourceFunction["StieltjesJacobiE"][9, 1, 3, 3/2], 30]](https://www.wolframcloud.com/obj/resourcesystem/images/9d3/9d3a68d3-524a-49a1-8296-13dcb7312c01/50bdbf9760c7fa82.png) | 
| Out[4]= |  | 
The precision of the output tracks the precision of the input:
| In[5]:= | ![ResourceFunction[
 "StieltjesJacobiE"][9, 1, 3, 1.5000000000000000000000000000]](https://www.wolframcloud.com/obj/resourcesystem/images/9d3/9d3a68d3-524a-49a1-8296-13dcb7312c01/5e838a4ea9f6c635.png) | 
| Out[5]= |  | 
StieltjesJacobiE threads elementwise over lists:
| In[6]:= | ![ResourceFunction["StieltjesJacobiE"][{1, 2, 3}, 4, 5, z]](https://www.wolframcloud.com/obj/resourcesystem/images/9d3/9d3a68d3-524a-49a1-8296-13dcb7312c01/4988b983d4610699.png) | 
| Out[6]= |  | 
Compute the abscissas and weights of a (2n+1)-point Gauss-Kronrod quadrature:
| In[7]:= | ![n = 7;
a1 = x /. NSolve[LegendreP[n, x] == 0, x, WorkingPrecision -> 25];
a2 = x /. NSolve[ResourceFunction["StieltjesJacobiE"][n, 0, 0, x] == 0, x, WorkingPrecision -> 25];](https://www.wolframcloud.com/obj/resourcesystem/images/9d3/9d3a68d3-524a-49a1-8296-13dcb7312c01/4e5b7a2dc8971d1a.png) | 
| In[8]:= | ![ck = N[(2^(n + 1) n!)/(2 n + 1)!!, 25];
w1 = 4/(n (n + 1) LegendreP[n - 1, a1] JacobiP[n - 1, 1, 1, a1]) + (
   2 ck)/((n + 1) JacobiP[n - 1, 1, 1, a1] ResourceFunction[
     "StieltjesJacobiE"][n, 0, 0, a1]);
w2 = ck/(LegendreP[n, a2] ((\!\(
\*SubscriptBox[\(\[PartialD]\), \(x\)]\(\*
InterpretationBox[
TagBox[
DynamicModuleBox[{Typeset`open = False}, 
FrameBox[
PaneSelectorBox[{False->GridBox[{
{
PaneBox[GridBox[{
{
StyleBox[
StyleBox[
AdjustmentBox["\<\"[\[FilledSmallSquare]]\"\>",
BoxBaselineShift->-0.25,
BoxMargins->{{0, 0}, {-1, -1}}], "ResourceFunctionIcon",
FontColor->RGBColor[
                    0.8745098039215686, 0.2784313725490196, 0.03137254901960784]],
ShowStringCharacters->False,
FontFamily->"Source Sans Pro Black",
FontSize->0.6538461538461539 Inherited,
FontWeight->"Heavy",
PrivateFontOptions->{"OperatorSubstitution"->False}], 
StyleBox[
RowBox[{
StyleBox["StieltjesJacobiE", "ResourceFunctionLabel",
FontFamily->"Source Sans Pro"], " "}],
ShowAutoStyles->False,
ShowStringCharacters->False,
FontSize->Rational[12, 13] Inherited,
FontColor->GrayLevel[0.1]]}
},
GridBoxSpacings->{"Columns" -> {{0.25}}}],
Alignment->Left,
BaseStyle->{LineSpacing -> {0, 0}, LineBreakWithin -> False},
BaselinePosition->Baseline,
FrameMargins->{{3, 0}, {0, 0}}], 
ItemBox[
PaneBox[
TogglerBox[Dynamic[Typeset`open], {True-> DynamicBox[FEPrivate`FrontEndResource[
                    "FEBitmaps", "IconizeCloser"],
ImageSizeCache->{11., {1., 10.}}], False-> DynamicBox[FEPrivate`FrontEndResource[
                    "FEBitmaps", "IconizeOpener"],
ImageSizeCache->{11., {1., 10.}}]},
Appearance->None,
BaselinePosition->Baseline,
ContentPadding->False,
FrameMargins->0],
Alignment->Left,
BaselinePosition->Baseline,
FrameMargins->{{1, 1}, {0, 0}}],
Frame->{{
RGBColor[
                    0.8313725490196079, 0.8470588235294118, 0.8509803921568627, 0.5], False}, {False, False}}]}
},
BaselinePosition->{1, 1},
GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Baseline}}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}},
              
GridBoxSpacings->{"Columns" -> {{0}}, "Rows" -> {{0}}}], True->GridBox[{
{GridBox[{
{
PaneBox[GridBox[{
{
StyleBox[
StyleBox[
AdjustmentBox["\<\"[\[FilledSmallSquare]]\"\>",
BoxBaselineShift->-0.25,
BoxMargins->{{0, 0}, {-1, -1}}], "ResourceFunctionIcon",
FontColor->RGBColor[
                    0.8745098039215686, 0.2784313725490196, 0.03137254901960784]],
ShowStringCharacters->False,
FontFamily->"Source Sans Pro Black",
FontSize->0.6538461538461539 Inherited,
FontWeight->"Heavy",
PrivateFontOptions->{"OperatorSubstitution"->False}], 
StyleBox[
RowBox[{
StyleBox["StieltjesJacobiE", "ResourceFunctionLabel",
FontFamily->"Source Sans Pro"], " "}],
ShowAutoStyles->False,
ShowStringCharacters->False,
FontSize->Rational[12, 13] Inherited,
FontColor->GrayLevel[0.1]]}
},
GridBoxSpacings->{"Columns" -> {{0.25}}}],
Alignment->Left,
BaseStyle->{LineSpacing -> {0, 0}, LineBreakWithin -> False},
BaselinePosition->Baseline,
FrameMargins->{{3, 0}, {0, 0}}], 
ItemBox[
PaneBox[
TogglerBox[Dynamic[Typeset`open], {True-> DynamicBox[FEPrivate`FrontEndResource[
                    "FEBitmaps", "IconizeCloser"]], False-> DynamicBox[FEPrivate`FrontEndResource[
                    "FEBitmaps", "IconizeOpener"]]},
Appearance->None,
BaselinePosition->Baseline,
ContentPadding->False,
FrameMargins->0],
Alignment->Left,
BaselinePosition->Baseline,
FrameMargins->{{1, 1}, {0, 0}}],
Frame->{{
RGBColor[
                    0.8313725490196079, 0.8470588235294118, 0.8509803921568627, 0.5], False}, {False, False}}]}
},
BaselinePosition->{1, 1},
GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Baseline}}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}},
                 
GridBoxSpacings->{"Columns" -> {{0}}, "Rows" -> {{0}}}]},
{
StyleBox[
PaneBox[GridBox[{
{
RowBox[{
TagBox["\<\"Version (latest): \"\>",
"IconizedLabel"], " ", 
TagBox["\<\"1.0.0\"\>",
"IconizedItem"]}]},
{
TagBox[
TemplateBox[{"\"Documentation »\"", "https://resources.wolframcloud.com/FunctionRepository/resources/9d3a68d3-524a-49a1-8296-13dcb7312c01/"},
"HyperlinkURL"],
"IconizedItem"]}
},
DefaultBaseStyle->"Column",
GridBoxAlignment->{"Columns" -> {{Left}}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}],
Alignment->Left,
BaselinePosition->Baseline,
FrameMargins->{{5, 4}, {0, 4}}], "DialogStyle",
FontFamily->"Roboto",
FontSize->11]}
},
BaselinePosition->{1, 1},
GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Baseline}}},
GridBoxDividers->{"Columns" -> {{None}}, "Rows" -> {False, {
GrayLevel[0.8]}, False}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}]}, Dynamic[Typeset`open],
BaselinePosition->Baseline,
ImageSize->Automatic],
Background->RGBColor[
             0.9686274509803922, 0.9764705882352941, 0.984313725490196],
BaselinePosition->Baseline,
DefaultBaseStyle->{},
FrameMargins->{{0, 0}, {1, 0}},
FrameStyle->RGBColor[
             0.8313725490196079, 0.8470588235294118, 0.8509803921568627],
RoundingRadius->4]],
{"FunctionResourceBox", 
RGBColor[0.8745098039215686, 0.2784313725490196, 0.03137254901960784],
            "StieltjesJacobiE"},
TagBoxNote->"FunctionResourceBox"],
ResourceFunction["StieltjesJacobiE"],
BoxID -> "StieltjesJacobiE",
Selectable->False][n, 0, 0, x]\)\)) /. x -> a2));](https://www.wolframcloud.com/obj/resourcesystem/images/9d3/9d3a68d3-524a-49a1-8296-13dcb7312c01/7b08b20f30b8b07c.png) | 
| In[9]:= | ![ab = Riffle[a2, a1]](https://www.wolframcloud.com/obj/resourcesystem/images/9d3/9d3a68d3-524a-49a1-8296-13dcb7312c01/27b9c2eb5e5cf41f.png) | 
| Out[9]= |  | 
| In[10]:= | ![wt = Riffle[w2, w1]](https://www.wolframcloud.com/obj/resourcesystem/images/9d3/9d3a68d3-524a-49a1-8296-13dcb7312c01/618874bdbe0d54df.png) | 
| Out[10]= |  | 
Use the Gauss-Kronrod abscissas and weights to approximate the area under a curve:
| In[11]:= | ![f = x |-> Cos[x] + 3 x^3 - x + 3;
a = -1/2; b = 3/2;](https://www.wolframcloud.com/obj/resourcesystem/images/9d3/9d3a68d3-524a-49a1-8296-13dcb7312c01/7a7ba1bfeb8a36ea.png) | 
| In[12]:= | ![res = ((b - a)/2) wt . f[Rescale[ab, {-1, 1}, {a, b}]]](https://www.wolframcloud.com/obj/resourcesystem/images/9d3/9d3a68d3-524a-49a1-8296-13dcb7312c01/5c9799cf69135050.png) | 
| Out[12]= |  | 
Compare to the output of NIntegrate:
| In[13]:= | ![NIntegrate[f[x], {x, a, b}, WorkingPrecision -> 25]](https://www.wolframcloud.com/obj/resourcesystem/images/9d3/9d3a68d3-524a-49a1-8296-13dcb7312c01/3d3e493be8d0705f.png) | 
| Out[13]= |  | 
| In[14]:= | ![Abs[% - res]](https://www.wolframcloud.com/obj/resourcesystem/images/9d3/9d3a68d3-524a-49a1-8296-13dcb7312c01/7fdba90091553f1f.png) | 
| Out[14]= |  | 
Compute the abscissas and weights of a (2n+1)-point Lobatto-Kronrod quadrature:
| In[15]:= | ![n = 7;
a1 = x /. NSolve[JacobiP[n - 1, 1, 1, x] == 0, x, WorkingPrecision -> 25];
a2 = x /. NSolve[ResourceFunction["StieltjesJacobiE"][n - 1, 1, 1, x] == 0, x, WorkingPrecision -> 25];](https://www.wolframcloud.com/obj/resourcesystem/images/9d3/9d3a68d3-524a-49a1-8296-13dcb7312c01/05caec6da8fed83c.png) | 
| In[16]:= | ![(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/a01ac0ea-2246-4b84-a291-892c90db6706"]](https://www.wolframcloud.com/obj/resourcesystem/images/9d3/9d3a68d3-524a-49a1-8296-13dcb7312c01/0531cc68b97ff070.png) | 
| In[17]:= | ![ab = Join[{N[-1, 25]}, Riffle[a2, a1], {N[1, 25]}]](https://www.wolframcloud.com/obj/resourcesystem/images/9d3/9d3a68d3-524a-49a1-8296-13dcb7312c01/5083492162e6bc46.png) | 
| Out[17]= |  | 
| In[18]:= | ![wt = Riffle[w1, w2]](https://www.wolframcloud.com/obj/resourcesystem/images/9d3/9d3a68d3-524a-49a1-8296-13dcb7312c01/7e27d2c67afb9bee.png) | 
| Out[18]= |  | 
Use the Lobatto-Kronrod abscissas and weights to approximate the area under a curve:
| In[19]:= | ![f = x |-> Cos[x] + 3 x^3 - x + 3;
a = -1/2; b = 3/2;](https://www.wolframcloud.com/obj/resourcesystem/images/9d3/9d3a68d3-524a-49a1-8296-13dcb7312c01/752f666e8eaaaccb.png) | 
| In[20]:= | ![res = ((b - a)/2) wt . f[Rescale[ab, {-1, 1}, {a, b}]]](https://www.wolframcloud.com/obj/resourcesystem/images/9d3/9d3a68d3-524a-49a1-8296-13dcb7312c01/1ac078783cf98e47.png) | 
| Out[20]= |  | 
Compare to the output of NIntegrate:
| In[21]:= | ![NIntegrate[f[x], {x, a, b}, WorkingPrecision -> 25]](https://www.wolframcloud.com/obj/resourcesystem/images/9d3/9d3a68d3-524a-49a1-8296-13dcb7312c01/53903d82a6fef40b.png) | 
| Out[21]= |  | 
| In[22]:= | ![Abs[% - res]](https://www.wolframcloud.com/obj/resourcesystem/images/9d3/9d3a68d3-524a-49a1-8296-13dcb7312c01/5e8accf1882b5377.png) | 
| Out[22]= |  | 
The second (nonpolynomial) solution of the Jacobi differential equation,  :
:
| In[23]:= | ![JacobiQ[n_, a_, b_, x_] := 2^-n (x - 1)^-(a + n + 1) (x + 1)^-b Hypergeometric2F1[a + n + 1, n + 1, a + b + 2 n + 2, 2/(1 - x)]](https://www.wolframcloud.com/obj/resourcesystem/images/9d3/9d3a68d3-524a-49a1-8296-13dcb7312c01/149f8c1ae24120a8.png) | 
StieltjesJacobiE is the polynomial part of the asymptotic expansion of  at Infinity:
 at Infinity:
| In[24]:= | ![Normal[Quiet@
  Series[1/((x - 1)^a (x + 1)^b JacobiQ[2, a, b, x]), {x, \[Infinity],
     0}]]](https://www.wolframcloud.com/obj/resourcesystem/images/9d3/9d3a68d3-524a-49a1-8296-13dcb7312c01/52c8810ed8061d36.png) | 
| Out[24]= |  | 
| In[25]:= | ![% == ResourceFunction["StieltjesJacobiE"][2, a, b, x] // Simplify](https://www.wolframcloud.com/obj/resourcesystem/images/9d3/9d3a68d3-524a-49a1-8296-13dcb7312c01/544ac2fbf02922c9.png) | 
| Out[25]= |  | 
StieltjesJacobiE is a polynomial of degree n+1:
| In[26]:= | ![Exponent[ResourceFunction["StieltjesJacobiE"][6, \[Alpha], \[Beta], x], x]](https://www.wolframcloud.com/obj/resourcesystem/images/9d3/9d3a68d3-524a-49a1-8296-13dcb7312c01/5c020e9b080d7316.png) | 
| Out[26]= |  | 
The roots of JacobiP and StieltjesJacobiE interlace each other:
| In[27]:= | ![Plot[{ResourceFunction["StieltjesJacobiE"][5, 1, 1, x], JacobiP[5, 1, 1, x]}, {x, -1, 1}]](https://www.wolframcloud.com/obj/resourcesystem/images/9d3/9d3a68d3-524a-49a1-8296-13dcb7312c01/3c56aa99b0b32438.png) | 
| Out[27]= |  | 
A curve with multiple loops:
| In[28]:= | ![ParametricPlot[{ResourceFunction["StieltjesJacobiE"][4, 0, 0, Cos[t]],
   ResourceFunction["StieltjesJacobiE"][4, 0, 0, Sin[t]]}, {t, 0, 2 \[Pi]}]](https://www.wolframcloud.com/obj/resourcesystem/images/9d3/9d3a68d3-524a-49a1-8296-13dcb7312c01/0d2660e9395401dc.png) | 
| Out[28]= |  | 
This work is licensed under a Creative Commons Attribution 4.0 International License