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

You are not logged in.

#26 2013-02-12 03:55:53

Serj
Member

Offline

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!!)

#27 2013-02-12 03:56:51

bobbym

Offline

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-12 04:03:27)

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

#28 2013-02-12 20:17:16

Serj
Member

Offline

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?

#29 2013-02-12 20:28:11

bobbym

Offline

Re: Calculation with a given accuracy

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

Last edited by bobbym (2013-02-12 20:35:13)

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

#30 2013-02-12 20:34:09

Serj
Member

Offline

Re: Calculation with a given accuracy

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

#31 2013-02-12 20:37:23

bobbym

Offline

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.

$\inline \dpi{120} \bg_green \fn_cs \sum _{k=0}^{\infty } \frac{(-1)^k \left(\frac{x}{2}\right)^{2 (k+1)}}{((k+1)!)^2}=\frac{1}{4} -\frac{1}{64} +\frac{1}{2304} -\frac{1}{147456} +\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-12 20:41:14)

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

#32 2013-02-12 21:04:35

Serj
Member

Offline

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.

#33 2013-02-12 21:12:03

bobbym

Offline

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

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

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.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

#34 2013-02-12 21:23:48

Serj
Member

Offline

Re: Calculation with a given accuracy

thank you, bobbym, it is quite clear now!

#35 2013-02-12 21:26:55

bobbym

Offline

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 23:05:21)

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

#36 2013-02-13 00:15:06

Serj
Member

Offline

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.

#37 2013-02-13 00:35:01

bobbym

Offline

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.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

#38 2013-02-13 01:46:24

Serj
Member

Offline

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).

#39 2013-02-13 01:50:46

Serj
Member

Offline

Re: Calculation with a given accuracy

The table should be like this:

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

#40 2013-02-13 02:01:31

bobbym

Offline

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.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

#41 2013-02-13 02:08:45

Serj
Member

Offline

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 :-) ).

#42 2013-02-13 02:15:01

bobbym

Offline

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.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

#43 2013-02-13 02:26:38

Serj
Member

Offline

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-13 02:27:04)

#44 2013-02-13 02:39:15

bobbym

Offline

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.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.