{"id":1959,"date":"2025-01-25T03:16:46","date_gmt":"2025-01-25T03:16:46","guid":{"rendered":"https:\/\/donhit.com\/en\/?p=1959"},"modified":"2025-02-07T08:29:57","modified_gmt":"2025-02-07T08:29:57","slug":"slope-intercept-form","status":"publish","type":"post","link":"https:\/\/donhit.com\/en\/calculator\/slope-intercept-form\/","title":{"rendered":"Slope Intercept Form Calculator"},"content":{"rendered":"<p><center> <div class=\"glass-morphism p-8 rounded-2xl w-full max-w-2xl shadow-2xl\">\r\n        <h2 class=\"text-3xl font-bold text-center mb-8 text-gray-800\">Slope Intercept Form Calculator<\/h2>\r\n        \r\n        <div class=\"grid grid-cols-2 gap-6\">\r\n            <div class=\"input-group\">\r\n                <label class=\"block text-gray-700 mb-2\">Point 1 (x1, y1)<\/label>\r\n                <div class=\"flex space-x-2\">\r\n                    <input type=\"number\" id=\"x1\" placeholder=\"x1\" class=\"w-1\/2 p-3 border-2 border-blue-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-400\">\r\n                    <input type=\"number\" id=\"y1\" placeholder=\"y1\" class=\"w-1\/2 p-3 border-2 border-blue-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-400\">\r\n                <\/div>\r\n            <\/div>\r\n            \r\n            <div class=\"input-group\">\r\n                <label class=\"block text-gray-700 mb-2\">Point 2 (x2, y2)<\/label>\r\n                <div class=\"flex space-x-2\">\r\n                    <input type=\"number\" id=\"x2\" placeholder=\"x2\" class=\"w-1\/2 p-3 border-2 border-blue-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-400\">\r\n                    <input type=\"number\" id=\"y2\" placeholder=\"y2\" class=\"w-1\/2 p-3 border-2 border-blue-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-400\">\r\n                <\/div>\r\n            <\/div>\r\n        <\/div>\r\n        \r\n        <button onclick=\"calculateSlopeIntercept()\" class=\"btn-calculate w-full p-4 mt-6 text-white rounded-xl uppercase tracking-wider font-semibold\">\r\n            Calculate Equation\r\n        <\/button>\r\n        \r\n        <div id=\"result\" class=\"mt-6 bg-blue-50 p-6 rounded-xl hidden\">\r\n            <div class=\"grid grid-cols-2 gap-4\">\r\n                <div>\r\n                    <h3 class=\"text-xl font-semibold text-blue-700\">Equation<\/h3>\r\n                    <p id=\"equation\" class=\"text-gray-800 text-lg\"><\/p>\r\n                <\/div>\r\n                <div>\r\n                    <h3 class=\"text-xl font-semibold text-blue-700\">Details<\/h3>\r\n                    <p>Slope (m): <span id=\"slope\" class=\"font-bold text-blue-600\"><\/span><\/p>\r\n                    <p>Y-Intercept (b): <span id=\"intercept\" class=\"font-bold text-blue-600\"><\/span><\/p>\r\n                <\/div>\r\n            <\/div>\r\n            <canvas id=\"lineGraph\" class=\"mt-6 w-full h-48\"><\/canvas>\r\n        <\/div>\r\n    <\/div>\r\n\r\n    <script>\r\n        let lineChart = null;\r\n\r\n        function calculateSlopeIntercept() {\r\n            const x1 = parseFloat(document.getElementById('x1').value);\r\n            const y1 = parseFloat(document.getElementById('y1').value);\r\n            const x2 = parseFloat(document.getElementById('x2').value);\r\n            const y2 = parseFloat(document.getElementById('y2').value);\r\n\r\n            if (isNaN(x1) || isNaN(y1) || isNaN(x2) || isNaN(y2)) {\r\n                alert('Please enter valid numbers for all points.');\r\n                return;\r\n            }\r\n\r\n            if (x1 === x2 && y1 === y2) {\r\n                alert('Points must be different to calculate slope.');\r\n                return;\r\n            }\r\n\r\n            const slope = (y2 - y1) \/ (x2 - x1);\r\n            const intercept = y1 - slope * x1;\r\n\r\n            const resultDiv = document.getElementById('result');\r\n            const equationSpan = document.getElementById('equation');\r\n            const slopeSpan = document.getElementById('slope');\r\n            const interceptSpan = document.getElementById('intercept');\r\n\r\n            const slopeSign = slope >= 0 ? '+' : '-';\r\n            const interceptSign = intercept >= 0 ? '+' : '-';\r\n            const formattedEquation = `y = ${slope.toFixed(2)}x ${interceptSign} ${Math.abs(intercept).toFixed(2)}`;\r\n\r\n            equationSpan.textContent = formattedEquation;\r\n            slopeSpan.textContent = slope.toFixed(2);\r\n            interceptSpan.textContent = intercept.toFixed(2);\r\n\r\n            resultDiv.classList.remove('hidden');\r\n            createLineGraph(x1, y1, x2, y2, slope, intercept);\r\n        }\r\n\r\n        function createLineGraph(x1, y1, x2, y2, slope, intercept) {\r\n            const ctx = document.getElementById('lineGraph').getContext('2d');\r\n            \r\n            if (lineChart) {\r\n                lineChart.destroy();\r\n            }\r\n\r\n            const xValues = [x1, x2];\r\n            const yValues = [y1, y2];\r\n\r\n            lineChart = new Chart(ctx, {\r\n                type: 'line',\r\n                data: {\r\n                    datasets: [{\r\n                        label: 'Points',\r\n                        data: xValues.map((x, i) => ({x, y: yValues[i]})),\r\n                        backgroundColor: 'rgba(75, 192, 192, 0.6)',\r\n                        borderColor: 'rgba(75, 192, 192, 1)',\r\n                        pointBackgroundColor: 'blue',\r\n                        pointRadius: 8\r\n                    }, {\r\n                        label: 'Line Equation',\r\n                        data: [\r\n                            {x: Math.min(...xValues) - 2, y: slope * (Math.min(...xValues) - 2) + intercept},\r\n                            {x: Math.max(...xValues) + 2, y: slope * (Math.max(...xValues) + 2) + intercept}\r\n                        ],\r\n                        borderColor: 'rgba(255, 99, 132, 1)',\r\n                        borderWidth: 2,\r\n                        fill: false\r\n                    }]\r\n                },\r\n                options: {\r\n                    responsive: true,\r\n                    scales: {\r\n                        x: { type: 'linear' },\r\n                        y: { type: 'linear' }\r\n                    }\r\n                }\r\n            });\r\n        }\r\n    <\/script><\/center>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;<\/p>\n","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-1959","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>Slope Intercept Form Calculator - DonHit<\/title>\n<meta name=\"description\" content=\"A Slope-Intercept Form Calculator is an online algebra tool designed to simplify the process of solving and analyzing linear equations in the form y = mx + b.\" \/>\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\/slope-intercept-form\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Slope Intercept Form Calculator - DonHit\" \/>\n<meta property=\"og:description\" content=\"A Slope-Intercept Form Calculator is an online algebra tool designed to simplify the process of solving and analyzing linear equations in the form y = mx + b.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/donhit.com\/en\/calculator\/slope-intercept-form\/\" \/>\n<meta property=\"og:site_name\" content=\"DonHit - World of Tools\" \/>\n<meta property=\"article:published_time\" content=\"2025-01-25T03:16:46+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-02-07T08:29:57+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=\"7 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Slope Intercept Form Calculator - DonHit","description":"A Slope-Intercept Form Calculator is an online algebra tool designed to simplify the process of solving and analyzing linear equations in the form y = mx + b.","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\/slope-intercept-form\/","og_locale":"en_US","og_type":"article","og_title":"Slope Intercept Form Calculator - DonHit","og_description":"A Slope-Intercept Form Calculator is an online algebra tool designed to simplify the process of solving and analyzing linear equations in the form y = mx + b.","og_url":"https:\/\/donhit.com\/en\/calculator\/slope-intercept-form\/","og_site_name":"DonHit - World of Tools","article_published_time":"2025-01-25T03:16:46+00:00","article_modified_time":"2025-02-07T08:29:57+00:00","author":"DonHit","twitter_card":"summary_large_image","twitter_misc":{"Written by":"DonHit","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/donhit.com\/en\/calculator\/slope-intercept-form\/#article","isPartOf":{"@id":"https:\/\/donhit.com\/en\/calculator\/slope-intercept-form\/"},"author":{"name":"DonHit","@id":"https:\/\/donhit.com\/en\/#\/schema\/person\/0c6ff7dcd8ba4810c56a532f09c33148"},"headline":"Slope Intercept Form Calculator","datePublished":"2025-01-25T03:16:46+00:00","dateModified":"2025-02-07T08:29:57+00:00","mainEntityOfPage":{"@id":"https:\/\/donhit.com\/en\/calculator\/slope-intercept-form\/"},"wordCount":9,"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\/slope-intercept-form\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/donhit.com\/en\/calculator\/slope-intercept-form\/","url":"https:\/\/donhit.com\/en\/calculator\/slope-intercept-form\/","name":"Slope Intercept Form Calculator - DonHit","isPartOf":{"@id":"https:\/\/donhit.com\/en\/#website"},"datePublished":"2025-01-25T03:16:46+00:00","dateModified":"2025-02-07T08:29:57+00:00","description":"A Slope-Intercept Form Calculator is an online algebra tool designed to simplify the process of solving and analyzing linear equations in the form y = mx + b.","breadcrumb":{"@id":"https:\/\/donhit.com\/en\/calculator\/slope-intercept-form\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/donhit.com\/en\/calculator\/slope-intercept-form\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/donhit.com\/en\/calculator\/slope-intercept-form\/#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":"Slope Intercept Form 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\/1959","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=1959"}],"version-history":[{"count":3,"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/posts\/1959\/revisions"}],"predecessor-version":[{"id":2087,"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/posts\/1959\/revisions\/2087"}],"wp:attachment":[{"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/media?parent=1959"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/categories?post=1959"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/tags?post=1959"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}