The Bakhshali approximation technique is employed for calculating the square root of a non-negative number. This iterative approach is particularly beneficial in scenarios where exact precision is not a critical factor. Additionally, it proves to be advantageous when working with significant numerical values. The origin of the Bakhshali method can be traced back to the ancient Bakhshali manuscripts, which contained numerous mathematical challenges.
It is primarily utilized for calculating the square roots of non-perfect squares, where the square root is not an integer. This technique is not as effective for determining the square roots of perfect squares. The result obtained is an approximation and may not be completely accurate.
Usage in various fields:
- It is mostly used in mathematical education to solve problems and is helpful in learning other mathematical concepts in classrooms.
- It is used in mathematics number theory for preliminary estimations in algorithms dealing with square roots.
- It is also used in engineering applications for quick approximation.
Steps needed to calculate √(S).
Step 1: Begin by determining the closest perfect square to the value of S, denoted as (N^2).
Step 2: Calculate d = S - (N^2)
Step 3: Calculate P = d/(2*N)
Step 4: Calculate A = N + P
Step 5: The square root of S will be approximately equal to A minus the square of P divided by 2 times A.
Finding the square root of 13 using Bakhshali approximation
Step 1: Initially, determine the closest perfect square to S, represented as N^2.
In this scenario, the closest perfect square to 13 is 9, which equals 3 squared (3^2).
Step 2: Calculate d = S - (N^2). d = 13 - 9 = 4.
Step 3: Calculate P = d/(2N). P = 4/(23) = 2/3.
Step 4: Calculate A = N + P. A = 3 + 2/3 = 11/3.
Calculate the square root of the sum, denoted as √(S), by applying the following mathematical expression: √(S) is approximately equal to A minus (P squared divided by 2 times A).
√(13) ≈ 11/3 - ((2/3)^2 / (2 * 11/3)).
≈ 11/3 - (4/9 / (22/3)).
≈ 11/3 - (4/9 * 3/22).
≈ 11/3 - 1/11.
≈ 121/33 - 3/33.
≈ 118/33.
So, the square root of 13 is roughly equal to 118 divided by 33, which is around 3.57576.
Now, we will translate the aforementioned procedure into a C program.
Example:
Let's consider a C program to demonstrate the Bakhshali method for approximating the square root of a non-negative value.
#include <stdio.h>
#include <math.h>
// Function to calculate the nearest perfect square to a given number
int calculateNearestPerfectSquare(float number) {
int nearestPerfectSquare = 0;
for (int i = (int)number; i > 0; i--) {
for (int j = 1; j < i; j++) {
if (j * j == i) {
nearestPerfectSquare = i;
return nearestPerfectSquare;
}
}
}
return nearestPerfectSquare;
}
// Function to calculate the square root using the Bakhshali approximation method
float calculateSquareRoot(float number, int nearestPerfectSquare) {
float difference = number - nearestPerfectSquare;
float correctionTerm = difference / (2.0 * sqrt(nearestPerfectSquare));
float A = sqrt(nearestPerfectSquare) + correctionTerm;
float sqrt_of_number = A - ((correctionTerm * correctionTerm) / (2.0 * A));
return sqrt_of_number;
}
int main() {
float inputNumber;
printf("Enter a number: ");
scanf("%f", &inputNumber);
printf("Input number: %.4f\n", inputNumber);
int nearestPerfectSquare = calculateNearestPerfectSquare(inputNumber);
printf("Nearest perfect square: %d\n", nearestPerfectSquare);
float squareRoot = calculateSquareRoot(inputNumber, nearestPerfectSquare);
printf("Square root of %.4f = %.5f\n", inputNumber, squareRoot);
return 0;
}
Output:
Enter a number: Input number: %.4f
Nearest perfect square: [value]
Square root of %.4f = %.5f
Explanation:
- This program is used to find the square root of an given number by using the bakhshali method . In this method first the user has to give the number as input. After that, that number is passed to a function named the "calculateNearestPerfectSquare" . This function will return the nearest perfect square possible. Next, the given number and the nearest perfect square are given to another "calculate square root" This function is the final square root answer.
- The CalculateNearestPerfectSquare Function will store the nearest perfect square in a variable. Firstly, it is initialized to zero. After that, we use one nested for loop where the outer loop iterates through the number to zero and the inner loop iterates through the one to the current number. Next, we check whether it is a perfect square or not. If it is a perfect square, we update the variable, and lastly, we return the variable.
- The CalculateSquareRoot Function will take two arguments: one is the original number given by the user, and the other is the nearest perfect square. Here, we will find the difference, correction term, initial approximation, and refined approximation. After that, the final answer is returned.