0
|
5536 Views
|
7 Replies
|
9 Total Likes
View groups...
Share
GROUPS:

# How do I make this summation numerical?

Posted 10 years ago
 Hi,I don't understand why I can't make the below numerical?NSum[NSum[(2^(m + p)), {m, 1, 2}], {p, 1, 2}]It gives:Error - NSum::nsnum: Summand (or its derivative) 2^(m+p) is not numerical at point m = 1. >>
7 Replies
Sort By:
Posted 10 years ago
 Thanks! Seems I should have put: A[{x_, y_}] :=
Posted 10 years ago
 Using the Table trick after changing to A[{x_,y_}]:=..., it shows you have A[x,y] in some places and A[{x,y}] in other places.What I should have done was sorted all this out and made all of them consistent.Instead I cheated and just made two definitions for A,A[{x_,y_}:=...A[x_,y_]:=...with identical right hand sides.I also separated each of your statements with a semicolon, always a good idea and will keep you out of trouble in the future.With those changes and after a depressingly long time your stream plot appears.
Posted 10 years ago
Posted 10 years ago
 Thanks, I wouldn't have come up with that myself!The reason is that I'm trying to get the following to plot:n=2a=10R[m_, p_] := {m*a, p*a}K[m_, p_] := {(2*Pi*m)/a, (2*Pi*p)/a}A[x_, y_] := Sum[(-(-1)^(m*p + m + p) Exp[(-(K[m, p]*K[m, p])*a^2)/(8*Pi)])*(1 - Cos[K[m, p]*{x, y}]), {m, 1, 5}, {p, 1, 5}]s[m_, p_] := -R[m, p] ((Sqrt*a^2)/(4*Pi*R[m, p]*R[m, p]) + (0.068*a^4)/(R[m, p]*R[m, p]*R[m, p]*R[m, p]))w[x_, y_] := A[x, y]/A[x/n, y/n] Product[(A[({x, y} - R[m, p] - s[m, p])/n]/A[({x, y} - R[m, p])/n]), {m, 1, 5}, {p, 1, 5}]StreamPlot[w[x, y], {x, 1, 10}, {y, 1, 10}]At the moment it gives a blank plot so I'm attempting to make it numerical in the hope that it may work. However I'm really struggling to get it to be numerical.Any advice?Thank you!
Posted 10 years ago
 NSum[#, {m, 1, 3}, {p, 1, 2}] & /@ {m, p}{12., 9.}
Posted 10 years ago
 That's great! Thanks!Is there a way for this to work?    NSum[{m, p}, {m, 1, 3}, {p, 1, 2}]
Posted 10 years ago
 p is symbolic for the inner NSumNSum[(2^(m + p)), {m, 1, 2}, {p, 1, 2}]gives 36. without the error msg.