Post Reply 
Newbie Programming Confusion
08-22-2015, 09:30 PM (This post was last modified: 08-23-2015 10:53 AM by Thomas Klemm.)
Post: #4
RE: Newbie Programming Confusion
You could use double angle formulas for cosine and sine to come up with simpler formulas that lead to this Python program:

Code:
from math import sqrt

c, s = 0.0, 2.0
for i in range(20):
    c = sqrt((1 + c)/2)
    s = s / c
    print s

This short program runs on most older HP-calculators:

Code:
1
+
2
/
SQRT
/
LASTX

Just start with:

2 ENTER
0

And then run the program until you reach 1.
The resulting approximation of \(\pi\) can then be displayed with:

X<>Y


Kind regards
Thomas

PS: I haven't seen that font of the heading in the linked article for a long time.
[Image: index.php?p=refresh&amp;id=8694&...20programs]

We might use it in this forum in titles:
[Image: index.php?p=refresh&amp;id=8694&...%2520Prime]
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Newbie Programming Confusion - smp - 08-22-2015, 06:44 PM
RE: Newbie Programming Confusion - smp - 08-22-2015, 09:35 PM
RE: Newbie Programming Confusion - smp - 08-22-2015, 09:43 PM
RE: Newbie Programming Confusion - Thomas Klemm - 08-22-2015 09:30 PM



User(s) browsing this thread: 1 Guest(s)