{"id":1737,"date":"2024-12-27T16:37:14","date_gmt":"2024-12-27T16:37:14","guid":{"rendered":"https:\/\/donhit.com\/en\/?p=1737"},"modified":"2025-02-06T01:26:00","modified_gmt":"2025-02-06T01:26:00","slug":"standard-deviation","status":"publish","type":"post","link":"https:\/\/donhit.com\/en\/calculator\/standard-deviation\/","title":{"rendered":"Standard Deviation Calculator"},"content":{"rendered":"<p><center>    <div class=\"calculator\">\r\n        <h2>Standard Deviation Calculator<\/h2>\r\n        \r\n        <div class=\"input-group\">\r\n            <label for=\"numbers\">Enter numbers (separated by commas or spaces)<\/label>\r\n            <textarea id=\"numbers\" placeholder=\"Example: 1, 2, 3, 4, 5\"><\/textarea>\r\n        <\/div>\r\n\r\n        <div class=\"button-group\">\r\n            <button class=\"calculate\" onclick=\"calculate()\">Calculate<\/button>\r\n            <button class=\"clear\" onclick=\"clearAll()\">Clear<\/button>\r\n        <\/div>\r\n\r\n        <div class=\"results\">\r\n            <div class=\"result-item\">\r\n                <span class=\"result-label\">Count:<\/span>\r\n                <span class=\"result-value\" id=\"count\">-<\/span>\r\n            <\/div>\r\n            <div class=\"result-item\">\r\n                <span class=\"result-label\">Mean:<\/span>\r\n                <span class=\"result-value\" id=\"mean\">-<\/span>\r\n            <\/div>\r\n            <div class=\"result-item\">\r\n                <span class=\"result-label\">Population SD:<\/span>\r\n                <span class=\"result-value\" id=\"population-sd\">-<\/span>\r\n            <\/div>\r\n            <div class=\"result-item\">\r\n                <span class=\"result-label\">Sample SD:<\/span>\r\n                <span class=\"result-value\" id=\"sample-sd\">-<\/span>\r\n            <\/div>\r\n        <\/div>\r\n        <div id=\"error\" class=\"error\"><\/div>\r\n    <\/div>\r\n\r\n    <script>\r\n        function parseInput(input) {\r\n            \/\/ Remove any whitespace and split by comma or space\r\n            return input.trim()\r\n                .split(\/[\\s,]+\/)\r\n                .filter(x => x !== '')\r\n                .map(x => parseFloat(x))\r\n                .filter(x => !isNaN(x));\r\n        }\r\n\r\n        function calculateMean(numbers) {\r\n            return numbers.reduce((acc, val) => acc + val, 0) \/ numbers.length;\r\n        }\r\n\r\n        function calculateSD(numbers, isSample = false) {\r\n            const mean = calculateMean(numbers);\r\n            const squareDiffs = numbers.map(x => Math.pow(x - mean, 2));\r\n            const avgSquareDiff = squareDiffs.reduce((acc, val) => acc + val, 0) \/ \r\n                (isSample ? (numbers.length - 1) : numbers.length);\r\n            return Math.sqrt(avgSquareDiff);\r\n        }\r\n\r\n        function calculate() {\r\n            const input = document.getElementById('numbers').value;\r\n            const errorElement = document.getElementById('error');\r\n            \r\n            \/\/ Clear previous error\r\n            errorElement.textContent = '';\r\n\r\n            \/\/ Parse input\r\n            const numbers = parseInput(input);\r\n\r\n            \/\/ Validate input\r\n            if (numbers.length === 0) {\r\n                errorElement.textContent = 'Please enter valid numbers';\r\n                return;\r\n            }\r\n\r\n            if (numbers.length === 1) {\r\n                errorElement.textContent = 'Please enter at least two numbers';\r\n                return;\r\n            }\r\n\r\n            \/\/ Calculate statistics\r\n            const mean = calculateMean(numbers);\r\n            const populationSD = calculateSD(numbers, false);\r\n            const sampleSD = calculateSD(numbers, true);\r\n\r\n            \/\/ Update results\r\n            document.getElementById('count').textContent = numbers.length;\r\n            document.getElementById('mean').textContent = mean.toFixed(4);\r\n            document.getElementById('population-sd').textContent = populationSD.toFixed(4);\r\n            document.getElementById('sample-sd').textContent = sampleSD.toFixed(4);\r\n        }\r\n\r\n        function clearAll() {\r\n            document.getElementById('numbers').value = '';\r\n            document.getElementById('count').textContent = '-';\r\n            document.getElementById('mean').textContent = '-';\r\n            document.getElementById('population-sd').textContent = '-';\r\n            document.getElementById('sample-sd').textContent = '-';\r\n            document.getElementById('error').textContent = '';\r\n        }\r\n\r\n        \/\/ Add keyboard support\r\n        document.getElementById('numbers').addEventListener('keydown', function(e) {\r\n            if (e.key === 'Enter' && !e.shiftKey) {\r\n                e.preventDefault();\r\n                calculate();\r\n            }\r\n        });\r\n    <\/script><\/center><\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[184],"tags":[],"class_list":["post-1737","post","type-post","status-publish","format-standard","hentry","category-calculator"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Standard Deviation Calculator - DonHit<\/title>\n<meta name=\"description\" content=\"A standard deviation calculator is a computational tool designed to quickly and accurately calculate the standard deviation of a dataset.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/donhit.com\/en\/calculator\/standard-deviation\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Standard Deviation Calculator - DonHit\" \/>\n<meta property=\"og:description\" content=\"A standard deviation calculator is a computational tool designed to quickly and accurately calculate the standard deviation of a dataset.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/donhit.com\/en\/calculator\/standard-deviation\/\" \/>\n<meta property=\"og:site_name\" content=\"DonHit - World of Tools\" \/>\n<meta property=\"article:published_time\" content=\"2024-12-27T16:37:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-02-06T01:26:00+00:00\" \/>\n<meta name=\"author\" content=\"DonHit\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DonHit\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Standard Deviation Calculator - DonHit","description":"A standard deviation calculator is a computational tool designed to quickly and accurately calculate the standard deviation of a dataset.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/donhit.com\/en\/calculator\/standard-deviation\/","og_locale":"en_US","og_type":"article","og_title":"Standard Deviation Calculator - DonHit","og_description":"A standard deviation calculator is a computational tool designed to quickly and accurately calculate the standard deviation of a dataset.","og_url":"https:\/\/donhit.com\/en\/calculator\/standard-deviation\/","og_site_name":"DonHit - World of Tools","article_published_time":"2024-12-27T16:37:14+00:00","article_modified_time":"2025-02-06T01:26:00+00:00","author":"DonHit","twitter_card":"summary_large_image","twitter_misc":{"Written by":"DonHit","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/donhit.com\/en\/calculator\/standard-deviation\/#article","isPartOf":{"@id":"https:\/\/donhit.com\/en\/calculator\/standard-deviation\/"},"author":{"name":"DonHit","@id":"https:\/\/donhit.com\/en\/#\/schema\/person\/0c6ff7dcd8ba4810c56a532f09c33148"},"headline":"Standard Deviation Calculator","datePublished":"2024-12-27T16:37:14+00:00","dateModified":"2025-02-06T01:26:00+00:00","mainEntityOfPage":{"@id":"https:\/\/donhit.com\/en\/calculator\/standard-deviation\/"},"wordCount":10,"commentCount":0,"publisher":{"@id":"https:\/\/donhit.com\/en\/#\/schema\/person\/0c6ff7dcd8ba4810c56a532f09c33148"},"articleSection":["Calculator"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/donhit.com\/en\/calculator\/standard-deviation\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/donhit.com\/en\/calculator\/standard-deviation\/","url":"https:\/\/donhit.com\/en\/calculator\/standard-deviation\/","name":"Standard Deviation Calculator - DonHit","isPartOf":{"@id":"https:\/\/donhit.com\/en\/#website"},"datePublished":"2024-12-27T16:37:14+00:00","dateModified":"2025-02-06T01:26:00+00:00","description":"A standard deviation calculator is a computational tool designed to quickly and accurately calculate the standard deviation of a dataset.","breadcrumb":{"@id":"https:\/\/donhit.com\/en\/calculator\/standard-deviation\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/donhit.com\/en\/calculator\/standard-deviation\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/donhit.com\/en\/calculator\/standard-deviation\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Trang ch\u1ee7","item":"https:\/\/donhit.com\/en\/"},{"@type":"ListItem","position":2,"name":"Calculator","item":"https:\/\/donhit.com\/en\/category\/calculator\/"},{"@type":"ListItem","position":3,"name":"Standard Deviation Calculator"}]},{"@type":"WebSite","@id":"https:\/\/donhit.com\/en\/#website","url":"https:\/\/donhit.com\/en\/","name":"DonHit - World of tools","description":"","publisher":{"@id":"https:\/\/donhit.com\/en\/#\/schema\/person\/0c6ff7dcd8ba4810c56a532f09c33148"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/donhit.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/donhit.com\/en\/#\/schema\/person\/0c6ff7dcd8ba4810c56a532f09c33148","name":"DonHit","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/donhit.com\/en\/#\/schema\/person\/image\/","url":"https:\/\/donhit.com\/en\/wp-content\/uploads\/2024\/11\/logo-donhit.webp","contentUrl":"https:\/\/donhit.com\/en\/wp-content\/uploads\/2024\/11\/logo-donhit.webp","width":400,"height":267,"caption":"DonHit"},"logo":{"@id":"https:\/\/donhit.com\/en\/#\/schema\/person\/image\/"},"description":"DonHit is a website designed to provide useful tools for everyone. Its primary goal is to support and empower the community. All the tools available on the site are completely free to use.","sameAs":["https:\/\/donhit.com\/en"],"url":"https:\/\/donhit.com\/en\/author\/admin_don\/"}]}},"_links":{"self":[{"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/posts\/1737","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/comments?post=1737"}],"version-history":[{"count":3,"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/posts\/1737\/revisions"}],"predecessor-version":[{"id":2037,"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/posts\/1737\/revisions\/2037"}],"wp:attachment":[{"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/media?parent=1737"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/categories?post=1737"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/tags?post=1737"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}