Hi!
I don't know if this is the correct forum to post this message in but Matlab programming ispretty similar to C.
I'm trying to write a program that calculates the value of pi to 10 decimal places by using 'Archimedes Method'.
Archimedes concluded that:
n*sin(theta/2) < pi < n*tan(theta/2)
(BTW, I can't use pi in my program - kinda defeats the object)
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
1) I believe it's for a particular theta. I don't recall what it was, but that's going to be important.
Areyou taking the biscuit chap?
I come on this forum to learn.
Archimedes used values of theta for which the sin and tan were known. Basicly, you're looking at starting with something like theta=pi/2, and then using half angle formulas to get successively finer values without actually using the sin/tan functions.
Thanks for your reply.
But I cant use theta=pi/2 because that would mean using the value of pi to calculate pi which is off limits.
No, you store pi/2 as a logical value, or pi/4. The key is that you have the exact values of Sin and tan without going through the standard functions. Using pi/4, sin(pi/4) = sqrt(2)/2 and tan(pi/4)=1. Then use the half angle formulas.
How do you mean store them as logical values? How would I use these to get pi to the required accuracy of 10 dp
You need a function that will compute square roots to about 15 decimal places and you're set.
thank you very much for your reply and help
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks