Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#26 2013-02-11 04:55:53

Serj
Member
Registered: 2012-12-25
Posts: 24

Re: Calculation with a given accuracy

Nice! I got it! Thank you for making it challenging!))

Since I cannot determine the number which this series converges to (I can run my summation script for only 9 terms), I'll modify my code to return only alternating errors.

I hope I won't run into any more difficulties with this problem. Thanks!!)

Offline

#27 2013-02-11 04:56:51

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Calculation with a given accuracy

Hi;

Hold on, I have not shown you how to calculate the error, just prepared you for it.

Where did he go?

Last edited by bobbym (2013-02-11 05:03:27)


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#28 2013-02-11 21:17:16

Serj
Member
Registered: 2012-12-25
Posts: 24

Re: Calculation with a given accuracy

LOL!)) I am back!!

It seems that to calculate the alternating error you go down the list and subtract the smaller number from the larger one.

Isn't this correct?

Offline

#29 2013-02-11 21:28:11

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Calculation with a given accuracy

I am afraid not. It is even easier than that.

Last edited by bobbym (2013-02-11 21:35:13)


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#30 2013-02-11 21:34:09

Serj
Member
Registered: 2012-12-25
Posts: 24

Re: Calculation with a given accuracy

how come it can be easier than subtracting two numbers?))

Offline

#31 2013-02-11 21:37:23

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Calculation with a given accuracy

Because we do not need to subtract anything! Please hold on the answer is simple but to write it up takes time.

If we abandon the sigma notation and look at the series term by term it will be easier to understand.

gif.latex?\inline%20\dpi{120}%20\bg_green%20\fn_cs%20\sum%20_{k=0}^{\infty%20}%20\frac{(-1)^k%20\left(\frac{x}{2}\right)^{2%20(k+1)}}{((k+1)!)^2}=\frac{1}{4}%20-\frac{1}{64}%20+\frac{1}{2304}%20-\frac{1}{147456}%20+\frac{1}{14745600}-\frac{1}{2123366400}+...-

Look at the RHS.
We see that the signs alternate that is why we call it an alternating series. Understand up to here?

Last edited by bobbym (2013-02-11 21:41:14)


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#32 2013-02-11 22:04:35

Serj
Member
Registered: 2012-12-25
Posts: 24

Re: Calculation with a given accuracy

Yeah, seems to be clear so far. And what i see is that the first term = sum #1, and the following terms correspond to alternating errors from the table kindly provided by you.

Offline

#33 2013-02-11 22:12:03

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Calculation with a given accuracy

Hi;

Let's say we take the first 3 terms of the series

1/4, -(1/64), 1/2304

gif.latex?\inline%20\dpi{120}%20\bg_green%20\fn_cs%20\sum%20_{k=0}^{\infty%20}%20\frac{(-1)^k%20\left(\frac{x}{2}\right)^{2%20(k+1)}}{((k+1)!)^2}=\frac{1}{4}%20-\frac{1}{64}%20+\frac{1}{2304}%20-%20\fbox{$%20\frac{1}{147456}%20}

the error then is less than the absolute value of the next term. The one that is boxed. That is all there is to it when the series is alternating.

So the error from summing the first 3 terms is less than 6.78168402E-6.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#34 2013-02-11 22:23:48

Serj
Member
Registered: 2012-12-25
Posts: 24

Re: Calculation with a given accuracy

thank you, bobbym, it is quite clear now!

Offline

#35 2013-02-11 22:26:55

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Calculation with a given accuracy

Hi;

Each time just get the next term and take the absolute value. If you sum 9 terms then check the 10 th. As the great Bill Hanlon used to say, "piece of cake!"

There are other interesting questions to answer. Why did I pick x = 1?

I am able to run summation only for its first 9 terms. Then the denominator apparently gets to large for Turbo Pascal and it returns me an error.

We can improve that easily. Are they still forcing people to use that language?

Last edited by bobbym (2013-02-12 00:05:21)


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#36 2013-02-12 01:15:06

Serj
Member
Registered: 2012-12-25
Posts: 24

Re: Calculation with a given accuracy

We can improve that easily. Are they still forcing people to use that language?

yep, they are. ((

Why did I pick x = 1?

No idea. Maybe because it is short and simple!?))

Also, one more thing turned out to be wrong, I already edited my code so it returns K, sum and Error, but have just noticed that they do not want the actual error to be on the list, they want me to calculate sums with given accuracy (10^-3, 10^-4, 10^-5, 10^-6) and specify this accuracy in the error column. I guess I'm just gonna leave it as it is. I think the script currently does even more calculations than required.

Offline

#37 2013-02-12 01:35:01

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Calculation with a given accuracy

Hi;

The actual error is almost never available. I can compute it because I know what the answer is supposed to be. How many times does that occur?

I picked x = 1 because that is a Taylor's series expanded at 0. The error typically gets larger the further we get from the expansion point.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#38 2013-02-12 02:46:24

Serj
Member
Registered: 2012-12-25
Posts: 24

Re: Calculation with a given accuracy

sorry for an ambiguous post, you did not understand me right, in the previous post by "the actual error" I meant they do not want any error, they just require to specify accuracy (10^-3, 10^-4, 10^-5, 10^-6).

Offline

#39 2013-02-12 02:50:46

Serj
Member
Registered: 2012-12-25
Posts: 24

Re: Calculation with a given accuracy

The table should be like this:

Accuracy (they call it epsilon) | Sum | Term (K)

Offline

#40 2013-02-12 03:01:31

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Calculation with a given accuracy

What do you want to use for epsilon, digits that match or the alternating error estimate?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#41 2013-02-12 03:08:45

Serj
Member
Registered: 2012-12-25
Posts: 24

Re: Calculation with a given accuracy

Epsilon is given:
10^-3
10^-4
10^-5
10^-6
So there is nothing to choose from, it's already known. As I said before the script already does more calculations than needed. What I am wondering about now is why there are only 4 "epsilons", although it is said that I should run the summation for the first 10 terms (what I can't technically do though :-) ).

Offline

#42 2013-02-12 03:15:01

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Calculation with a given accuracy

We have to know what error we have from k terms to know when it is smaller than epsilon. Do we use the alternating series estimate of the error or matching digits?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#43 2013-02-12 03:26:38

Serj
Member
Registered: 2012-12-25
Posts: 24

Re: Calculation with a given accuracy

I  do not really know, I guess I'll leave it as it is. Too much time has been spent on it. There are other problems to solve. Thank you for support, bobbym!

Last edited by Serj (2013-02-12 03:27:04)

Offline

#44 2013-02-12 03:39:15

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Calculation with a given accuracy

Hi;

Your welcome! Let me know if you need more.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

Board footer

Powered by FluxBB