form 1 topics added

This commit is contained in:
2026-07-05 11:12:45 -04:00
parent a614532810
commit a23fa53772
58 changed files with 7089 additions and 475 deletions

View File

@@ -3,7 +3,7 @@
import { useState, useCallback } from "react";
import { Card } from "@/components/ui/card";
import { StepControls } from "./step-controls";
import { gcd, lcm, simplify, toKatex } from "@/lib/math/fractions";
import { gcd, lcm, toKatex, Fraction } from "@/lib/math/fractions";
import { MathDisplay } from "@/components/math/math-display";
type Operation = "add" | "subtract" | "multiply" | "divide";
@@ -68,7 +68,7 @@ function buildSteps(
});
// Step 4: Simplify if needed
const [sn, sd] = simplify(resultNum, lcd);
const { n: sn, d: sd } = new Fraction(resultNum, lcd).simplified();
if (Math.abs(sn) !== Math.abs(resultNum) || sd !== lcd) {
const g = gcd(Math.abs(resultNum), lcd);
steps.push({
@@ -92,7 +92,7 @@ function buildSteps(
});
// Step 2: Simplify
const [sn, sd] = simplify(rn, rd);
const { n: sn, d: sd } = new Fraction(rn, rd).simplified();
if (sn !== rn || sd !== rd) {
const g = gcd(Math.abs(rn), rd);
steps.push({
@@ -122,7 +122,7 @@ function buildSteps(
barResult: { filled: rn, total: rd },
});
const [sn, sd] = simplify(rn, rd);
const { n: sn, d: sd } = new Fraction(rn, rd).simplified();
if (sn !== rn || sd !== rd) {
const g = gcd(Math.abs(rn), rd);
steps.push({