From 5ba9e81454f34ea7eaa71bc67b19eb7b72dec08c Mon Sep 17 00:00:00 2001 From: Dhairya Date: Sat, 21 Feb 2026 18:50:25 +0530 Subject: [PATCH 1/4] Fix : Graphing_Calculator --- web/templates/graphing_calculator.html | 47 ++++++++++++++++++++------ 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/web/templates/graphing_calculator.html b/web/templates/graphing_calculator.html index fd7efb2cb..d9468a48d 100644 --- a/web/templates/graphing_calculator.html +++ b/web/templates/graphing_calculator.html @@ -315,9 +315,9 @@

SettingsSettingsSettings (canvas.height / scale)) { + firstPoint = true; + } + prevY = y; const { x: cx, y: cy @@ -373,7 +379,7 @@

SettingsSettings 0) index |= 8; if (index === 0 || index === 15) continue; let points = []; - if ((index & 1) !== (index & 2)) { + const b1 = v1 > 0; + const b2 = v2 > 0; + const b3 = v3 > 0; + const b4 = v4 > 0; + if (b1 !== b2) { points.push(interpolate({ x: i, y: j @@ -425,7 +435,7 @@

SettingsSettingsSettingsSettings 0) { + hasYVariable = true; + } + } catch (err) {} + + if (hasYVariable) { + alert("Invalid implicit equation format."); + } else { + plotExplicit("y=" + equation, color); + } } } From 31bf40658967a73584e490982e7c18e410bdfb4d Mon Sep 17 00:00:00 2001 From: Dhairya Date: Mon, 16 Mar 2026 12:59:39 +0530 Subject: [PATCH 2/4] Fix graphing calculator minor errors --- web/templates/graphing_calculator.html | 44 ++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/web/templates/graphing_calculator.html b/web/templates/graphing_calculator.html index d9468a48d..6ca5f7ee7 100644 --- a/web/templates/graphing_calculator.html +++ b/web/templates/graphing_calculator.html @@ -1,6 +1,8 @@ {% extends "base.html" %} -{% block title %}Graphing Calculator{% endblock %} +{% block title %} + Graphing Calculator +{% endblock title %} {% block content %}
@@ -319,11 +321,20 @@

Settings n.isSymbolNode && n.name.toLowerCase() === "y"); + if (yNodes.length > 0) { + alert("Explicit equations cannot reference 'y' on the right-hand side."); + return; + } + } catch (err) {} let compiled; try { compiled = math.compile(exprStr); } catch (err) { - alert("Error in equation: " + err); + alert("Error in equation: " + err.message); return; } ctx.strokeStyle = color; @@ -342,10 +353,12 @@

SettingsSettingsSettingsSettingsSettingsSettings -{% endblock %} +{% endblock content %} From 03450bb9b0d7f2de2b598538b57d33195f63acab Mon Sep 17 00:00:00 2001 From: Dhairya Date: Mon, 16 Mar 2026 13:25:10 +0530 Subject: [PATCH 3/4] Resolve conversations --- web/templates/graphing_calculator.html | 41 ++++++++++++++++---------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/web/templates/graphing_calculator.html b/web/templates/graphing_calculator.html index 6ca5f7ee7..6c2b15691 100644 --- a/web/templates/graphing_calculator.html +++ b/web/templates/graphing_calculator.html @@ -158,7 +158,9 @@

SettingsSettings 0 ? 0.9 : 1.1; - const newScale = scale * zoomFactor; - origin.x = mouseX - mousePos.x * newScale; - origin.y = mouseY + mousePos.y * newScale; - scale = newScale; + baseScale *= zoomFactor; + scale = baseScale * gridDensity; + origin.x = mouseX - mousePos.x * scale; + origin.y = mouseY + mousePos.y * scale; redraw(); }); @@ -329,7 +331,9 @@

SettingsSettings 0) { hasYVariable = true; } - } catch (err) {} + } catch (err) { + console.error("[plotEquation] Failed to parse expression:", equation, err); + hasYVariable = true; // treat parse failure as invalid to prevent falling through to plotExplicit + } if (hasYVariable) { alert("Invalid implicit equation format."); @@ -612,19 +619,26 @@

SettingsSettings Date: Mon, 16 Mar 2026 13:39:40 +0530 Subject: [PATCH 4/4] Resolve conversations --- web/templates/graphing_calculator.html | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/web/templates/graphing_calculator.html b/web/templates/graphing_calculator.html index 6c2b15691..ece82c021 100644 --- a/web/templates/graphing_calculator.html +++ b/web/templates/graphing_calculator.html @@ -161,6 +161,8 @@

SettingsSettings 0 ? 0.9 : 1.1; - baseScale *= zoomFactor; + baseScale = Math.min(MAX_SCALE, Math.max(MIN_SCALE, baseScale * zoomFactor)); scale = baseScale * gridDensity; origin.x = mouseX - mousePos.x * scale; origin.y = mouseY + mousePos.y * scale; @@ -321,7 +323,12 @@

SettingsSettings