The Bakhshali manuscript is a mathematical manuscript written on birch bark whic
ID: 1842394 • Letter: T
Question
The Bakhshali manuscript is a mathematical manuscript written on birch bark which was found near the village of Bakhshali in what is now Pakistan in 1881. The scripts are dated around 400 AD. The manuscript gives various algorithms and techniques for variety of mathematical problems, such as computing the squareroot s. According to Bakhshali manuscript, the squareroot of a number s can be approximated as: Square4root s A - P^2/2A, where A = x_OLD + P, P = D/2x_OLD, and D = s - x_OLD^2 where x_OLD is an approximate root Write a MTLAB script M-file to calculate the squareroot of any real number using the Bakshali method.Explanation / Answer
s = input('Enter the number for which square root has to be calculated:');
x_old = input('Enter an approximate value:');
format long
Tol = 1e-15;
sqrt_s_Bakhshali = 0
while abs((sqrt(s)-sqrt_s_Bakhshali))>Tol
D = s - x_old^2;
P = D/(2*x_old);
A = x_old + P;
sqrt_s_Bakhshali = A - P^2/(2*A);
x_old = sqrt_s_Bakhshali
end
sqrt_s_Bakhshali
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.