diff --git a/frontend/textbooks/algebra_9_ch3.html b/frontend/textbooks/algebra_9_ch3.html
index cb61f9b..a3855e8 100644
--- a/frontend/textbooks/algebra_9_ch3.html
+++ b/frontend/textbooks/algebra_9_ch3.html
@@ -156,6 +156,29 @@ a{color:inherit;text-decoration:none}
.search-empty{padding:20px;text-align:center;color:var(--muted);font-size:.88rem}
.search-foot{padding:8px 14px;border-top:1px solid var(--border);font-size:.74rem;color:var(--muted);display:flex;gap:14px}
.search-foot kbd{padding:2px 6px;background:var(--card);border:1px solid var(--border);border-radius:4px;font-family:'JetBrains Mono',monospace;font-size:.72rem}
+
+.wg{background:linear-gradient(135deg,var(--card),var(--sec-acc-soft,var(--pri-soft)));border:1.5px solid var(--sec-acc,var(--pri));border-radius:14px;padding:18px 20px;margin-bottom:18px;box-shadow:var(--sh2);position:relative;z-index:1}
+.wg-header{display:flex;align-items:center;gap:8px;margin-bottom:14px}
+.wg-badge{padding:4px 9px;background:var(--sec-acc,var(--pri));color:#fff;border-radius:6px;font-family:'Unbounded',sans-serif;font-size:.68rem;font-weight:800;text-transform:uppercase;letter-spacing:.06em}
+.wg-title{font-family:'Unbounded',sans-serif;font-size:1.05rem;font-weight:800;color:var(--sec-acc-d,var(--pri2));flex:1}
+.wg-help{font-size:.88rem;color:var(--text);margin-bottom:12px;line-height:1.55;background:linear-gradient(135deg,var(--warn-bg,#fef3c7),var(--sec-acc-soft,var(--pri-soft)));border-left:4px solid var(--warn,#f59e0b);padding:9px 14px;border-radius:9px}
+.tinp{padding:8px 12px;border:1.5px solid var(--border);border-radius:8px;background:var(--card);color:var(--text);transition:border-color .15s;font-family:'JetBrains Mono',monospace}
+.tinp:focus{outline:0;border-color:var(--sec-acc,var(--pri));box-shadow:0 0 0 3px var(--sec-acc-soft,var(--pri-soft))}
+.actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px}
+.sliders{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:10px;margin-bottom:10px}
+.sliders label{display:block;font-size:.92rem;color:var(--muted);background:var(--card);padding:8px 12px;border-radius:8px;border:1px solid var(--border);line-height:1.5}
+.sliders label b{font-family:'JetBrains Mono',monospace;font-size:1.05rem;color:var(--sec-acc-d,var(--pri2));margin-left:4px}
+.sliders label input[type="range"]{display:block;width:100%;margin-top:6px;accent-color:var(--sec-acc,var(--pri))}
+.score-display{display:flex;gap:14px;flex-wrap:wrap;align-items:center;padding:10px 14px;background:var(--sec-acc-soft,var(--pri-soft));border-radius:10px;margin-bottom:12px}
+.score-display b{color:var(--sec-acc-d,var(--pri2));font-size:1.15rem}
+.spoiler{border:1px solid var(--border);border-radius:10px;background:var(--card);margin:10px 0;overflow:hidden}
+.spoiler summary{padding:8px 14px;background:var(--sec-acc-soft,var(--pri-soft));font-weight:700;cursor:pointer;font-size:.88rem;color:var(--sec-acc-d,var(--pri2));list-style:none;display:flex;align-items:center;gap:8px}
+.spoiler summary::-webkit-details-marker{display:none}
+.spoiler summary::before{content:'+';font-size:1.2rem;font-weight:900;color:var(--sec-acc,var(--pri));width:18px}
+.spoiler[open] summary::before{content:'\2212'}
+.spoiler-body{padding:10px 14px;font-size:.92rem;line-height:1.6}
+.step-box{background:var(--card);border:1.5px solid var(--border);border-radius:10px;padding:12px 14px;margin-top:10px;font-size:.94rem;line-height:1.55}
+.step-box.show{border-color:var(--sec-acc,var(--pri));background:var(--sec-acc-soft,var(--pri-soft))}
@@ -432,41 +455,659 @@ function wireReadBtn(paraId){
});
}
+function gcd(a,b){ a=Math.abs(a|0); b=Math.abs(b|0); while(b){ const t=b; b=a%b; a=t; } return a||1; }
+function makeCard(kind, title, num, body){
+ const labels = {repeat:'Повторение',theory:'Теория',algo:'Алгоритм',rule:'Правило',example:'Пример',oral:'Устно'};
+ return ' */
+function plotFunc(f, xmin, xmax, toX, toY, color, N){
+ N = N || 200;
+ let d = '';
+ let prevValid = false;
+ for (let i = 0; i <= N; i++){
+ const x = xmin + (xmax - xmin) * i / N;
+ let y;
+ try { y = f(x); } catch(e){ y = NaN; }
+ if (!isFinite(y) || isNaN(y) || y < -1e4 || y > 1e4){ prevValid = false; continue; }
+ d += (prevValid ? ' L' : ' M') + toX(x).toFixed(2) + ',' + toY(y).toFixed(2);
+ prevValid = true;
+ }
+ return '';
+}
+
/* ===== STUB BUILDERS — наполнение в Phase 1+ ===== */
function buildP10(){
- const root = document.getElementById('p10-body');
- root.innerHTML = `
-
-
-
-
Содержание параграфа «Дробно-рациональные уравнения» будет добавлено в следующих обновлениях.
-
Раздел Phase 1.
-
-
` + secNav(null, 'p11') + readButton('p10');
- renderMath(root);
+ const box = document.getElementById('p10-body');
+ let html = '';
+
+ html += makeCard('theory', 'Дробно-рациональное уравнение', '10.1', `
+ Уравнение вида $\\dfrac{P(x)}{Q(x)} = 0$, где $P(x)$ и $Q(x)$ — многочлены, называется дробно-рациональным.
+ Оно равносильно системе:
+ $P(x) = 0$ и $Q(x) \\ne 0$
+
+ Корни уравнения $P(x) = 0$, при которых $Q(x) = 0$, называют посторонними и исключают из ответа.
+ Почему именно так?
+ Дробь равна нулю только тогда, когда её числитель равен нулю, а знаменатель — нет. Если бы знаменатель тоже был нулём — дробь не определена.
+
`);
+
+ html += makeCard('rule', 'Общий вид уравнения', '10.2', `
+ Уравнение вида $\\dfrac{P_1(x)}{Q_1(x)} = \\dfrac{P_2(x)}{Q_2(x)}$ решается по схеме:
+
+ - Найти ОДЗ: $Q_1(x) \\ne 0$ и $Q_2(x) \\ne 0$.
+ - Перенести всё в одну сторону и привести к общему знаменателю $\\Rightarrow$ форма $\\dfrac{N(x)}{D(x)} = 0$.
+ - Решить $N(x) = 0$.
+ - Проверить найденные корни по ОДЗ — те, что нарушают $D(x) \\ne 0$, отбросить.
+
`);
+
+ html += makeCard('example', 'Пошаговое решение', '10.3', `
+ Пример 1. Решить $\\dfrac{2}{x - 3} = \\dfrac{1}{x + 1}$.
+ ОДЗ: $x \\ne 3$ и $x \\ne -1$. Перекрёстное умножение:
+ $2(x + 1) = x - 3 \\Rightarrow 2x + 2 = x - 3 \\Rightarrow x = -5$.
+ Проверка: $-5 \\ne 3,\\ -5 \\ne -1$ — подходит. Ответ: $x = -5$.
+ Пример 2. Решить $\\dfrac{x + 1}{x - 2} = 2$.
+ ОДЗ: $x \\ne 2$. Умножим обе части на $x - 2$:
+ $x + 1 = 2(x - 2) \\Rightarrow x + 1 = 2x - 4 \\Rightarrow x = 5$.
+ Проверка: $5 \\ne 2$ — корень подходит. Ответ: $x = 5$.
`);
+
+ /* INTERACTIVE 1 — пошаговый решатель */
+ html += `
+
+
Выбери задачу ползунком и раскрывай шаги решения по одному.
+
+
+
+
+
+
+
+
+
+
`;
+
+ /* INTERACTIVE 2 — калькулятор */
+ html += ``;
+
+ /* INTERACTIVE 3 — посторонний корень? */
+ html += `
+
+
Для каждого уравнения дан найденный корень. Реши: он подходит или это посторонний корень?
+
Задача: 1 / 6 · Очки: 0
+
+
+
+
+
+
+
`;
+
+ /* INTERACTIVE 4 — тренажёр корней */
+ html += `
+
+
Реши уравнение в уме (или на черновике) и введи корень.
+
Задача: 1 / 6 · Очки: 0
+
+
+ $x$ =
+
+
+
+
+
+
`;
+
+ box.innerHTML = html + secNav(null, 'p11') + readButton('p10');
+ renderMath(box);
+
+ /* ===== IV1 wiring ===== */
+ (function(){
+ const tasks = [
+ {
+ eq: '$\\dfrac{1}{x} = 2$',
+ steps: [
+ 'ОДЗ: $x \\ne 0$.',
+ 'Умножим обе части на $x$: $1 = 2x$.',
+ 'Отсюда $x = \\dfrac{1}{2}$.',
+ 'Проверка: $\\dfrac{1}{2} \\ne 0$ — подходит. Ответ: $x = 0{,}5$.'
+ ]
+ },
+ {
+ eq: '$\\dfrac{2}{x - 1} = \\dfrac{3}{x + 1}$',
+ steps: [
+ 'ОДЗ: $x \\ne 1$ и $x \\ne -1$.',
+ 'Перекрёстное умножение: $2(x + 1) = 3(x - 1)$.',
+ 'Раскроем: $2x + 2 = 3x - 3 \\Rightarrow x = 5$.',
+ 'Проверка: $5 \\ne 1,\\ 5 \\ne -1$ — подходит. Ответ: $x = 5$.'
+ ]
+ },
+ {
+ eq: '$\\dfrac{x}{x - 3} = \\dfrac{2}{x - 3} + 1$',
+ steps: [
+ 'ОДЗ: $x \\ne 3$.',
+ 'Перенесём дроби: $\\dfrac{x - 2}{x - 3} = 1$.',
+ 'Умножим на $(x - 3)$: $x - 2 = x - 3 \\Rightarrow -2 = -3$.',
+ 'Противоречие! Ответ: корней нет.'
+ ]
+ },
+ {
+ eq: '$\\dfrac{3}{x + 2} = \\dfrac{6}{2x + 4}$',
+ steps: [
+ 'ОДЗ: $x \\ne -2$.',
+ 'Заметим: $2x + 4 = 2(x + 2)$, значит правая дробь $= \\dfrac{6}{2(x + 2)} = \\dfrac{3}{x + 2}$.',
+ 'Получили $\\dfrac{3}{x + 2} = \\dfrac{3}{x + 2}$ — верно при любом $x \\ne -2$.',
+ 'Ответ: $x$ — любое число, кроме $-2$.'
+ ]
+ },
+ {
+ eq: '$\\dfrac{x + 1}{x - 2} = 2$',
+ steps: [
+ 'ОДЗ: $x \\ne 2$.',
+ 'Умножим на $(x - 2)$: $x + 1 = 2(x - 2)$.',
+ 'Раскроем: $x + 1 = 2x - 4 \\Rightarrow x = 5$.',
+ 'Проверка: $5 \\ne 2$ — подходит. Ответ: $x = 5$.'
+ ]
+ }
+ ];
+ const sl = document.getElementById('p10-iv1-slider');
+ const idxEl = document.getElementById('p10-iv1-idx');
+ const eqEl = document.getElementById('p10-iv1-eq');
+ const stepsEl = document.getElementById('p10-iv1-steps');
+ const nextBtn = document.getElementById('p10-iv1-next');
+ const resetBtn = document.getElementById('p10-iv1-reset');
+ let shown = 0;
+ let bumped = false;
+
+ function render(){
+ const idx = (+sl.value) - 1;
+ const t = tasks[idx];
+ idxEl.textContent = idx + 1;
+ eqEl.innerHTML = t.eq;
+ let h = '';
+ for (let i = 0; i < shown; i++){
+ h += 'Шаг ' + (i + 1) + '. ' + t.steps[i] + '
';
+ }
+ stepsEl.innerHTML = h;
+ nextBtn.disabled = (shown >= t.steps.length);
+ nextBtn.style.opacity = nextBtn.disabled ? .5 : 1;
+ renderMath(document.getElementById('p10-iv1'));
+ }
+ sl.addEventListener('input', ()=>{ shown = 0; render(); });
+ nextBtn.addEventListener('click', ()=>{
+ const t = tasks[(+sl.value) - 1];
+ if (shown < t.steps.length){ shown++; render(); }
+ if (!bumped){ bumped = true; bumpProgress('p10', 15); addXp(10, 'p10-iv1'); }
+ });
+ resetBtn.addEventListener('click', ()=>{ shown = 0; render(); });
+ render();
+ })();
+
+ /* ===== IV2 wiring — калькулятор ===== */
+ (function(){
+ const aIn = document.getElementById('p10-iv2-a');
+ const bIn = document.getElementById('p10-iv2-b');
+ const cIn = document.getElementById('p10-iv2-c');
+ const out = document.getElementById('p10-iv2-out');
+ let bumped = false;
+ document.getElementById('p10-iv2-go').addEventListener('click', ()=>{
+ const a = +aIn.value, b = +bIn.value, c = +cIn.value;
+ let html = 'Уравнение: $\\dfrac{' + a + '}{x - (' + b + ')} = ' + c + '$
';
+ html += 'ОДЗ: $x \\ne ' + b + '$.
';
+ if (c === 0){
+ if (a === 0) html += 'Решение: любое $x \\ne ' + b + '$ (тождество $0 = 0$).
';
+ else html += 'Решение: корней нет (дробь $\\dfrac{' + a + '}{x - ' + b + '}$ не равна нулю).
';
+ } else {
+ const x = b + a / c;
+ html += 'Умножим на $(x - ' + b + ')$: $' + a + ' = ' + c + '(x - ' + b + ')$.
';
+ html += '$x = ' + b + ' + \\dfrac{' + a + '}{' + c + '} = ' + fmt(x) + '$.
';
+ if (Math.abs(x - b) < 1e-9){
+ html += 'Посторонний корень (нарушает ОДЗ). Корней нет.
';
+ } else {
+ html += 'Ответ: $x = ' + fmt(x) + '$.
';
+ }
+ }
+ out.innerHTML = html;
+ renderMath(out);
+ if (!bumped){ bumped = true; bumpProgress('p10', 15); addXp(10, 'p10-iv2'); }
+ });
+ })();
+
+ /* ===== IV3 wiring — посторонний? ===== */
+ (function(){
+ const items = [
+ { q: '$\\dfrac{x^2}{x - 1} = \\dfrac{1}{x - 1}$, найден $x = 1$.', ans: false, hint: 'ОДЗ: $x \\ne 1$. Корень $x = 1$ нарушает ОДЗ → посторонний.' },
+ { q: '$\\dfrac{x}{x + 2} = \\dfrac{3}{x + 2}$, найден $x = 3$.', ans: true, hint: 'ОДЗ: $x \\ne -2$. Корень $x = 3$ её удовлетворяет.' },
+ { q: '$\\dfrac{1}{x} = \\dfrac{1}{x}$, найден $x = 0$.', ans: false, hint: 'ОДЗ: $x \\ne 0$. Корень $x = 0$ нарушает ОДЗ → посторонний.' },
+ { q: '$\\dfrac{2}{x - 5} = \\dfrac{4}{x}$, найден $x = 10$.', ans: true, hint: 'ОДЗ: $x \\ne 5,\\ x \\ne 0$. $10 \\ne 5,\\ 10 \\ne 0$. Проверка: $\\dfrac{2}{5} = \\dfrac{4}{10}$ — верно.' },
+ { q: '$\\dfrac{x^2 - 4}{x - 2} = 4$, найден $x = 2$.', ans: false, hint: 'ОДЗ: $x \\ne 2$. Корень $x = 2$ — посторонний.' },
+ { q: '$\\dfrac{x - 1}{x + 1} = 0$, найден $x = 1$.', ans: true, hint: 'ОДЗ: $x \\ne -1$. $1 \\ne -1$ — корень подходит.' }
+ ];
+ let i = 0, sc = 0, bumped = false;
+ const idxEl = document.getElementById('p10-iv3-idx');
+ const scEl = document.getElementById('p10-iv3-sc');
+ const qEl = document.getElementById('p10-iv3-q');
+ const fb = document.getElementById('p10-iv3-fb');
+ const okBtn = document.getElementById('p10-iv3-ok');
+ const badBtn = document.getElementById('p10-iv3-bad');
+ function render(){
+ idxEl.textContent = Math.min(i + 1, items.length);
+ scEl.textContent = sc;
+ if (i >= items.length){
+ qEl.innerHTML = 'Готово! Результат: ' + sc + ' / ' + items.length;
+ okBtn.disabled = true; badBtn.disabled = true;
+ okBtn.style.opacity = .5; badBtn.style.opacity = .5;
+ if (!bumped){ bumped = true; bumpProgress('p10', 25); addXp(15, 'p10-iv3'); }
+ return;
+ }
+ qEl.innerHTML = items[i].q;
+ fb.style.display = 'none';
+ renderMath(qEl);
+ }
+ function answer(v){
+ if (i >= items.length) return;
+ const it = items[i];
+ const ok = (v === it.ans);
+ if (ok) sc++;
+ feedback(fb, ok, (ok ? '✓ Верно. ' : '✗ Неверно. ') + it.hint);
+ i++;
+ setTimeout(render, 1100);
+ }
+ okBtn.addEventListener('click', ()=>answer(true));
+ badBtn.addEventListener('click', ()=>answer(false));
+ render();
+ })();
+
+ /* ===== IV4 wiring — тренажёр корней ===== */
+ (function(){
+ const items = [
+ { q: '$\\dfrac{x}{2} = 5$', ans: 10, hint: '$x = 5 \\cdot 2 = 10$.' },
+ { q: '$\\dfrac{6}{x} = 3$', ans: 2, hint: '$6 = 3x \\Rightarrow x = 2$.' },
+ { q: '$\\dfrac{1}{x - 1} = \\dfrac{1}{3}$', ans: 4, hint: '$x - 1 = 3 \\Rightarrow x = 4$.' },
+ { q: '$\\dfrac{x + 2}{x - 1} = 2$', ans: 4, hint: '$x + 2 = 2(x - 1) \\Rightarrow x = 4$.' },
+ { q: '$\\dfrac{2}{x - 3} = -1$', ans: 1, hint: '$2 = -(x - 3) \\Rightarrow x = 1$.' },
+ { q: '$\\dfrac{x - 5}{x + 5} = 0$', ans: 5, hint: 'Числитель $= 0$: $x - 5 = 0 \\Rightarrow x = 5$.' }
+ ];
+ let i = 0, sc = 0, bumped = false;
+ const idxEl = document.getElementById('p10-iv4-idx');
+ const scEl = document.getElementById('p10-iv4-sc');
+ const qEl = document.getElementById('p10-iv4-q');
+ const inp = document.getElementById('p10-iv4-inp');
+ const fb = document.getElementById('p10-iv4-fb');
+ const goBtn = document.getElementById('p10-iv4-go');
+ const skipBtn = document.getElementById('p10-iv4-skip');
+ function render(){
+ idxEl.textContent = Math.min(i + 1, items.length);
+ scEl.textContent = sc;
+ if (i >= items.length){
+ qEl.innerHTML = 'Готово! Результат: ' + sc + ' / ' + items.length;
+ inp.disabled = true; goBtn.disabled = true; skipBtn.disabled = true;
+ inp.style.opacity = .5; goBtn.style.opacity = .5; skipBtn.style.opacity = .5;
+ if (!bumped){ bumped = true; bumpProgress('p10', 25); addXp(15, 'p10-iv4'); }
+ return;
+ }
+ qEl.innerHTML = items[i].q;
+ inp.value = '';
+ fb.style.display = 'none';
+ renderMath(qEl);
+ }
+ function check(){
+ if (i >= items.length) return;
+ const v = parseFloat(inp.value);
+ const it = items[i];
+ if (isNaN(v)){ feedback(fb, false, 'Введи число.'); return; }
+ const ok = Math.abs(v - it.ans) < 1e-6;
+ if (ok) sc++;
+ feedback(fb, ok, (ok ? '✓ Верно! ' : '✗ Неверно. ' + 'Правильно: $x = ' + it.ans + '$. ') + it.hint);
+ i++;
+ setTimeout(render, 1200);
+ }
+ function skip(){
+ if (i >= items.length) return;
+ const it = items[i];
+ feedback(fb, false, 'Пропущено. Правильно: $x = ' + it.ans + '$. ' + it.hint);
+ i++;
+ setTimeout(render, 1200);
+ }
+ goBtn.addEventListener('click', check);
+ skipBtn.addEventListener('click', skip);
+ inp.addEventListener('keydown', e=>{ if (e.key === 'Enter') check(); });
+ render();
+ })();
+
wireReadBtn('p10');
}
function buildP11(){
- const root = document.getElementById('p11-body');
- root.innerHTML = `
-
-
-
-
Содержание параграфа «Системы нелинейных уравнений» будет добавлено в следующих обновлениях.
-
Раздел Phase 1.
-
-
` + secNav('p10', 'p12') + readButton('p11');
- renderMath(root);
+ const box = document.getElementById('p11-body');
+ let html = '';
+
+ html += makeCard('theory', 'Способ подстановки', '11.1', `
+ В системе двух уравнений с двумя переменными $x, y$ выражаем одну переменную через другую из одного уравнения и подставляем в другое.
+ Пример. $\\begin{cases} y = x + 1 \\\\ x^2 + y^2 = 5 \\end{cases}$
+ Подставим $y = x + 1$ во второе уравнение:
+ $x^2 + (x + 1)^2 = 5 \\Rightarrow 2x^2 + 2x - 4 = 0 \\Rightarrow x^2 + x - 2 = 0$.
+ Корни: $x_1 = 1,\\ x_2 = -2$. Тогда $y_1 = 2,\\ y_2 = -1$.
+ Ответ: $(1;\\ 2)$ и $(-2;\\ -1)$.
`);
+
+ html += makeCard('rule', 'Способ сложения', '11.2', `
+ Систему приводят к виду, в котором при сложении (или вычитании) уравнений одна из переменных исчезает. Удобно для симметричных систем.
+ Пример. $\\begin{cases} x + y = 5 \\\\ x^2 + y^2 = 13 \\end{cases}$
+ Из первого: $y = 5 - x$. Подставим: $x^2 + (5 - x)^2 = 13 \\Rightarrow 2x^2 - 10x + 12 = 0 \\Rightarrow x^2 - 5x + 6 = 0$.
+ Корни: $x = 2$ или $x = 3$. Ответ: $(2;\\ 3)$ и $(3;\\ 2)$.
`);
+
+ html += makeCard('example', 'Графическая интерпретация', '11.3', `
+ Решение системы двух уравнений — это координаты точек пересечения графиков уравнений.
+ Пример. $\\begin{cases} y = x^2 \\\\ y = x + 2 \\end{cases}$ — это парабола и прямая.
+ Найдём пересечения: $x^2 = x + 2 \\Rightarrow x^2 - x - 2 = 0 \\Rightarrow x = 2$ или $x = -1$. Тогда $y = 4$ или $y = 1$.
+ Ответ: $(2;\\ 4)$ и $(-1;\\ 1)$. На графике это две точки пересечения параболы $y = x^2$ и прямой $y = x + 2$.
`);
+
+ /* INTERACTIVE 1 — графический решатель */
+ html += `
+
+
Выбери систему ползунком — на графике увидишь оба уравнения и красные точки пересечения с координатами.
+
+
+
+
+
+
+
+
+
`;
+
+ /* INTERACTIVE 2 — калькулятор подстановки */
+ html += `
+
+
Для системы $\\begin{cases} y = ax + b \\\\ y = x^2 \\end{cases}$ калькулятор найдёт точки пересечения через дискриминант.
+
+ $a$ =
+ $b$ =
+
+
+
+
`;
+
+ /* INTERACTIVE 3 — сколько решений? */
+ html += `
+
+
Подумай: сколько точек пересечения у графиков уравнений системы?
+
Задача: 1 / 6 · Очки: 0
+
+
+
+
+
+
+
+
`;
+
+ /* INTERACTIVE 4 — тренажёр решений */
+ html += `
+
+
Найди все решения системы и введи сумму всех координат (сложи $x$-и и $y$-и всех точек).
+
Задача: 1 / 5 · Очки: 0
+
+
+ Сумма =
+
+
+
+
+
+
`;
+
+ box.innerHTML = html + secNav('p10', 'p12') + readButton('p11');
+ renderMath(box);
+
+ /* ===== IV1 wiring — графический решатель ===== */
+ (function(){
+ const systems = [
+ {
+ sys: '$\\begin{cases} y = x \\\\ y = x^2 \\end{cases}$',
+ f1: x => x, label1: 'y = x',
+ f2: x => x*x, label2: 'y = x²',
+ roots: [[0, 0], [1, 1]]
+ },
+ {
+ sys: '$\\begin{cases} y = x + 1 \\\\ y = x^2 - 1 \\end{cases}$',
+ f1: x => x + 1, label1: 'y = x + 1',
+ f2: x => x*x - 1, label2: 'y = x² - 1',
+ roots: [[-1, 0], [2, 3]]
+ },
+ {
+ sys: '$\\begin{cases} y = 2 \\\\ y = x^2 - 2 \\end{cases}$',
+ f1: x => 2, label1: 'y = 2',
+ f2: x => x*x - 2, label2: 'y = x² - 2',
+ roots: [[-2, 2], [2, 2]]
+ },
+ {
+ sys: '$\\begin{cases} y = -x \\\\ y = x^2 - 2 \\end{cases}$',
+ f1: x => -x, label1: 'y = -x',
+ f2: x => x*x - 2, label2: 'y = x² - 2',
+ roots: [[1, -1], [-2, 2]]
+ },
+ {
+ sys: '$\\begin{cases} y = 4 - x^2 \\\\ y = 0 \\end{cases}$',
+ f1: x => 4 - x*x, label1: 'y = 4 - x²',
+ f2: x => 0, label2: 'y = 0',
+ roots: [[-2, 0], [2, 0]]
+ }
+ ];
+ const sl = document.getElementById('p11-iv1-slider');
+ const idxEl = document.getElementById('p11-iv1-idx');
+ const sysEl = document.getElementById('p11-iv1-sys');
+ const svg = document.getElementById('p11-iv1-svg');
+ const out = document.getElementById('p11-iv1-out');
+ let bumped = false;
+
+ function redraw(){
+ const idx = (+sl.value) - 1;
+ const s = systems[idx];
+ idxEl.textContent = idx + 1;
+ sysEl.innerHTML = s.sys;
+
+ const ax = axes2D(400, 320, 30, -5, 5, -5, 5);
+ let g = ax.content;
+ g += plotFunc(s.f1, -5, 5, ax.toX, ax.toY, '#2563eb', 260);
+ g += plotFunc(s.f2, -5, 5, ax.toX, ax.toY, '#059669', 260);
+
+ s.roots.forEach(([rx, ry])=>{
+ if (rx >= -5 && rx <= 5 && ry >= -5 && ry <= 5){
+ const px = ax.toX(rx), py = ax.toY(ry);
+ g += '';
+ g += '('+fmt(rx)+'; '+fmt(ry)+')';
+ }
+ });
+ g += '';
+ g += '';
+ g += '';
+ g += ''+s.label1+'';
+ g += '';
+ g += ''+s.label2+'';
+ g += '';
+
+ svg.innerHTML = g;
+ let txt = 'Решения системы: ';
+ txt += s.roots.map(([rx, ry])=>'$(' + fmt(rx) + ';\\ ' + fmt(ry) + ')$').join(', ');
+ out.innerHTML = txt;
+ renderMath(sysEl); renderMath(out);
+ if (!bumped){ bumped = true; bumpProgress('p11', 15); addXp(10, 'p11-iv1'); }
+ }
+ sl.addEventListener('input', redraw);
+ redraw();
+ })();
+
+ /* ===== IV2 wiring — калькулятор подстановки ===== */
+ (function(){
+ const aIn = document.getElementById('p11-iv2-a');
+ const bIn = document.getElementById('p11-iv2-b');
+ const out = document.getElementById('p11-iv2-out');
+ let bumped = false;
+ document.getElementById('p11-iv2-go').addEventListener('click', ()=>{
+ const a = +aIn.value, b = +bIn.value;
+ let html = 'Система: $\\begin{cases} y = ' + a + 'x + (' + b + ') \\\\ y = x^2 \\end{cases}$
';
+ html += 'Подстановка: $x^2 = ' + a + 'x + ' + b + ' \\Rightarrow x^2 - ' + a + 'x - (' + b + ') = 0$.
';
+ const D = a*a + 4*b;
+ html += 'Дискриминант: $D = (' + a + ')^2 + 4 \\cdot (' + b + ') = ' + D + '$.
';
+ if (D < 0){
+ html += '$D < 0$ → решений нет.
';
+ } else if (Math.abs(D) < 1e-9){
+ const x = a / 2;
+ html += '$D = 0$ → одно решение: $x = ' + fmt(x) + ',\\ y = ' + fmt(x*x) + '$.
';
+ } else {
+ const sq = Math.sqrt(D);
+ const x1 = (a + sq) / 2, x2 = (a - sq) / 2;
+ const y1 = x1*x1, y2 = x2*x2;
+ html += '$D > 0$ → два решения:
';
+ html += '$(' + fmt(+x1.toFixed(4)) + ';\\ ' + fmt(+y1.toFixed(4)) + ')$ и $(' + fmt(+x2.toFixed(4)) + ';\\ ' + fmt(+y2.toFixed(4)) + ')$.
';
+ }
+ out.innerHTML = html;
+ renderMath(out);
+ if (!bumped){ bumped = true; bumpProgress('p11', 15); addXp(10, 'p11-iv2'); }
+ });
+ })();
+
+ /* ===== IV3 wiring — сколько решений? ===== */
+ (function(){
+ const items = [
+ { q: '$\\begin{cases} y = x \\\\ y = x^2 \\end{cases}$', ans: 2, hint: '$x = x^2 \\Rightarrow x(x - 1) = 0$. Решения $(0;0)$ и $(1;1)$.' },
+ { q: '$\\begin{cases} y = -2 \\\\ y = x^2 \\end{cases}$', ans: 0, hint: '$x^2 = -2$ — нет действительных корней.' },
+ { q: '$\\begin{cases} y = 0 \\\\ y = x^2 \\end{cases}$', ans: 1, hint: '$x^2 = 0 \\Rightarrow x = 0$. Одно решение $(0;0)$ — касание.' },
+ { q: '$\\begin{cases} y = x + 2 \\\\ y = -x^2 \\end{cases}$', ans: 0, hint: '$-x^2 = x + 2 \\Rightarrow x^2 + x + 2 = 0$. $D = 1 - 8 = -7 < 0$.' },
+ { q: '$\\begin{cases} x + y = 4 \\\\ xy = 3 \\end{cases}$', ans: 2, hint: '$x$ и $y$ — корни $t^2 - 4t + 3 = 0$: $t = 1$ или $t = 3$. Точки $(1;3)$ и $(3;1)$.' },
+ { q: '$\\begin{cases} y = 3 \\\\ x^2 + y^2 = 25 \\end{cases}$', ans: 2, hint: '$x^2 = 16 \\Rightarrow x = \\pm 4$. Точки $(4;3)$ и $(-4;3)$.' }
+ ];
+ let i = 0, sc = 0, bumped = false;
+ const idxEl = document.getElementById('p11-iv3-idx');
+ const scEl = document.getElementById('p11-iv3-sc');
+ const qEl = document.getElementById('p11-iv3-q');
+ const fb = document.getElementById('p11-iv3-fb');
+ const btns = [document.getElementById('p11-iv3-b0'), document.getElementById('p11-iv3-b1'), document.getElementById('p11-iv3-b2')];
+ function render(){
+ idxEl.textContent = Math.min(i + 1, items.length);
+ scEl.textContent = sc;
+ if (i >= items.length){
+ qEl.innerHTML = 'Готово! Результат: ' + sc + ' / ' + items.length;
+ btns.forEach(b=>{ b.disabled = true; b.style.opacity = .5; });
+ if (!bumped){ bumped = true; bumpProgress('p11', 25); addXp(15, 'p11-iv3'); }
+ return;
+ }
+ qEl.innerHTML = items[i].q;
+ fb.style.display = 'none';
+ renderMath(qEl);
+ }
+ function answer(v){
+ if (i >= items.length) return;
+ const it = items[i];
+ const ok = (v === it.ans);
+ if (ok) sc++;
+ feedback(fb, ok, (ok ? '✓ Верно. ' : '✗ Неверно (' + it.ans + '). ') + it.hint);
+ i++;
+ setTimeout(render, 1200);
+ }
+ btns.forEach(b=>b.addEventListener('click', ()=>answer(+b.dataset.ans)));
+ render();
+ })();
+
+ /* ===== IV4 wiring — сумма координат ===== */
+ (function(){
+ const items = [
+ { q: '$\\begin{cases} y = x \\\\ y = 2x - 1 \\end{cases}$', ans: 2, hint: 'Решение $(1;\\ 1)$. Сумма $= 1 + 1 = 2$.' },
+ { q: '$\\begin{cases} y = x^2 \\\\ y = 4 \\end{cases}$', ans: 8, hint: 'Решения $(2;\\ 4)$ и $(-2;\\ 4)$. Сумма $= 2 + 4 + (-2) + 4 = 8$.' },
+ { q: '$\\begin{cases} y = x + 1 \\\\ y = x^2 - 1 \\end{cases}$', ans: 4, hint: '$x^2 - x - 2 = 0 \\Rightarrow x = -1, 2$. Точки $(-1;0),\\ (2;3)$. Сумма $= -1 + 0 + 2 + 3 = 4$.' },
+ { q: '$\\begin{cases} x + y = 5 \\\\ x - y = 1 \\end{cases}$', ans: 5, hint: 'Сложение: $2x = 6 \\Rightarrow x = 3,\\ y = 2$. Сумма $= 3 + 2 = 5$.' },
+ { q: '$\\begin{cases} y = x^2 \\\\ y = -x + 6 \\end{cases}$', ans: 12, hint: '$x^2 + x - 6 = 0 \\Rightarrow x = 2, -3$. Точки $(2;4),\\ (-3;9)$. Сумма $= 2 + 4 + (-3) + 9 = 12$.' }
+ ];
+ let i = 0, sc = 0, bumped = false;
+ const idxEl = document.getElementById('p11-iv4-idx');
+ const scEl = document.getElementById('p11-iv4-sc');
+ const qEl = document.getElementById('p11-iv4-q');
+ const inp = document.getElementById('p11-iv4-inp');
+ const fb = document.getElementById('p11-iv4-fb');
+ const goBtn = document.getElementById('p11-iv4-go');
+ const skipBtn = document.getElementById('p11-iv4-skip');
+ function render(){
+ idxEl.textContent = Math.min(i + 1, items.length);
+ scEl.textContent = sc;
+ if (i >= items.length){
+ qEl.innerHTML = 'Готово! Результат: ' + sc + ' / ' + items.length;
+ inp.disabled = true; goBtn.disabled = true; skipBtn.disabled = true;
+ inp.style.opacity = .5; goBtn.style.opacity = .5; skipBtn.style.opacity = .5;
+ if (!bumped){ bumped = true; bumpProgress('p11', 25); addXp(15, 'p11-iv4'); }
+ return;
+ }
+ qEl.innerHTML = items[i].q;
+ inp.value = '';
+ fb.style.display = 'none';
+ renderMath(qEl);
+ }
+ function check(){
+ if (i >= items.length) return;
+ const v = parseFloat(inp.value);
+ const it = items[i];
+ if (isNaN(v)){ feedback(fb, false, 'Введи число.'); return; }
+ const ok = Math.abs(v - it.ans) < 1e-6;
+ if (ok) sc++;
+ feedback(fb, ok, (ok ? '✓ Верно! ' : '✗ Неверно. Сумма $= ' + it.ans + '$. ') + it.hint);
+ i++;
+ setTimeout(render, 1300);
+ }
+ function skip(){
+ if (i >= items.length) return;
+ const it = items[i];
+ feedback(fb, false, 'Пропущено. Сумма $= ' + it.ans + '$. ' + it.hint);
+ i++;
+ setTimeout(render, 1300);
+ }
+ goBtn.addEventListener('click', check);
+ skipBtn.addEventListener('click', skip);
+ inp.addEventListener('keydown', e=>{ if (e.key === 'Enter') check(); });
+ render();
+ })();
+
wireReadBtn('p11');
}