0
$\begingroup$

I would like to evaluate this summation:

\begin{align} \sum_{j=1}^{NM}\left[(u_{j_x} + u_{j_y})^2 - 2(1-\rho) u_{j_x} u_{j_y}\right], \end{align}

where $NM$ is some number greater than or equal to $N$, $u_{j_x} = \cos[\theta]\mu_{j_x} - \sin[\theta]\mu_{j_y}$ and $u_{j_y} = \sin[\theta]\mu_{j_x} + \cos[\theta]\mu_{j_y}$ and with

\begin{split} \mu_{j_x} &= \left[(j - 1)\%N - \left(\frac{N-1}{2}\right)\right] d_x, \\ \mu_{j_y} &= \left[\left\lceil{\frac{j}{N}}\right\rceil+ \left(\frac{N+1}{2}\right)\right] d_y. \end{split}

I have plot the result in Mathematica and have seen that the first term in the summation is a constant term and the second term oscillates. I would like to get some analytic expressions for the sum rather than simulating it numerically. The script I refer to is the following:

rotation = {};
rotation = Append[rotation, {"Theta", "sumterm"}];
μx[i_, n_, dx_] := (Mod[i - 1, n] + 1 - (n + 1)/2) dx; 
μy[i_, n_, dy_] := (Ceiling[i/n] - (n + 1)/2) dy;
μxn[i_, n_, dx_, dy_, θ_] := Cos[θ] μx[i, n, dx] - Sin[θ] μy[i, n, dy];
μyn[i_, n_, dx_, dy_, θ_] := Sin[θ] μx[i, n, dx] + Cos[θ] μy[i, n, dy];
n = 10; 
m = 10; 
s = m n;  
dx = 1;
dy = 1;
ρ = 0.0; 
Do[
  sumterm = 
    Sum[
      (μxn[i, n, dx, dy, θ] + μyn[i, n, dx, dy, θ])^2 - 
      2 (1- ρ) μxn[i, n, dx, dy, θ] μyn[i, n, dx, dy, θ], 
      {i, 1, s, 1}];
  rotation = Append[rotation, {θ // N, sumterm}], 
  {θ, 0 Degree , 360 Degree, 2 Degree}];
ListLinePlot[rotation, PlotRange -> All]
$\endgroup$
  • $\begingroup$ If you include the vector of q and the matrix of sigma then someone might be able to try your code. If you don't actually have those and they are symbolic then you could try using Symbol along with some string concat to make up symbol names which you can sum to get a very large symbolic result, but I don't think that is going to plot without the q and sigma numeric values. $\endgroup$ – Bill Jan 26 '18 at 23:00
  • $\begingroup$ @Bill, Apologies for the mistake, I have updated the question. $\endgroup$ – Sid Jan 26 '18 at 23:15
3
$\begingroup$
μx[i_, n_, dx_] := (Mod[i - 1, n] + 1 - (n + 1)/2) dx;
μy[i_, n_, dy_] := (Ceiling[i/n] - (n + 1)/2) dy;
μxn[i_, n_, dx_, dy_, θ_] := 
  Cos[θ] μx[i, n, dx] - Sin[θ] μy[i, n, dy];
μyn[i_, n_, dx_, dy_, θ_] := 
  Sin[θ] μx[i, n, dx] + Cos[θ] μy[i, n, dy];
n = 10;
m = 10;
s = m n;
dx = 1;
dy = 1;
ρ = 0;

With your code, your sumterm is a constant, i.e., independent of θ

sumterm = Sum[(μxn[i, n, dx, dy, θ] + μyn[i, n, dx, dy, θ])^2 - 
    2 (1 - ρ) μxn[i, n, dx, dy, θ] μyn[i, n, dx, dy, θ], 
      {i, 1, s, 1}] // Simplify

(* 1650 *)

It is also independent of ρ

Clear[ρ]

sumterm = Sum[(μxn[i, n, dx, dy, θ] + μyn[i, n, dx, dy, θ])^2 - 
    2 (1 - ρ) μxn[i, n, dx, dy, θ] μyn[i, n, dx, dy, θ], 
      {i, 1, s, 1}] // Simplify

(* 1650 *)
$\endgroup$

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.