Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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!

share|improve this question
    
I'm curious to see the code that you tried. Could you post it? –  Sjoerd C. de Vries May 10 '14 at 22:50
    
@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 –  user6818 May 10 '14 at 23:11
    
@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$. –  J. W. Perry May 11 '14 at 2:59
    
Is this a homework problem? If so, it should be tagged as such. –  m_goldberg May 11 '14 at 3:01
1  
@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. –  user6818 May 11 '14 at 3:03

1 Answer 1

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}
share|improve this answer
    
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). –  J. W. Perry May 11 '14 at 5:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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