Sum of alternating series using four-digit chopping arithmetic

In summary: Ah thanks, I've figure it out already. n is 86 and the sum is 0.5403. Actually the sum is approximated by Maclaurin's series to be cos(1).
  • #1
drawar
132
0

Homework Statement


Let [itex]a_{n}[/itex] be an alternating series whose terms are decreasing in magnitude. How to compute the sum as precisely as possible using four-digit chopping arithmetic? In particular, apply the method to compute [itex]\sum\limits_{n = 0}^\infty {\frac{{{{( - 1)}^n}}}{{(2n)!}}}[/itex] and specify how the term [itex]\frac{{{{( - 1)}^n}}}{{(2n)!}}[/itex] is obtained.Here is an excerpt from my textbook regarding the definition of finite digit chopping arithmetic:

Any positive real number [itex]y[/itex] can be written in decimal floating point form: [itex]y=0.{d_1}{d_2}{d_3}...{d_k}{d_{k + 1}}{d_{k + 2}}... \times {10^n}[/itex] where each digit [itex]d_{k}[/itex] satises [itex]0 \leq[/itex] [itex]d_{k}[/itex] [itex]\leq 9[/itex] and [itex]d_{1}[/itex] [itex]\neq 0[/itex]. To put [itex]y[/itex] to a [itex]k[/itex]-digit decimal floating point number, the first method is chopping (a.k.a. rounding towards [itex]0[/itex] or truncation): [itex]fl(y)=0.{d_1}{d_2}{d_3}...{d_k} \times {10^n}[/itex]
Here, [itex]fl(y)[/itex] denotes the floating form of [itex]y[/itex].

Homework Equations


The Attempt at a Solution


I was told that calculating by nesting is more precise than calculating term by term, but how to calculate the sum of a series going to infinity? Any hint given is much appreciated, thanks!
 
Last edited:
Physics news on Phys.org
  • #2
I suggest working backwards from some value of n, and considering each term as a fraction of the one to the left.
E.g. for the target series, one term is -1/2n times the one to the left. So you could start with the max n that gives a nonzero value in four decimal digits. Then add 1, to represent the term to the left, then multiply by -1/(2n-2) to get it relative to the next term to the left, and so on. I.e the sum is
1 +(-1/2)(1+(-1/4)(1+(-1/6)(1+...
 
Last edited:
  • #3
haruspex said:
I suggest working backwards from some value of n, and considering each term as a fraction of the one to the left.
E.g. for the target series, one term is -1/2n times the one to the left. So you could start with the max n that gives a nonzero value in four decimal digits. Then add 1, to represent the term to the left, then multiply by -1/(2n-2) to get it relative to the next term to the left, and so on. I.e the sum is
1 +(-1/2)(1+(-1/4)(1+(-1/6)(1+...

haruspex said:
So you could start with the max n that gives a nonzero value in four decimal digits

Oh, that solved the infinity problem, but how do we come up with such n? I was given a function to simulate the 4-digit chopping arithmetic in MATLAB:
function y=fl(x)
if x==0.0,
y=0.0;
return
end
c=floor(log10(abs(x)))-3;
y=fix(x*10^(-c))*10^c;
return

As for the sum, should it be:
[itex] - \frac{1}{2}\left( {1 - \frac{1}{{12}}\left( {1 - \frac{1}{{30}}\left( {1 - \frac{1}{{56}}\left( {1 - ...} \right)} \right)} \right)} \right)[/itex]?

Thanks!
 
  • #4
If possible for a given series, I would suggest calculating the the series in pairs, positive and negative, so that you don't lose precision in the subtraction.

This method is possible and somewhat useful for this particular series but the terms decrease too fast to show this to its best advantage.
 
  • #5
Joffan said:
If possible for a given series, I would suggest calculating the the series in pairs, positive and negative, so that you don't lose precision in the subtraction.

This method is possible and somewhat useful for this particular series but the terms decrease too fast to show this to its best advantage.

Thanks but I don't think that method gives a better accuracy than nested polynomials. For example, to calculate [itex]y = a + bx + c{x^2} + d{x^3}[/itex], one has to do 6 multiplications and 3 additions (assuming that the powers of x are calculated separately), while nesting it to [itex]y = a + x(b + x(c + dx))[/itex] requires only 3 multiplications and 3 additions. Less computations mean less roundoff errors and thus increasing the accuracy.
 
  • #6
drawar said:
Oh, that solved the infinity problem, but how do we come up with such n? I was given a function to simulate the 4-digit chopping arithmetic in MATLAB:

As for the sum, should it be:
[itex] - \frac{1}{2}\left( {1 - \frac{1}{{12}}\left( {1 - \frac{1}{{30}}\left( {1 - \frac{1}{{56}}\left( {1 - ...} \right)} \right)} \right)} \right)[/itex]?
What's the ratio between consecutive terms? That will tell what to put in the nesting. You want to start with the largest n for which the ratio doesn't truncate to zero in four digits.
 
  • #7
haruspex said:
What's the ratio between consecutive terms? That will tell what to put in the nesting. You want to start with the largest n for which the ratio doesn't truncate to zero in four digits.

Ah thanks, I've figure it out already. n is 86 and the sum is 0.5403. Actually the sum is approximated by Maclaurin's series to be cos(1). :)
 

Related to Sum of alternating series using four-digit chopping arithmetic

1. What is the purpose of using four-digit chopping arithmetic in sum of alternating series?

The purpose of using four-digit chopping arithmetic in sum of alternating series is to improve the accuracy and efficiency of calculations. By limiting the number of digits used in each term, the rounding errors are minimized, resulting in a more precise and manageable result.

2. How does four-digit chopping arithmetic work in sum of alternating series?

Four-digit chopping arithmetic works by truncating all numbers to four digits after the decimal point. This means that any numbers with more than four digits after the decimal point will be rounded down to the nearest four-digit number. This helps to reduce the accumulation of errors in the calculation process.

3. Can four-digit chopping arithmetic be used for any type of alternating series?

Yes, four-digit chopping arithmetic can be used for any type of alternating series. It is especially useful for series with large numbers or infinite series, as it helps to improve the accuracy of the final result.

4. What are the potential limitations of using four-digit chopping arithmetic in sum of alternating series?

One potential limitation of using four-digit chopping arithmetic is that it may not be suitable for series with very small or very large numbers. In these cases, using a different method of calculation may be more accurate. Additionally, four-digit chopping arithmetic may not be suitable for series with complex terms or non-numeric values.

5. How can I determine if four-digit chopping arithmetic is suitable for a specific alternating series?

You can determine if four-digit chopping arithmetic is suitable for a specific alternating series by testing it with a few terms and comparing the result to the exact value. If the difference is small and acceptable, then four-digit chopping arithmetic can be used for the entire series. However, if the difference is significant, then another method of calculation should be considered.

Similar threads

  • Calculus and Beyond Homework Help
Replies
14
Views
1K
  • Calculus and Beyond Homework Help
Replies
1
Views
323
  • Math POTW for University Students
Replies
12
Views
411
Replies
4
Views
987
  • Computing and Technology
Replies
4
Views
821
  • Calculus and Beyond Homework Help
Replies
1
Views
2K
Replies
6
Views
1K
  • Calculus and Beyond Homework Help
Replies
7
Views
2K
  • Calculus and Beyond Homework Help
Replies
7
Views
2K
  • Precalculus Mathematics Homework Help
Replies
2
Views
1K
Back
Top