2
$\begingroup$

Mathematica seems not to be able to minimize this univariate function over integer arguments, $r>2, r \in \mathbb{Z}$.

k=6;
SB[n_, r_] := 
 Sum[Binomial[r Binomial[2 k, 2]/2, i] Binomial[
    Binomial[n, 2] - r Binomial[2 k, 2]/2, 
    r Binomial[k, 2] + r - i], {i, r Binomial[k, 2] + r/2, 
   r Binomial[k, 2] + r}]


NMinimize[{SB[k r, r], Element[r, Integers] && r > 2}  , r]

This takes forever, even if, evaluated with Table the function in the interval $r=(2,100]$ for example, has perfectly valid values. The other command FindInstance seems unable to tell me a valid value when checking if $S_B(k r,r) > 0$ even if this is true for every value of $r$.

Some help to make this computation faster or let it converge to a feasible solution? I know the solution is at $r=2$ but I just want to know how to properly specify this problem that is part of a more general framework.

$\endgroup$

2 Answers 2

4
$\begingroup$

If you use: SB[n_?NumericQ, r_?NumericQ] in your definition things work as you expect.

Otherwise, SB is evaluated symbolically and that will take forever...

$\endgroup$
0
2
$\begingroup$
Clear["Global`*"]
k = 6.;
SB[n_, r_] := 
 Sum[Binomial[r Binomial[2 k, 2]/2, i] Binomial[
    Binomial[n, 2] - r Binomial[2 k, 2]/2, r Binomial[k, 2] + r - i], 
 {i, r Binomial[k, 2] + r/2, r Binomial[k, 2] + r}]
SB[# k, #] & /@ Range[100] // Timing
ListLogPlot[%[[2]]]

way 2

Clear["Global`*"]
sum[r_] := Sum[(Gamma[1 + 33 r] Gamma[1 - 36 r + 18 r^2])/(
   Gamma[1 + i] Gamma[1 - i + 16 r] Gamma[1 - i + 33 r] Gamma[
  1 + i - 52 r + 18 r^2]), {i, (31 r)/2, 16 r}];
(data = sum[1. #] & /@ Range[2, 300];) // Timing
ListLogPlot[data, AxesLabel -> {"r", "sum"}]
$\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.