- #1

- 123

- 0

Archimedes concluded that:

n*sin(theta/2) < pi < n*tan(theta/2)

Basically, I need some help. Anyone got any ideas or any code just to get me started. I'm clueless at the moment.

Thanks in advance

- MATLAB
- Thread starter strokebow
- Start date

- #1

- 123

- 0

Archimedes concluded that:

n*sin(theta/2) < pi < n*tan(theta/2)

Basically, I need some help. Anyone got any ideas or any code just to get me started. I'm clueless at the moment.

Thanks in advance

- #2

- 123

- 0

Has no1 got any ideas???

Thanks

Thanks

- #3

- 236

- 0

What you need to do is to find out theta as function of n , if you can find that out , it will be easy for you to do the program.

Last edited:

- #4

- 236

- 0

and if my memory serves me well i think theta=Pi*(n-2)/n

Last edited:

- #5

- 123

- 0

However, I cannot use pi in my program.

theta is the angle subtended by any side of the polygon at the circle centre (=360/n degrees)

I'm kinda at a loss of what to do. I've tried sum code but I I'm not getting anywhere and I'm not even sure what i'm doing.

Please help.

Thanks

- #6

- 123

- 0

Anyone got any ideas?

- #7

- 1,076

- 1

Why not just implement, eg., this: http://www.escape.com/~paulg53/math/pi/archimedes/index.html

- #8

- 236

- 0

why don't you use Sin&Tan in degree format ?

then theta=180*(n-2)/n ??

then theta=180*(n-2)/n ??

Last edited:

- #9

- 123

- 0

I've been at this problem for ages trying but I'm not getting anywhere. Can anyone break this problem down for me in to its core components or provide some code to get me going in the right direction. Really stuck!

Thanks alot!

- #10

- 123

- 0

- #11

- 230

- 0

- #12

- 213

- 0

What is the problem? Do you not know how to find theta(n) or do you not know how to implement it in Matlab?

- #13

- 161

- 0

Before you even start to use Matlab (or any other computing tools) to solve the problem, you should at least have a plan in mind about the approach/method to use.

You asked about how Matlab can be used to solve the problem; well, tell us something about your plan (a pseudocode or the sort) and we will teach you how to implement that with Matlab.

Remember, Matlab is not the problem here. The problem, so far, is this: How do you use Archimedes Method to calculate pi.

- #14

- 123

- 0

The guy with the web address . . . I aint got a clue what thats going on about

I cant follow it at all

I tried following it . . . wrote some code - its crap

Code:

```
Pm = 1
for n=1:15
theta = 360/n;
x = sin(theta);
y = tan(theta);
xn = (x*y)/(x+y);
Pn = (2^(n+1))*xn;
pn = (2^n)*x;
Pn = (2^n)*y;
pm = sqrt(pn*Pm)
Pm = (2*pn*Pn)/(pn+Pn)
end
```

I thank you lot for your efforts in trying to help but it hasnt really helped me. Maybe if you actually were able to solve the tasks yourselves you would be able to help rather that just putting down what you think would be good ideas without knowing how to solve the problem yourselves.

Its not as easy as you seem to think. If it is, then prove it.

- #15

- 230

- 0

Code:

```
% archpi.m
%
% Calculates pi by Archimedes' method
%
% Reference: http://personal.bgsu.edu/~carother/pi/Pi3a.html
p = 2*sqrt(2);
q = 4;
disp(sprintf('p \t\t q \t\t error'))
while ?
disp(sprintf('%1.11f \t %1.11f \t %1.11f',p,q,abs(q-p)))
nextq = ?;
p = ?;
q = ?;
end
disp(sprintf('%1.11f \t %1.11f \t %1.11f',p,q,abs(q-p)))
```

The output of this code, when it is filled out, is:

Code:

```
p q error
2.82842712475 4.00000000000 1.17157287525
3.06146745892 3.31370849898 0.25224104006
3.12144515226 3.18259787807 0.06115272582
3.13654849055 3.15172490743 0.01517641688
3.14033115695 3.14411838525 0.00378722829
3.14127725093 3.14222362994 0.00094637901
3.14151380114 3.14175036917 0.00023656802
3.14157294037 3.14163208070 0.00005914034
3.14158772528 3.14160251026 0.00001478498
3.14159142151 3.14159511775 0.00000369624
3.14159234557 3.14159326963 0.00000092406
3.14159257658 3.14159280760 0.00000023101
3.14159263434 3.14159269209 0.00000005775
3.14159264878 3.14159266322 0.00000001444
3.14159265239 3.14159265600 0.00000000361
3.14159265329 3.14159265419 0.00000000090
3.14159265351 3.14159265374 0.00000000023
3.14159265357 3.14159265363 0.00000000006
```

- #16

- 123

- 0

Hey Thanks alot! That was a big help.

Thanks agan

Thanks agan

Last edited:

- #17

- 230

- 0

- #18

- 123

- 0

I totally agree Thanks for your help!

- Last Post

- Replies
- 1

- Views
- 6K

- Last Post

- Replies
- 0

- Views
- 4K

- Last Post

- Replies
- 0

- Views
- 2K

- Last Post

- Replies
- 1

- Views
- 8K

- Last Post

- Replies
- 0

- Views
- 4K

- Last Post

- Replies
- 1

- Views
- 5K

- Last Post

- Replies
- 28

- Views
- 79K

- Replies
- 5

- Views
- 8K

- Last Post

- Replies
- 2

- Views
- 3K

- Last Post

- Replies
- 2

- Views
- 2K