এই নিবন্ধে, আমরা কীভাবে মানক বিচ্যুতি গণনা করতে হয় তা বুঝব। প্রমিত বিচ্যুতি হল কতটা ছড়িয়ে পড়া সংখ্যার পরিমাপ। এর প্রতীক সিগমা(σ)। এটি ভিন্নতার বর্গমূল।
মানক বিচ্যুতি ∑(Xi - ų)2 / N এর সূত্র বর্গমূল ব্যবহার করে গণনা করা হয় যেখানে Xi হল অ্যারের উপাদান, ų হল অ্যারের উপাদানগুলির গড়, N হল উপাদানগুলির সংখ্যা, ∑ হল যোগফল প্রতিটি উপাদান।
নীচে একই -
এর একটি প্রদর্শন রয়েছে৷ধরুন আমাদের ইনপুট হল −
Input Array : [ 35.0, 48.0, 60.0, 71.0, 80.0, 95.0, 130.0 ]
কাঙ্ক্ষিত আউটপুট হবে −
Standard Deviation: 29.313227
অ্যালগরিদম
Step 1 - START Step 2 – Declare a double array namely input_array, two doube values namely sum and standard_deviation. Step 3 - Read the required values from the user/ define the values. Step 4 – Compute ∑(Xi - ų)2 / N and store the value in result variable. Step 5 - Display the result Step 6 - Stop
উদাহরণ 1
এখানে, একটি প্রম্পটের উপর ভিত্তি করে ব্যবহারকারী দ্বারা ইনপুট প্রবেশ করানো হচ্ছে।
public class StandardDeviation {
public static void main(String[] args) {
double[] input_array = { 35, 48, 60, 71, 80, 95, 130};
System.out.println("The elements of the array is defined as");
for (double i : input_array) {
System.out.print(i +" ");
}
double sum = 0.0, standard_deviation = 0.0;
int array_length = input_array.length;
for(double temp : input_array) {
sum += temp;
}
double mean = sum/array_length;
for(double temp: input_array) {
standard_deviation += Math.pow(temp - mean, 2);
}
double result = Math.sqrt(standard_deviation/array_length);
System.out.format("\n\nThe Standard Deviation is: %.6f", result);
}
} আউটপুট
The elements of the array is defined as 35.0 48.0 60.0 71.0 80.0 95.0 130.0 The Standard Deviation is: 29.313227
উদাহরণ 2
এখানে, আমরা স্ট্যান্ডার্ড ডেভিয়েশন গণনা করার জন্য একটি ফাংশন সংজ্ঞায়িত করেছি।
public class StandardDeviation {
public static void main(String[] args) {
double[] input_array = { 35, 48, 60, 71, 80, 95, 130};
System.out.println("The elements of the array is defined as");
for (double i : input_array) {
System.out.print(i +" ");
}
double standard_deviation = calculateSD(input_array);
System.out.format("\n\nThe Standard Deviation is: %.6f", standard_deviation);
}
public static double calculateSD(double input_array[]) {
double sum = 0.0, standard_deviation = 0.0;
int array_length = input_array.length;
for(double temp : input_array) {
sum += temp;
}
double mean = sum/array_length;
for(double temp: input_array) {
standard_deviation += Math.pow(temp - mean, 2);
}
return Math.sqrt(standard_deviation/array_length);
}
} আউটপুট
The elements of the array is defined as 35.0 48.0 60.0 71.0 80.0 95.0 130.0 The Standard Deviation is: 29.313227