Sunday, September 12, 2021

Square Root Trick - by @Mathsbook7474

TI-84 Plus CE and TI-Nspire CX II:  Square Root Trick - by @Mathsbook7474


Introduction


From the Instagram account @Mathsbook7474, it is stated that the square root of a number can be approximated by:


√x ≈ (x + y) ÷ (2 · √y)


where y is the number nearest to the root, preferably a perfect square.  (see source for the link)


For example:


Approximate √52.


Let x = 52.  Note that 49 is a perfect square near to 52.   Since √49 = 7, let y = 49.


√52 ≈ (52 + 49) ÷ (2 · √49) = 7.214285714


Accuracy:  0.0031831631   (√52 = 7.211102551)


TI-84 Plus CE Program:  SQAPPROX


The program SQAPPROX will calculate the approximation above, the actual root, and compare the results for the accuracy.  


Listing:


Download the program here:  

TI-Nspire CX II tns File:  square root approximate.py

This document takes it a step further.   The python program will create four lists that are used to display a table, graph the approximate answers, the actual answers, and the error.

Python program:  spapprox.py

from math import *
from ti_system import *

# TI System command clear history
clear_history()

# intro and prompts
# characters use ctrl, [ book ]
print("√x≈(x+y)/(2*√y) @mathsbook7474")
print("For x:")
s0=float(input("start: "))
s1=float(input("stop: "))

# set up columns
col1=[]
col2=[]
col3=[]
col4=[]

for i in range(s0,s1+1):
  col1.append(i)
  w=sqrt(i)
  col2.append(w)
  a=trunc(w)
  b=trunc(w)+1
  c=fabs(a**2-i)
  d=fabs(b**2-i)
  if c<d:
    s=(i+a**2)/(2*a)
  else:
    s=(i+b**2)/(2*b)
  col3.append(s)
  r=fabs(w-s)
  col4.append(r)


# save columns to outside variables
# TI System module used
store_list("data",col1)
store_list("act",col2)
store_list("appr",col3)
store_list("error",col4)

print("data = x")
print("act = actual")
print("appr = approximate")
print("error = absolute error")

Download the file here:


Source:

"Square Root Trick"  @mathsbook7474.  Instagram account.  
June 8, 2021.  Retrieved June 21, 2021.  

Eddie

All original content copyright, © 2011-2021.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 

TI 84 Plus CE: Consolidated Debts

TI 84 Plus CE: Consolidated Debts   Disclaimer: This blog is for informational and academic purposes only. Financial decisions are your ...