Re: square roots
[Prev][Next][Index][Thread]
Re: square roots
Trying to compute the square root of A, using rational operations:
Take a guess at Sqrt(A) and call it X0. Divide X0 into A and let Q be the
quotient. If X0 is an accurate guess, X0 = Q, otherwise, just average X0 and
Q (X0 + Q)/2 for the next estimate, your new X0. Continue until X0 and Q are
very close.
Below is pseudocode for this algorithm.
Input A
Input X0
Q=A/X0
While X0<>Q
X0 =(X0+Q)/2
Q=A/X0
End While
Print X0
Scott
----------
From: Open discussion of TI Graphing Calculators on behalf of ilya winham
Sent: Monday, August 04, 1997 9:37 AM
To: CALC-TI@LISTS.PPP.TI.COM
Subject: square roots
Lets say in a program I wanted to find the square root of variable 'A'
where 'A' is a positive number. But I could only use +,-,*,/. So is
there a way to find square roots without using the square root symbol?