1
$\begingroup$

I want to explain this summation to Mathematica,

For $a >0$ define $n_u, n_d \in \mathbb{Z}$ such that if $\{ a \} \leq 0.5$ then $n_u = [a]-1$ and $n_d = - [a]$ and if $\{ a \} > 0.5$ then $n_u = [a]$ and $n_d = -([a]+1)$. Now compute the sum, $\sum _ {n = n_d} ^{n_u} (1+2n)Log[a^2 - (n + \frac{1}{2} )^2] $

Can someone help me write this in Mathematica?


Withe everything that I tried so far, Mathematica produced a complex number as the answer! I don't know how Mathematica is adding up a finite number of real numbers to get a complex number!

$\endgroup$
5
  • $\begingroup$ I'm curious to see the code that you tried. Could you post it? $\endgroup$ May 10, 2014 at 22:50
  • $\begingroup$ @SjoerdC.deVries I am a noob enough to not know how to put in the conditionals on nu and nd. I just this plain thing, Assuming [ n1 [Element] Integers && n2 [Element] Integers && n1 < n2 && a > 0 && n2 < a && n1 < 0, Sum [ (1 + 2 n) Log [ a^2 - ( n + (1/2 )^2) ] , {n, n1, n2}]] // FullSimplify $\endgroup$
    – user6818
    May 10, 2014 at 23:11
  • $\begingroup$ @user6818 is $[a]$ intended to be the Gauss style notation for $\operatorname{floor(a)}=\left \lfloor{a}\right \rfloor$? Additionally, how should I interpret $\{ a \}$? Is this just the scalar $a$? Also, note that in your comment you have inside the logarithm $a^2-\left(n+\left(\frac{1}{2}\right)^2\right)$, but in your post it is $a^2-\left( n+\frac{1}{2} \right)^2$. $\endgroup$ May 11, 2014 at 2:59
  • $\begingroup$ Is this a homework problem? If so, it should be tagged as such. $\endgroup$
    – m_goldberg
    May 11, 2014 at 3:01
  • 1
    $\begingroup$ @J.W.Perry [a] is the floor function and {a} is the fractional part of a. And the comment has the typo - the correct summand is in the question. $\endgroup$
    – user6818
    May 11, 2014 at 3:03

1 Answer 1

3
$\begingroup$

Ok, with your last defining comment, this seems quite clear. Your data suggests (avoid $a\leq0$):

f[a_] := If[
FractionalPart[a] <= 1/2,
Sum[(1 + 2 n)* Log[a^2 - (n + 1/2)^2], {n, -Floor[a], Floor[a] - 1}],
Sum[(1 + 2 n)* Log[a^2 - (n + 1/2)^2], {n, -(Floor[a] + 1), Floor[a]}]
]

Now a set of sums for various fixed values of $a>0$,

Table[f[a], {a, 1/10, 2, 1/10}] (*a from .1 to 2 in steps of .1*)

produces

{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
$\endgroup$
1
  • $\begingroup$ Note that this precisely satisfies all of the conditions in your actual post, but the "sorta code" you wrote in your first comment where $n1<n2$, is absolutely false for the branch where $0<a\leq.5$. The lower bound is $0$ there, while the upper bound is $-1$ everywhere on that interval by the definition in your actual post ($n_d$ being lower, and $n_u$ being upper). $\endgroup$ May 11, 2014 at 5:59

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.