2
$\begingroup$

Suppose I know the sequence is of the $a n^4 + b n^3 + c n^2 + d n$, with positive integers $a,b,c,d$, what is the easiest way to get them from the first few coefficients?

Here are the sequences I'm looking at. Mathematica's FindSequenceFunction works for the first one, but not for the rest

{15,48,105,192,315}
{15, 64, 183, 432, 895}
{15,80,273,720,1595}
{15, 144, 603, 1728, 3975}

Obtained from moments of Gaussian matrix products like $\operatorname{Tr}(AAAA^TA^TA^T)$ (background)

Clear[a, A, n];
getMoment[n_, expr_] := (
   traceExpr = Tr[expr] /. A -> Array[a, {n, n}];
   distSpec = # \[Distributed] NormalDistribution[0, 1] & /@ 
     Variables[traceExpr];
   Expectation[traceExpr, distSpec]
   );
exprs = {A . A . A . A . A . A, 
   A\[Transpose] . A\[Transpose] . A . A\[Transpose] . A . A, 
   A . A . A . A\[Transpose] . A\[Transpose] . A\[Transpose], 
   A . A\[Transpose] . A . A\[Transpose] . A . A\[Transpose]};
getMomentSequence[expr_] := Table[getMoment[n, expr], {n, 1, 5}];
table = Table[
   With[{seq = getMomentSequence[expr]},
    {TraditionalForm@expr, TraditionalForm[seq], 
     Expand[FindSequenceFunction[seq][n]]}],
   {expr, exprs}];
TableForm[table]
$\endgroup$
1
  • $\begingroup$ quarticCoeffs[ll_List /; Length[ll] == 5] := Module[{x}, CoefficientList[InterpolatingPolynomial[ll, x], x]] seems to work for this. $\endgroup$ Commented Dec 4, 2023 at 16:45

2 Answers 2

2
$\begingroup$

form is the product { n^4, n^3, n^2, n} . {a, b, c, d}

First we calculate matrix

m=Table[{ n^4, n^3, n^2, n},{n,1,5}];

abcd=Map[LinearSolve[m, #] &, seq]
(*{{0, 1, 6, 8}, {1, 0, 10, 4}, {2, 1, 8, 4}, {5, 6, 4, 0}}*)

check result

MapThread[0 == Norm[m . #2 - #1] &, {seq, abcd}]
(*{True, True, True, True}*)
$\endgroup$
3
$\begingroup$
seq={{15,48,105,192,315},{15,64,183,432,895},{15,80,273,720,1595},{15,144,603,1728,3975}};

form=a n^4+b n^3+c n^2+d n;

form/.First@Solve[Table[form,{n,5}]==#]&/@seq

{8 n + 6 n^2 + n^3, 4 n + 10 n^2 + n^4, 4 n + 8 n^2 + n^3 + 2 n^4, 4 n^2 + 6 n^3 + 5 n^4}
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.