Skip to content

feat(galerkin): Galerkin solver, Legendre basis and related work - #29

Merged
hexjasur merged 37 commits into
masterfrom
feat/galerkin-method
Nov 28, 2026
Merged

hexjasur merged 37 commits into
masterfrom
feat/galerkin-method

Conversation

@hexjasur

@hexjasur hexjasur commented Nov 28, 2026 •

Copy link
Copy Markdown
Owner

Summary

Adds the Galerkin method as an interactive, step-by-step solver for second-order linear boundary value problems, and brings in the related work from the Legendre, collocation, sweep and share branches.

Changes

Galerkin method

  • Twelve-step solver for u'' + p u' + q u = f with Dirichlet and Robin boundary conditions.
  • φ₀ and the basis functions are built automatically from the problem. An optional basis template overrides them.
  • New Legendre basis option, φᵢ = (x − a)(b − x)·P_{i−1}(t), which vanishes at both ends.
  • Formulas are rounded to the chosen precision. The final approximation is expanded into powers of x when it is a polynomial.
  • Blackboard option for basis functions that do not vanish at the boundary.

Shared math

  • cosx, COS X, cos x^2, sin2x are accepted in every method through normalizeExpression.

Collocation

  • Input panel moved above the results, matching the Galerkin layout.
  • Live KaTeX preview of the equation and both boundary conditions while typing.

Sweep (Thomas)

  • Copy, PNG and CSV export block removed. Print was in the same block and is removed too.
  • Share button opens a dialog. The optional note (140 characters max) is added to the link as ?note= and shown as a toast to anyone who opens it. The note survives recalculation.

About page

  • Author photo served from public/images/author.jpg.
  • Email link replaced with the contact page on jasurdev.uz.

i18n

  • Galerkin page and solver errors translated to uz, en and ru. Solver errors carry a code and are translated in the UI.
  • Default language is Uzbek. The browser language is no longer read, which removes the switch to English after load.

Testing

  • bunx tsc --noEmit, bun run lint and bun run build pass on every commit.
  • Solver checked against exact solutions: u = sin(πx) reaches a maximum error of 1e-5 at n = 5, and a problem with nonzero boundary values reaches 1e-4 at n = 6.
  • Not yet checked in a browser: layouts, toast, share dialog and translations in all three languages.

Notes

https://claude.ai/code/session_014R1cEMD4uzti3MNab95hN5


Generated by Claude Code

hexjasur and others added 30 commits November 25, 2026 14:21
Implements the Galerkin method for second-order linear boundary value
problems: safe expression parsing (no eval), symbolic derivatives via
mathjs, composite Simpson integration with error estimate, Gaussian
elimination with partial pivoting, residual and orthogonality checks.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014R1cEMD4uzti3MNab95hN5
Adds /methods/galerkin: input panel with safe expression parsing, the 12
solution stages (problem, operator, basis checks, L(phi) evaluation,
a_ki and b_k integrals with expandable details, linear system with
matrix form, coefficients, final result, verification with boundary,
residual and orthogonality checks), precision selector, copy formula
and residual / approximation plots.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014R1cEMD4uzti3MNab95hN5
Adds the Galerkin entry to the sidebar, the methods dashboard, page
title lookup, i18n labels (uz/en/ru) and SEO keywords.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014R1cEMD4uzti3MNab95hN5
Dark -> light had no visible animation: the new view sits on top, so
animating the old snapshot was hidden. The new view now always expands
from the click point. Removed the body background/color transition that
ran on top of the view transition, and skip the animation when the user
prefers reduced motion.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014R1cEMD4uzti3MNab95hN5
Stat cards are now single-row items on small screens instead of tall
140px blocks. The original card layout is kept from the md breakpoint up.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014R1cEMD4uzti3MNab95hN5
… mobile 🎨

The dashboard container used an invalid class (ax-w-290), so its
max-width never applied. Panel headers now use smaller spacing and
title size on phones.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014R1cEMD4uzti3MNab95hN5
Fixed body background forces repaints on every scroll, which is costly on
phones. Removed it. Replaced transition-all on dashboard and method cards
with the specific properties that change, so the browser animates less.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014R1cEMD4uzti3MNab95hN5
Default form now asks only for p, q, f, a, b, u(a), u(b), phi0, n and a
single basis template (sin(i*x)). Boundary coefficients (alpha/beta) and
per-function basis fields are behind "Kengaytirilgan sozlamalar". A live
equation preview shows the entered problem in LaTeX.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014R1cEMD4uzti3MNab95hN5
Galerkin page starts with empty inputs. Coefficients follow the collocation
naming: a2 (u''), a1 (u'), a0 (u), f. Empty a2 means 1; empty a1, a0 and f
mean 0. Required fields (a, b, boundary values, phi0, basis) show a clear
error when empty. "Namuna masala" loads the notebook problem and "Tozalash"
clears the form.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014R1cEMD4uzti3MNab95hN5
When phi0 is left empty, the solver builds the linear function through
(a, u(a)) and (b, u(b)). This applies to Dirichlet conditions (alpha1 =
beta1 = 0). The sample problem leaves phi0 empty to show the behaviour.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014R1cEMD4uzti3MNab95hN5
Zero boundary data gives phi0 = 0 instead of (0)+(0)*(x-0). The approximation
formula no longer shows "+-" before a negative first coefficient.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014R1cEMD4uzti3MNab95hN5
Form is limited to 768px and grouped into equation coefficients, interval
and boundary values, phi0 with the basis template, and one action row.
Two columns on phones, four on larger screens. Advanced alpha/beta fields
appear as a row only when requested.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014R1cEMD4uzti3MNab95hN5
mathjs only recognises lowercase pi, so inputs like "Pi" or "-Pi" failed
with a misleading "number expected" error. Constants are normalised before
parsing.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014R1cEMD4uzti3MNab95hN5
…ions ✨

Standard Galerkin requires basis functions that vanish at the boundary. The
classroom solution uses x^2-3 and x^3-4, which do not, so the solver rejected
it. A new option skips that check. With the same inputs the integrals and
coefficients now match the board (a11 = -22.9333, a12 = -31.1667, a21 =
-32.3333, a22 = -44.2286). The verification section shows the boundary
errors that method produces.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014R1cEMD4uzti3MNab95hN5
Replace per-component loading placeholders on first load with a single
full-screen splash. The logo is redrawn as an inline SVG: the glass frame,
axes with arrowheads and ticks, the curve, then the orange point and its
guides draw in with stroke-dash animation. Pure SVG/CSS, no extra
dependencies, theme-aware via existing tokens.

- Rendered in the static HTML so it shows before hydration (no flash)
- Dismissed after ~2s with a short fade
- prefers-reduced-motion: no animation, dismissed almost immediately
- <noscript> fallback hides the splash when JS is disabled
The page content behind the fixed splash overflowed the viewport, so a
scrollbar appeared during the loading animation. Lock html overflow while
#app-splash is mounted using :has(), so no JS is needed and the lock is
released automatically once the splash unmounts. The noscript fallback
restores scrolling.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014R1cEM4poz4RxE4JQ5gqAm
Empty φ₀ and empty basis template now derive the trial functions from
the boundary conditions (Dirichlet and Robin). Only the equation,
interval and boundary values are needed.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014R1cEMD4uzti3MNab95hN5
…ckets 🐛

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014R1cEMD4uzti3MNab95hN5
Accept cosx, COS X and cos x^2 as cos(x), cos(x), cos(x^2). Show L(u)
without a unit coefficient or zero terms, and render f(x) through KaTeX
with plain brackets instead of \left( \right).

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014R1cEMD4uzti3MNab95hN5
Solver errors now carry a code and parameters, translated in the UI.
Remove the 'Doska (daftar) usuli:' prefix from the blackboard option.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014R1cEMD4uzti3MNab95hN5
The implicit-call expansion lived only in the Galerkin solver. Move it
into the shared normalizeExpression so bisection, Simpson, trapezoid and
other methods accept cosx, sinx and cos x^2 too.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014R1cEMD4uzti3MNab95hN5
The browser language was read after hydration, so the server render (uz)
switched to English within a second on English browsers.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014R1cEMD4uzti3MNab95hN5
Basis (x-a)(b-x)·P(i-1)(t) vanishes at both ends. Selectable with a
toggle next to the basis template; the automatic default is unchanged.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014R1cEMD4uzti3MNab95hN5
Every decimal in result formulas follows the precision selector. The final
approximation is written as an expanded polynomial when uₙ is a polynomial
(automatic and Legendre bases), checked against the sum at extra points;
otherwise the basis sum is kept.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014R1cEMD4uzti3MNab95hN5
Input is a centered full-width form above the results instead of a sticky
left column, so the page scrolls naturally on desktop.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014R1cEMD4uzti3MNab95hN5
Show the equation and both boundary conditions as KaTeX above the form,
updated on every keystroke, like the Galerkin page.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014R1cEMD4uzti3MNab95hN5
The share button now covers sharing the example, so the result export
toolbar is removed from the Thomas method page.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014R1cEMD4uzti3MNab95hN5
Remote avatar for now; a local copy in public/ can replace the URL later.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014R1cEMD4uzti3MNab95hN5
claude and others added 6 commits November 28, 2026 14:20
Share opens a dialog where a short note (max 140 characters) is added to
the link as ?note=. Anyone who opens the link sees the note at the top
of the page and can dismiss it. The note survives recalculation.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014R1cEMD4uzti3MNab95hN5
Photo cropped to the face and served from public/. The email link now
points to the contact page on jasurdev.uz.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014R1cEMD4uzti3MNab95hN5
The note is a fixed toast above the page instead of an inline red block.
It stays until closed. Cyan accent instead of the brand red.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014R1cEMD4uzti3MNab95hN5
Top stripe and tinted background use the loader gradient; colours come
from theme tokens so light and dark modes both read well.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014R1cEMD4uzti3MNab95hN5
Haydash export removal, share dialog with note, about page updates
Merge Galerkin Legendre basis, precision and collocation work
@vercel

vercel Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
numeric-methods Ready Ready Preview Nov 28, 2026 10:02am UTC

@hexjasur hexjasur changed the title Galerkin method, Legendre basis, collocation preview and share note feat(galerkin): Galerkin solver, Legendre basis and related work Nov 28, 2026
@hexjasur
hexjasur merged commit 66816d6 into master Nov 28, 2026
4 checks passed

This branch was successfully deployed

1 active deployment
Preview — ac23acb0 Deployed Nov 28, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants