Perimeter of the Ellipse (HP-15C)
|
06-04-2021, 07:14 PM
(This post was last modified: 06-04-2021 08:38 PM by Albert Chan.)
Post: #19
|
|||
|
|||
RE: Perimeter of the Ellipse (HP-15C)
Here is Ellipse perimeter, AGM based version, without recursion.
10 DEF FNP(A,B) @ S=A*A+B*B @ T=1 20 REPEAT @ G=B @ K=(A-B)/2 @ B=SQRT(A*B) @ A=A-K @ T=T+T @ S=S-T*K*K @ UNTIL G=B 30 FNP = S/B*PI @ END DEF > FNP(20,1) 80.3885123826 Comment: we can test convergence of S instead. This may reduce loop count by 1. 20 REPEAT @ K=(A-B)/2 @ B=SQRT(A*B) @ A=A-K @ T=T+T @ K=T*K*K @ S=S-K @ UNTIL S=S+K |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)