2
$\begingroup$

Assume that I have three function:

sum1[n_] := Sum[Cos[k/n], {k, 0, n}]
sum2[n_] := Sum[Sin[k/n], {k, 0, 2n}]
sum3[n_] := Sum[Cos[k + 1/2n], {k, 0, 2n - 1}]

For each $n<100$, how can I compare these three function?

For example Mathematica tells me sum2[3]> sum1[3]>sum3[3] or sum3[5]>sum[5]>sum1[5].

$\endgroup$
  • 1
    $\begingroup$ How about plotting them as a function of n? $\endgroup$ – bill s Oct 5 '17 at 13:33
  • $\begingroup$ And @@ Table[sum2[n] > sum1[n] > sum3[n], {n, 1, 100}] evaluates to True $\endgroup$ – Bob Hanlon Oct 5 '17 at 14:40
1
$\begingroup$

DiscretePlot[{sum1[n], sum2[n], sum3[n]}, {n, 1, 100}]enter image description here

$\endgroup$
  • $\begingroup$ Better still, plot the differences $\endgroup$ – Lotus Oct 5 '17 at 14:13
  • $\begingroup$ Plot doesn't work good for large domains. Isn't there any way else?or only way is that I must use several If? $\endgroup$ – A. Mpi Oct 5 '17 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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