# Series not evaluating to numerical answer [closed]

I am working on an example from a book (An Engineer's Guide to Mathematica). The following code is in the book:

terms=1+Accumulate[2. Table[1/(1+(2 n)ˆ2),{n,1,500}]];
n={ 50,100,200,500} ;
p=terms[[n]];
exact=π/2. Coth[π/2.];
pd=100. (exact-p)/exact;
TableForm[{ { n,p,pd} } ,TableHeadings->{ None,{ "N","s",
"% diff"}}]


The output is supposed to look like this:

N s %diff

50 1.70279 0.578059

100 1.70771 0.290481

200 1.71019 0.145605

500 1.71169 0.058329

But I do not get this output. The columns for p and pd are not evaluated, rather in the output I get long many series. I cannot see why this is happening. This is a confounding problem for me as I am trying to learn the platform.

-

## closed as off-topic by RunnyKine, xzczd, m_goldberg, Yves Klett, Mr.Wizard♦Aug 8 at 4:58

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – RunnyKine, xzczd, m_goldberg, Yves Klett, Mr.Wizard
If this question can be reworded to fit the rules in the help center, please edit the question.

The problem is that you may have copied the input directly from the book so your caret (power sign) was not what it was meant to be. Type the input yourself and it will work fine. –  RunnyKine Aug 8 at 2:50

There is a problem with the entry for terms. Retype the entry and it will work properly as below.

terms = 1 + Accumulate[2. Table[1/(1 + (2 n)^2), {n, 1, 500}]];

n = {50, 100, 200, 500};

p = terms[[n]];

exact = \[Pi]/2. Coth[\[Pi]/2.];

pd = 100. (exact - p)/exact;

TableForm[{{n, p, pd}}, TableHeadings -> {None, {"N", "s", "% diff"}}]


-
Awesome thanks! I'll have to be careful about this kind of stuff in the future. –  prometheus Aug 8 at 3:53