# \[?\] Is there one term missing when using Table?

**URL:** <https://community.wolfram.com/t/is-there-one-term-missing-when-using-table/11419>\
**Category:** Questions\
**Tags:** algebra, calculus\
**Created:** [October 22, 2017, 10:46pm UTC](https://community.wolfram.com/t/is-there-one-term-missing-when-using-table/11419 "2017-10-22T22:46:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![gouwangzhangdong](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/gouwangzhangdong/32/34499_2.png) [@gouwangzhangdong](https://community.wolfram.com/u/gouwangzhangdong)\
**Post date:** [October 22, 2017, 10:46pm UTC](https://community.wolfram.com/t/is-there-one-term-missing-when-using-table/11419/1 "2017-10-22T22:46:17Z")

</div>

Hey guys:

When I use “Table” to get a series calculation results for A from 0 to 1 with gap 0.1. So there should be 11 elements in the list at last while “Table” only gives me 10 results and miss the last one when A=1. Really appreciate someone can tell me what happened and how to improve this. You may also find the commands in the attachment.

```
$PreRead = (# /. 
     s_String /; 
       StringMatchQ[s, NumberString] && 
        Precision@ToExpression@s == MachinePrecision :> s <> "`50." &);
skew[A_, \[Alpha]_, \[Beta]_, \[Delta]_] = (2 Sqrt[\[Delta]] (((-1 + 
            A) A (\[Alpha] - \[Beta])^2 (A^2 (\[Alpha] - \[Beta])^2 - 
            A (\[Alpha] - \[Beta]) (\[Alpha] - \[Beta] - \[Delta]) + \
\[Beta] (\[Alpha] + \[Delta])) (-(-1 + 
                A) \[Beta] \[Delta] + \[Alpha] (\[Beta] + 
               A \[Delta])))/(((-1 + A) \[Alpha] - A \[Beta] - 
            3 \[Delta]) ((-1 + A) \[Alpha] - A \[Beta] - 
            2 \[Delta]) (\[Alpha] - A \[Alpha] + 
            A \[Beta] + \[Delta])^3) + (-3 (-1 + 
           A) \[Beta] \[Delta] + \[Alpha] (\[Beta] + 
           3 A \[Delta]))/(\[Alpha] - A \[Alpha] + A \[Beta] + 
        3 \[Delta]) - ((-1 + 
          A) A (\[Alpha] - \[Beta])^2 (-3 (-1 + 
             A) \[Beta] \[Delta] + \[Alpha] (2 \[Beta] + 
             3 A \[Delta])))/((\[Alpha] - A \[Alpha] + 
          A \[Beta] + \[Delta]) (\[Alpha] - A \[Alpha] + A \[Beta] + 
          2 \[Delta]) (\[Alpha] - A \[Alpha] + A \[Beta] + 
          3 \[Delta]))))/(((-1 + 
        A) A (\[Alpha] - \[Beta])^2 (-(-1 + 
            A) \[Beta] \[Delta] + \[Alpha] (\[Beta] + 
           A \[Delta])))/(((-1 + A) \[Alpha] - A \[Beta] - 
        2 \[Delta]) (\[Alpha] - A \[Alpha] + 
        A \[Beta] + \[Delta])^2) + (-2 (-1 + 
         A) \[Beta] \[Delta] + \[Alpha] (\[Beta] + 
         2 A \[Delta]))/(\[Alpha] - A \[Alpha] + A \[Beta] + 
      2 \[Delta]))^(3/2);
Table[skew[A, 20.1, 2.98, 0.015], {A, 0, 1, 0.1}] // N
Length[%]

{0.141895, 0.139203, 0.135927, 0.131859, 0.126677, 0.11985, 0.110442, \
0.0966346, 0.0744006, 0.033185}

10

```

Thanks in advance

---

<div class="post-metadata">

**Author:** ![bsimpson141421356](https://avatars.discourse-cdn.com/v4/letter/b/ac91a4/32.png) [@bsimpson141421356](https://community.wolfram.com/u/bsimpson141421356)\
**Post date:** [October 23, 2017, 6:06am UTC](https://community.wolfram.com/t/is-there-one-term-missing-when-using-table/11419/2 "2017-10-23T06:06:45Z")

</div>

Hint

```
In[1]:= ...
Length[Table[skew[A, 20.1, 2.98, 0.015], {A, 0, 1, 0.1}]]

Out[3]= 10

```

versus

```
In[1]:= ...
Length[Table[skew[A, 20.1, 2.98, 0.015], {A, 0, 1, 1/10}]]

Out[3]= 11

```

---

<div class="post-metadata">

**Author:** ![gianlucagorni](https://avatars.discourse-cdn.com/v4/letter/g/ec9cab/32.png) [@gianlucagorni](https://community.wolfram.com/u/gianlucagorni)\
**Post date:** [October 23, 2017, 6:42am UTC](https://community.wolfram.com/t/is-there-one-term-missing-when-using-table/11419/3 "2017-10-23T06:42:59Z")

</div>

Perhaps it’s because if you sum ten instances of .1`50. you get someting slightly more than 1:

```
In[2]:= .1`50. + .1`50. + .1`50. + .1`50. + .1`50. + .1`50. + .1`50. \
+ .1`50. + .1`50. + .1`50. // FullForm

Out[2] 1.0000000000000000000000000000000000000000000000000000000000000000000000\
0000003`50.

```

---

<div class="post-metadata">

**Author:** ![gouwangzhangdong](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/gouwangzhangdong/32/34499_2.png) [@gouwangzhangdong](https://community.wolfram.com/u/gouwangzhangdong)\
**Post date:** [October 23, 2017, 8:20am UTC](https://community.wolfram.com/t/is-there-one-term-missing-when-using-table/11419/4 "2017-10-23T08:20:34Z")

</div>

Sorry, I still do not what is happening here. I set up a table for k from 1 to 2 with gap 0.1. It turns out that the results are the same no matter gap being 0.1 or 1/10. Please see more details in the attachment.

---

<div class="post-metadata">

**Author:** ![sghuisman](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/sghuisman/32/27850_2.png) [@sghuisman](https://community.wolfram.com/u/sghuisman)\
**Post date:** [October 23, 2017, 8:31am UTC](https://community.wolfram.com/t/is-there-one-term-missing-when-using-table/11419/5 "2017-10-23T08:31:04Z")

</div>

0.1 is never really 0.1 in binary representation:

```
Table[A, {A, 0, 1, 0.1`50}]

```

if you copy the last number you will see:

```
0.90000000000000000000000000000000000000000000000000000000000000000000000000003`50.

```

i.e. a little bit more than 0.9, use exact arithmetic to be sure it is 11, or use Subdivide:

```
Table[A, {A, Subdivide[0, 1, 10]}]

```

---

<div class="post-metadata">

**Author:** ![jasondbiggs](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/jasondbiggs/32/28365_2.png) [@jasondbiggs](https://community.wolfram.com/u/jasondbiggs)\
**Post date:** [October 23, 2017, 8:13pm UTC](https://community.wolfram.com/t/is-there-one-term-missing-when-using-table/11419/6 "2017-10-23T20:13:27Z")

</div>

Just to clarify, this is the normal behavior

```auto
In[7]:= Length@Table[x, {x, 0, 1, .1}]

Out[7]= 11

```

When you do something drastic like

```auto
$PreRead = (# /. 
     s_String /; 
       StringMatchQ[s, NumberString] && 
        Precision@ToExpression@s == MachinePrecision :> 
      s <> "`50." &);

```

then you need to be ready for the consequences, among which is

```auto
In[10]:= Length@Table[x, {x, 0, 1, .1}]

Out[10]= 10

```

Since you want your answers to such a high number of digits, why not just keep everything as rational and use `N` at the end?

```auto
skew[Amp_, ?mp_, ?mp_, ?mp_] := 
  Module[{A = Rationalize@Amp, ? = 
     Rationalize@?mp, ? = 
     Rationalize@?mp, ? = 
     Rationalize@?mp}, (2 Sqrt[?] (((-1 + 
             A) A (? - ?)^2 (A^2 (? - ?)^2 -
              A (? - ?) (? - ? - ?) \
+ ? (? + ?)) (-(-1 + 
                 A) ? ? + ? (? + 
                A ?)))/(((-1 + A) ? - A ? - 
             3 ?) ((-1 + A) ? - A ? - 
             2 ?) (? - A ? + 
             A ? + ?)^3) + (-3 (-1 + 
            A) ? ? + ? (? + 
            3 A ?))/(? - A ? + A ? + 
         3 ?) - ((-1 + 
           A) A (? - ?)^2 (-3 (-1 + 
              A) ? ? + ? (2 ? + 
              3 A ?)))/((? - A ? + 
           A ? + ?) (? - A ? + A ? + 
           2 ?) (? - A ? + A ? + 
           3 ?))))/(((-1 + 
         A) A (? - ?)^2 (-(-1 + 
             A) ? ? + ? (? + 
            A ?)))/(((-1 + A) ? - A ? - 
         2 ?) (? - A ? + 
         A ? + ?)^2) + (-2 (-1 + 
          A) ? ? + ? (? + 
          2 A ?))/(? - A ? + A ? + 
       2 ?))^(3/2)
   ];

In[2]:= Table[skew[A, 20.1, 2.98, 0.015], {A, 0, 1, 0.1}] // N[#, 50] &
Length[%]

Out[2]= {0.14189513095212063367049531962987546141568326643434, \
0.13920344101328578263969756404215809382766534147239, \
0.13592716321563841983794812006874993948237693570027, \
0.13185917327785972103954298320739470452252943280392, \
0.12667686295955584799447506972227890015016781166517, \
0.11984973711991386295060361312735642563028850992476, \
0.11044152395284289944251345711595700385738865557709, \
0.096634643366104288816678293713331415198513960340867, \
0.074400586745371447280910852144971096789513221053062, \
0.033185045336993739355804248832880796377132424223379, \
0.054635836470815303531952862734950163493012524454082}

Out[3]= 11

```

---

<div class="post-metadata">

**Author:** ![gouwangzhangdong](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/gouwangzhangdong/32/34499_2.png) [@gouwangzhangdong](https://community.wolfram.com/u/gouwangzhangdong)\
**Post date:** [October 23, 2017, 9:56pm UTC](https://community.wolfram.com/t/is-there-one-term-missing-when-using-table/11419/7 "2017-10-23T21:56:08Z")

</div>

Thank you guys. Your comments answered my question well and I have learned a lot.
