Inequality Number Line Calculator

Inequality Number Line Calculator & Guide – Understand Solutions Visually :root { –primary-color: #004a99; –success-color: #28a745; –background-color: #f8f9fa; –text-color: #333; –card-background: #fff; –border-color: #dee2e6; –shadow-color: rgba(0, 0, 0, 0.1); } body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: var(–background-color); color: var(–text-color); line-height: 1.6; margin: 0; padding: 0; } .container { max-width: 960px; margin: 20px auto; padding: 0 15px; background-color: var(–card-background); border-radius: 8px; box-shadow: 0 4px 15px var(–shadow-color); } header { background-color: var(–primary-color); color: #fff; padding: 20px; text-align: center; border-radius: 8px 8px 0 0; } header h1 { margin: 0; font-size: 2.2em; } h2, h3 { color: var(–primary-color); margin-top: 1.5em; margin-bottom: 0.5em; } .calculator-wrapper { padding: 25px; border-bottom: 1px solid var(–border-color); } .calculator-wrapper:last-child { border-bottom: none; } .input-group { margin-bottom: 20px; } .input-group label { display: block; margin-bottom: 8px; font-weight: bold; color: var(–primary-color); } .input-group input[type="number"], .input-group select { width: calc(100% – 16px); padding: 10px; border: 1px solid var(–border-color); border-radius: 4px; box-sizing: border-box; font-size: 1em; } .input-group small { display: block; margin-top: 5px; font-size: 0.9em; color: #6c757d; } .error-message { color: #dc3545; font-size: 0.9em; margin-top: 5px; display: none; /* Hidden by default */ } .button-group { display: flex; gap: 10px; margin-top: 25px; flex-wrap: wrap; /* Allow wrapping on mobile */ } .button-group button { padding: 12px 20px; border: none; border-radius: 5px; cursor: pointer; font-size: 1em; font-weight: bold; transition: background-color 0.3s ease; flex: 1; /* Distribute space */ min-width: 150px; /* Minimum width for buttons */ } .calculate-btn { background-color: var(–primary-color); color: white; } .calculate-btn:hover { background-color: #003366; } .reset-btn { background-color: #6c757d; color: white; } .reset-btn:hover { background-color: #5a6268; } .copy-btn { background-color: var(–success-color); color: white; } .copy-btn:hover { background-color: #218838; } #results { margin-top: 30px; padding: 20px; background-color: #e9ecef; border-radius: 5px; border-left: 5px solid var(–primary-color); text-align: center; } #results h3 { margin-top: 0; color: var(–primary-color); } #main-result { font-size: 2.5em; font-weight: bold; color: var(–primary-color); margin: 10px 0; padding: 10px; background-color: #fff; border-radius: 5px; display: inline-block; /* For background to fit text */ min-width: 100px; } .intermediate-results { margin-top: 20px; font-size: 1.1em; color: #495057; } .intermediate-results p { margin-bottom: 8px; } .formula-explanation { margin-top: 20px; font-size: 0.95em; color: #495057; border-top: 1px dashed var(–border-color); padding-top: 15px; } .formula-explanation strong { color: var(–primary-color); } table { width: 100%; border-collapse: collapse; margin-top: 20px; box-shadow: 0 2px 8px var(–shadow-color); } caption { font-size: 1.2em; font-weight: bold; color: var(–primary-color); margin-bottom: 10px; text-align: left; } th, td { padding: 12px 15px; text-align: center; border: 1px solid var(–border-color); } thead th { background-color: var(–primary-color); color: white; font-weight: bold; } tbody tr:nth-child(even) { background-color: #f2f2f2; } .chart-container { text-align: center; margin-top: 30px; padding: 20px; background-color: var(–card-background); border-radius: 5px; box-shadow: 0 2px 8px var(–shadow-color); } .chart-container canvas { max-width: 100%; height: auto; } .chart-caption { font-size: 1em; color: #6c757d; margin-top: 10px; } article { padding: 25px; background-color: var(–card-background); margin-top: 20px; border-radius: 5px; box-shadow: 0 2px 8px var(–shadow-color); } article p, article ul, article ol { margin-bottom: 1.2em; } article ul, article ol { padding-left: 25px; } article li { margin-bottom: 0.8em; } article strong { color: var(–primary-color); } footer { text-align: center; padding: 20px; margin-top: 30px; font-size: 0.9em; color: #6c757d; } #results-copy-message { display: none; margin-top: 10px; color: var(–success-color); font-weight: bold; } /* Table responsiveness */ .table-wrapper { overflow-x: auto; margin-top: 20px; margin-bottom: 20px; -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */ border: 1px solid var(–border-color); /* Add a border to the scrollable area */ border-radius: 5px; } table { min-width: 600px; /* Ensure table has a minimum width for scrolling */ width: 100%; /* Take available width within the scrollable div */ } /* Mobile specific adjustments */ @media (max-width: 768px) { .container { margin: 10px auto; padding: 0 10px; } header { padding: 15px; } header h1 { font-size: 1.8em; } .calculator-wrapper, article { padding: 15px; } .button-group { flex-direction: column; /* Stack buttons vertically */ gap: 10px; } .button-group button { width: 100%; /* Full width buttons on mobile */ min-width: unset; } #main-result { font-size: 2em; } th, td { padding: 10px 8px; font-size: 0.9em; } caption { font-size: 1.1em; } }

Inequality Number Line Calculator

Visualize and understand the solution sets of inequalities.

Inequality Number Line Calculator

Enter the variable used in your inequality (e.g., x).
Please enter a valid variable name.
> (Greater Than) < (Less Than) ≥ (Greater Than or Equal To) ≤ (Less Than or Equal To) = ≠ Select the comparison operator for your inequality.
Enter the number on the right side of the inequality.
Please enter a valid number.
The minimum value to display on the number line.
Please enter a valid number.
The maximum value to display on the number line.
Please enter a valid number.
Results copied successfully!

Your Inequality Solution

Inequality:

Operator:

Boundary Value:

Formula: The calculator visually represents the inequality $variable \ operation \ boundaryValue$. It highlights the boundary value with an open or closed circle depending on the operator (strict inequalities " use an open circle; inclusive inequalities '≤', '≥' use a closed circle). The solution set is shaded to the left or right of the boundary value.

Inequality Representation Table

Symbol Meaning Number Line Point Shading Direction
> Greater Than Open Circle (O) Right
< Less Than Open Circle (O) Left
Greater Than or Equal To Closed Circle (●) Right
Less Than or Equal To Closed Circle (●) Left
= Equal To Closed Circle (●) Single Point
Not Equal To Open Circle (O) Both Sides (Excluding Point)

Visual Representation: Number Line Chart

This chart visualizes the solution set of your inequality on a number line, showing the boundary value and the range of solutions.

What is an Inequality Number Line Calculator?

An inequality number line calculator is a digital tool designed to help users visualize the solution set of mathematical inequalities. Instead of just solving an inequality algebraically, this calculator provides a graphical representation on a number line. This visual aid is crucial for understanding which numbers satisfy a given inequality. It transforms abstract mathematical expressions into concrete, perceivable segments on a line, making complex concepts accessible to students and educators alike. Whether you're dealing with simple linear inequalities or preparing for more advanced algebraic concepts, mastering the visual representation is a key skill.

Who should use it: This calculator is invaluable for middle school and high school students learning algebra, individuals preparing for standardized tests like the SAT or ACT, educators seeking to demonstrate inequality concepts, and anyone who wants a quick, visual way to check their understanding of inequality solutions. It's also useful for those who find visual learning more intuitive.

Common misconceptions: A frequent misunderstanding is confusing the symbols '>' and '<' with '≥' and '≤'. Users might forget to use an open circle for strict inequalities and a closed circle for inclusive ones, or they might shade the wrong side of the number line. Another misconception is assuming an inequality only has one solution; in reality, most inequalities represent an infinite set of numbers, visualized as a ray or a combination of rays on the number line. Some also struggle with inequalities involving negative numbers or fractions.

Inequality Number Line Calculator: Formula and Mathematical Explanation

The core of the inequality number line calculator lies in its ability to translate an algebraic inequality into a graphical representation. The basic form of a linear inequality is:

variable operator boundaryValue

For example, the inequality $x > 5$ means "all numbers $x$ that are strictly greater than 5".

Step-by-step derivation:

  1. Identify the Variable: This is the symbol representing an unknown number (e.g., $x$, $y$, $a$).
  2. Identify the Operator: This symbol dictates the relationship between the variable and the boundary value (e.g., >, <, ≥, ≤, =, ≠).
  3. Identify the Boundary Value: This is the specific number the variable is being compared against.
  4. Determine the Point on the Number Line: Locate the boundary value on the number line.
  5. Determine the Type of Endpoint:
    • For strict inequalities ('>', '<'), use an open circle (O) at the boundary value. This signifies that the boundary value itself is NOT part of the solution set.
    • For inclusive inequalities ('≥', '≤'), use a closed circle (●) or a filled dot at the boundary value. This signifies that the boundary value IS included in the solution set.
    • For equality ('='), a closed circle is used.
    • For inequality ('≠'), an open circle is used, but the shading extends to both sides.
  6. Determine the Shading Direction:
    • For '>' and '≥', the solution set includes all numbers to the right of the boundary value. Shade the number line to the right.
    • For '<' and '≤', the solution set includes all numbers to the left of the boundary value. Shade the number line to the left.
    • For '≠', shade both the left and right sides, excluding the boundary point itself.

The calculator automates these steps, plotting the boundary point and shading the appropriate region to visually represent the infinite set of numbers that satisfy the inequality.

Variables Table:

Variable Meaning Unit Typical Range
Variable Name The symbol representing the unknown number. N/A (Symbolic) Any valid algebraic symbol (e.g., x, y, a, z)
Operator The comparison symbol defining the relationship. N/A (Symbolic) >, <, ≥, ≤, =, ≠
Boundary Value The numerical threshold for the inequality. Numeric (can be integer, decimal, fraction) Real numbers (-∞ to +∞)
Chart Range Min The minimum value displayed on the visual number line. Numeric Typically a negative value (e.g., -10, -20)
Chart Range Max The maximum value displayed on the visual number line. Numeric Typically a positive value (e.g., 10, 20)

Practical Examples (Real-World Use Cases)

Understanding inequalities is fundamental in various mathematical and real-world scenarios. Here are a couple of examples:

  1. Scenario: Test Scores

    A student needs an average score of at least 80 on three tests to pass the course. Their scores on the first two tests were 75 and 85. What score must they get on the third test?

    Inputs for Calculator:

    • Variable: $s$ (for score)
    • Operator: ≥ (at least)
    • Boundary Value: 80

    Calculation (Algebraic): Let $s$ be the score on the third test. The average is $(75 + 85 + s) / 3$. We need $(160 + s) / 3 \ge 80$. Multiplying by 3: $160 + s \ge 240$. Subtracting 160: $s \ge 80$.

    Calculator Output & Interpretation: The calculator would show the inequality $s \ge 80$. This means the student must score 80 or higher on the third test to achieve an average of at least 80.

  2. Scenario: Budgeting for Groceries

    Sarah wants to spend no more than $150 on groceries this week. She has already spent $110. How much more can she spend?

    Inputs for Calculator:

    • Variable: $m$ (for money remaining)
    • Operator: ≤ (no more than)
    • Boundary Value: 40 (calculated as $150 – 110$)

    Calculation (Algebraic): Let $m$ be the additional money she can spend. Her total spending will be $110 + m$. This must be less than or equal to $150. So, $110 + m \le 150$. Subtracting 110: $m \le 40$.

    Calculator Output & Interpretation: The calculator would display $m \le 40$. This indicates that Sarah can spend $40 or less on the remaining groceries to stay within her $150 budget.

How to Use This Inequality Number Line Calculator

Using the inequality number line calculator is straightforward. Follow these steps to get a clear visual representation of your inequality:

  1. Enter the Variable: In the "Variable" field, type the variable used in your inequality (e.g., 'x', 'y').
  2. Select the Operator: Choose the correct comparison operator from the dropdown list (e.g., '>', '<', '≥', '≤', '=', '≠').
  3. Input the Boundary Value: Enter the number that the variable is being compared against.
  4. Set the Chart Display Range: Adjust the "Chart Display Range (Min)" and "Chart Display Range (Max)" values to define the portion of the number line you want to visualize. This helps focus on the relevant area around the boundary value.
  5. Click "Visualize Inequality": Press the button to generate the number line representation.
  6. Read the Results:
    • Main Result: The primary display shows the inequality in its solved form.
    • Inequality Representation Table: This table summarizes how different operators correspond to specific symbols (open/closed circles) and shading directions.
    • Number Line Chart: This canvas shows a visual number line. A point (open or closed circle) marks the boundary value, and the shaded region indicates the solution set.
  7. Use the "Reset" Button: If you need to start over or clear the current inputs, click "Reset" to return to default values.
  8. Use the "Copy Results" Button: Copy the main result, intermediate values, and the inequality expression for use elsewhere.

Decision-Making Guidance: The visual output helps you quickly determine if a specific number is a solution. If a number falls within the shaded region (and respects the open/closed circle rule), it satisfies the inequality. This tool is excellent for confirming solutions obtained through algebraic manipulation or for exploring the behavior of different inequalities.

Key Factors That Affect Inequality Results

While the inequality number line calculator provides a direct visual, several underlying mathematical and contextual factors influence how inequalities are formed and interpreted:

  1. The Operator's Nature: The choice between strict (>, <) and inclusive (≥, ≤) operators is paramount. This single change dictates whether the boundary value itself is part of the solution set, visually represented by an open versus a closed circle.
  2. The Boundary Value: The magnitude and sign of the boundary value directly determine the position of the endpoint on the number line. Inequalities involving negative boundary values require careful attention to the number line's structure.
  3. Operations Performed (Algebraic Context): If the inequality needs simplification (e.g., solving $2x + 5 < 11$), the operations performed affect the final boundary value and the direction of the inequality. Crucially, multiplying or dividing both sides by a negative number reverses the inequality sign. This is a common pitfall not directly handled by the visualization calculator but critical in the algebraic process leading to it.
  4. Variable Type: While this calculator assumes a single real variable, inequalities can involve multiple variables (leading to regions in a coordinate plane) or be restricted to integers (requiring discrete points on the number line).
  5. Contextual Constraints: In real-world problems, variables often have inherent constraints. For instance, a quantity cannot be negative (e.g., length, time). These real-world limitations might further restrict the solution set shown on the number line, even if the algebraic inequality allows for negative values. Always consider if the mathematical solution makes sense in the problem's context.
  6. Graphing Range: The selected minimum and maximum values for the chart's display range significantly impact how clearly the solution is visualized. If the range is too narrow or too wide, it might obscure the critical details around the boundary value. A well-chosen range ensures the endpoint and the direction of shading are easily discernible.

Frequently Asked Questions (FAQ)

Q1: What is the difference between '>' and '≥' on a number line?
A: The '>' symbol represents "greater than" and uses an open circle (O) at the boundary value because the value itself is NOT included in the solution. The '≥' symbol represents "greater than or equal to" and uses a closed circle (●) because the boundary value IS included in the solution.
Q2: How do I represent $x \ne 5$ on a number line?
A: For $x \ne 5$, you place an open circle at 5 on the number line. Then, you shade the number line to the *left* of 5 AND to the *right* of 5, indicating that all numbers except 5 are solutions.
Q3: What if the inequality involves fractions, like $x/2 > 3$?
A: First, solve the inequality algebraically. To solve $x/2 > 3$, multiply both sides by 2: $x > 6$. The calculator then takes $x$ as the variable, '>' as the operator, and 6 as the boundary value to visualize $x > 6$.
Q4: Can this calculator handle compound inequalities like $2 < x < 5$?
A: This specific calculator is designed for single inequalities. For compound inequalities like $2 < x 2$ and $x < 5$ on the same number line and finding the overlapping region (the segment between 2 and 5, excluding the endpoints).
Q5: Why is the number line shaded to the right for '>'?
A: Numbers to the right of any given number on a number line are always larger (greater). So, for $x > 5$, we shade to the right because numbers like 6, 7, 100 are all greater than 5.
Q6: My chart range is too small/large. How do I fix it?
A: Adjust the "Chart Display Range (Min)" and "Chart Display Range (Max)" input fields. Choose a range that comfortably includes your boundary value and shows the shaded region clearly. For example, if your boundary value is 100, a range of -10 to 10 would be insufficient; try 50 to 150 instead.
Q7: Does the calculator handle inequalities with variables on both sides, like $3x + 1 < x + 7$?
A: This calculator visualizes a *pre-solved* inequality. To use it for $3x + 1 < x + 7$, you must first solve it algebraically: $3x – x < 7 – 1 \implies 2x < 6 \implies x < 3$. Then, you would input $x$, '<', and 3 into the calculator.
Q8: Can this calculator be used for inequalities in two variables (e.g., $y > 2x + 1$)?
A: No, this calculator is specifically for single-variable inequalities represented on a one-dimensional number line. Inequalities with two variables represent regions in a two-dimensional plane and require graphing tools for coordinate planes.

Related Tools and Internal Resources

Explore these related tools and resources to deepen your understanding of mathematical concepts:

© 2023 Your Website Name. All rights reserved.

function getElement(id) { return document.getElementById(id); } function formatOperator(op) { var symbols = { 'gt': '>', 'lt': '<', 'gte': '≥', 'lte': '≤', 'eq': '=', 'neq': '≠' }; return symbols[op] || op; } function isValidNumber(value) { return !isNaN(parseFloat(value)) && isFinite(value); } function validateInput(id, errorId, minValue, maxValue) { var input = getElement(id); var error = getElement(errorId); var value = input.value.trim(); var isValid = true; if (value === "") { error.textContent = "This field cannot be empty."; error.style.display = "block"; isValid = false; } else { var numValue = parseFloat(value); if (isNaN(numValue)) { error.textContent = "Please enter a valid number."; error.style.display = "block"; isValid = false; } else { if (minValue !== undefined && numValue maxValue) { error.textContent = "Value must be no more than " + maxValue + "."; error.style.display = "block"; isValid = false; } else { error.style.display = "none"; } } } return isValid; } function validateVariableName(id, errorId) { var input = getElement(id); var error = getElement(errorId); var value = input.value.trim(); var isValid = true; if (value === "") { error.textContent = "Variable name cannot be empty."; error.style.display = "block"; isValid = false; } else if (!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(value)) { error.textContent = "Variable name must start with a letter or underscore, and contain only letters, numbers, or underscores."; error.style.display = "block"; isValid = false; } else { error.style.display = "none"; } return isValid; } function calculateInequality() { var variable = getElement("variable").value.trim(); var operation = getElement("operation").value; var boundaryValue = getElement("boundaryValue").value; var chartRangeMin = getElement("chartRangeMin").value; var chartRangeMax = getElement("chartRangeMax").value; var isValidVariable = validateVariableName("variable", "variable-error"); var isValidBoundary = validateInput("boundaryValue", "boundaryValue-error"); var isValidRangeMin = validateInput("chartRangeMin", "chartRangeMin-error"); var isValidRangeMax = validateInput("chartRangeMax", "chartRangeMax-error"); if (!isValidVariable || !isValidBoundary || !isValidRangeMin || !isValidRangeMax) { return; } var numBoundaryValue = parseFloat(boundaryValue); var numChartRangeMin = parseFloat(chartRangeMin); var numChartRangeMax = parseFloat(chartRangeMax); if (numChartRangeMin >= numChartRangeMax) { getElement("chartRangeMax-error").textContent = "Max value must be greater than Min value."; getElement("chartRangeMax-error").style.display = "block"; return; } else { getElement("chartRangeMax-error").style.display = "none"; } var formattedOp = formatOperator(operation); var displayInequality = variable + " " + formattedOp + " " + numBoundaryValue; getElement("displayInequality").innerHTML = displayInequality; getElement("displayOperator").textContent = formattedOp; getElement("displayBoundaryValue").textContent = numBoundaryValue; var mainResultText = displayInequality; getElement("main-result").innerHTML = mainResultText; updateChart(variable, operation, numBoundaryValue, numChartRangeMin, numChartRangeMax); } function updateChart(variable, operation, boundaryValue, rangeMin, rangeMax) { var canvas = getElement('numberLineChart'); var ctx = canvas.getContext('2d'); var chartWidth = canvas.parentNode.offsetWidth; var chartHeight = 150; canvas.width = chartWidth; canvas.height = chartHeight; ctx.clearRect(0, 0, canvas.width, canvas.height); ctx.fillStyle = '#fff'; ctx.fillRect(0, 0, canvas.width, canvas.height); var scale = (rangeMax – rangeMin) / (chartWidth – 50); // Adjusting for padding // Draw Number Line ctx.beginPath(); ctx.moveTo(25, chartHeight / 2); ctx.lineTo(chartWidth – 25, chartHeight / 2); ctx.strokeStyle = '#333'; ctx.lineWidth = 2; ctx.stroke(); // Draw Ticks and Labels var tickCount = 10; var tickInterval = (rangeMax – rangeMin) / tickCount; for (var i = 0; i <= tickCount; i++) { var value = rangeMin + i * tickInterval; var xPos = 25 + (value – rangeMin) / scale; // Draw tick mark ctx.beginPath(); ctx.moveTo(xPos, chartHeight / 2 – 5); ctx.lineTo(xPos, chartHeight / 2 + 5); ctx.stroke(); // Draw label ctx.font = '12px Arial'; ctx.fillStyle = '#333'; ctx.textAlign = 'center'; ctx.fillText(value.toFixed(1), xPos, chartHeight / 2 + 20); } // Calculate position of boundaryValue var boundaryX = 25 + (boundaryValue – rangeMin) / scale; // Draw Endpoint Circle var radius = 8; ctx.lineWidth = 2; ctx.strokeStyle = var(–primary-color); if (operation === 'gte' || operation === 'lte' || operation === 'eq') { ctx.fillStyle = var(–primary-color); // Closed circle ctx.beginPath(); ctx.arc(boundaryX, chartHeight / 2, radius, 0, Math.PI * 2); ctx.fill(); ctx.stroke(); } else { ctx.fillStyle = '#fff'; // Open circle ctx.beginPath(); ctx.arc(boundaryX, chartHeight / 2, radius, 0, Math.PI * 2); ctx.fill(); ctx.stroke(); } // Draw Arrow / Shading ctx.fillStyle = 'rgba(0, 74, 153, 0.3)'; // Primary color, semi-transparent ctx.lineWidth = 1; ctx.strokeStyle = var(–primary-color); ctx.font = '14px Arial'; ctx.textAlign = 'center'; if (operation === 'gt' || operation === 'gte') { // Shade right if (boundaryX 25) { ctx.beginPath(); ctx.moveTo(boundaryX, chartHeight / 2); ctx.lineTo(25, chartHeight / 2); ctx.lineTo(25, chartHeight / 2 + 15); ctx.lineTo(boundaryX, chartHeight / 2 + 15); ctx.closePath(); ctx.fill(); ctx.stroke(); } // Draw arrow head if shading goes to infinity ctx.beginPath(); ctx.moveTo(25, chartHeight / 2); ctx.lineTo(35, chartHeight / 2 – 7); ctx.lineTo(35, chartHeight / 2 + 7); ctx.closePath(); ctx.fill(); } else if (operation === 'neq') { // Shade both sides // Shade left if (boundaryX > 25) { ctx.beginPath(); ctx.moveTo(boundaryX, chartHeight / 2); ctx.lineTo(25, chartHeight / 2); ctx.lineTo(25, chartHeight / 2 + 15); ctx.lineTo(boundaryX, chartHeight / 2 + 15); ctx.closePath(); ctx.fill(); ctx.stroke(); } // Shade right if (boundaryX < chartWidth – 25) { ctx.beginPath(); ctx.moveTo(boundaryX, chartHeight / 2); ctx.lineTo(chartWidth – 25, chartHeight / 2); ctx.lineTo(chartWidth – 25, chartHeight / 2 + 15); ctx.lineTo(boundaryX, chartHeight / 2 + 15); ctx.closePath(); ctx.fill(); ctx.stroke(); } // Draw arrow heads for NEQ ctx.beginPath(); ctx.moveTo(25, chartHeight / 2); ctx.lineTo(35, chartHeight / 2 – 7); ctx.lineTo(35, chartHeight / 2 + 7); ctx.closePath(); ctx.fill(); ctx.beginPath(); ctx.moveTo(chartWidth – 25, chartHeight / 2); ctx.lineTo(chartWidth – 35, chartHeight / 2 – 7); ctx.lineTo(chartWidth – 35, chartHeight / 2 + 7); ctx.closePath(); ctx.fill(); } // Label the boundary value near the circle ctx.fillStyle = '#000'; ctx.fillText(boundaryValue.toString(), boundaryX, chartHeight / 2 – 30); } function resetCalculator() { getElement("variable").value = "x"; getElement("operation").value = "gt"; getElement("boundaryValue").value = "5"; getElement("chartRangeMin").value = "-10"; getElement("chartRangeMax").value = "10"; getElement("variable-error").style.display = "none"; getElement("boundaryValue-error").style.display = "none"; getElement("chartRangeMin-error").style.display = "none"; getElement("chartRangeMax-error").style.display = "none"; getElement("displayInequality").textContent = "–"; getElement("displayOperator").textContent = "–"; getElement("displayBoundaryValue").textContent = "–"; getElement("main-result").textContent = "–"; var canvas = getElement('numberLineChart'); var ctx = canvas.getContext('2d'); ctx.clearRect(0, 0, canvas.width, canvas.height); getElement("results-copy-message").style.display = "none"; } function copyResults() { var inequality = getElement("displayInequality").textContent; var operator = getElement("displayOperator").textContent; var boundaryValue = getElement("displayBoundaryValue").textContent; var mainResult = getElement("main-result").textContent; if (inequality === "–") { alert("No results to copy yet. Please calculate first."); return; } var textToCopy = "Inequality: " + inequality + "\n" + "Operator: " + operator + "\n" + "Boundary Value: " + boundaryValue + "\n" + "Visual Representation: " + mainResult; navigator.clipboard.writeText(textToCopy).then(function() { var message = getElement("results-copy-message"); message.style.display = "block"; setTimeout(function() { message.style.display = "none"; }, 3000); }).catch(function(err) { console.error('Failed to copy text: ', err); alert('Failed to copy results. Please try manually.'); }); } // Initial calculation on load document.addEventListener('DOMContentLoaded', function() { calculateInequality(); // Set default CSS variables from inline styles for chart context var root = document.documentElement; root.style.setProperty('–primary-color', '#004a99'); root.style.setProperty('–success-color', '#28a745'); root.style.setProperty('–background-color', '#f8f9fa'); root.style.setProperty('–text-color', '#333'); root.style.setProperty('–card-background', '#fff'); root.style.setProperty('–border-color', '#dee2e6'); root.style.setProperty('–shadow-color', 'rgba(0, 0, 0, 0.1)'); });

Leave a Comment