Skip to content

Expose coefficient polynomials in TSL with completion and reference - #314

Draft
PawelTroka wants to merge 1 commit into
masterfrom
codex/polynomial-utilities-20261030
Draft

PawelTroka wants to merge 1 commit into
masterfrom
codex/polynomial-utilities-20261030

Conversation

@PawelTroka

@PawelTroka PawelTroka commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

Problem

Addresses #111.

Math.NET's general polynomial implementation is already shipped, but it has no short TSL type name, completion entries or authored function reference. The named orthogonal polynomials do not provide the requested coefficient-based arithmetic, evaluation and general root workflow. Fully qualified calls to the dependency were possible before this change; this PR makes that existing capability part of the discoverable application API.

Change

  • Add Polynomial = MathNet.Numerics.Polynomial to the shared TSL preamble used by portable execution and both the legacy and precompiled desktop/web evaluators.
  • Expose coefficient construction, Polynomial.Zero and all callable static methods in scripting completion; numeric evaluation overloads also appear in expression completion. Exclude CLR operator/accessor names that cannot be called as methods, and show a readable quotient/remainder tuple caption.
  • Add 14 authored reference articles covering 18 completion entries, plus a practical guide to arithmetic, scalar division, quotient/remainder, derivatives, antiderivatives, real/complex evaluation, least-squares fitting and all numerical complex roots of a real-coefficient polynomial.
  • Keep the existing Math.NET 5.0.0 algorithms and dependencies. There is no duplicate polynomial solver or new emitted ToCode implementation.
var p = new Polynomial(-6,11,-6,1); // x³ - 6x² + 11x - 6
var roots = p.Roots();             // approximately 1, 2, 3; order unspecified
write(Polynomial.Evaluate(2,1,-3,2)); // 3

var division = Polynomial.DivideRemainder(
    new Polynomial(1,0,1), new Polynomial(1,1));
// Item1: x - 1; Item2: 2

The help explains ascending coefficient order, mutable/shared coefficient arrays, the single-integer constructor convention, zero/constant root arrays, coefficientwise versus polynomial arithmetic, and numerical conditioning. General roots use the dependency's companion-matrix eigenvalue routine; a new GSL backend and symbolic algebra are not included. General member completion after an arbitrary variable remains the separate #54 workstream.

Validation

Check Result
New execution fixture against unchanged master 46 failed, all missing the Polynomial type/name
Same fixture after the alias is added 46 passed, zero failed/skipped
Complete portable Engine Release suite 1,484 passed, zero failed/skipped
Windows Core.Tests Release cross-build Passed, zero errors; two existing unused-field warnings in Charting
Python reference-authoring suite 63 passed
Deterministic reference regeneration Passed; all 1,220 existing article blocks remain byte-identical, with 14 additions
git diff --check Passed

Execution tests cover independent analytic real/complex values, arithmetic and input preservation, quotient/remainder reconstruction, real and nonreal roots, repeated roots, trailing zero coefficients, zero/constant conventions, fitting, calculus and custom definitions. Twelve native Core evaluator/completion cases are also committed for Windows CI.

Validated the exact uploaded tree 3c36aad333b0031b06f8510a05d566b5d2310f76 (identical to the reviewed local commit), using .NET SDK 10.0.403 on Linux x64:

dotnet test Computator.NET.Engine.Tests/Computator.NET.Engine.Tests.csproj -c Release
dotnet build Computator.NET.Core.Tests/Computator.NET.Core.Tests.csproj -c Release -p:EnableWindowsTargeting=true -m:1 -nodeReuse:false -p:UseSharedCompilation=false
python3 -m unittest discover -s build/reference -p 'test_*.py'

Reference generation uses the authenticated successful master Reference-Validate inventory and the actual new production reflection/source output. The local reflection harness replaces the WinForms item/settings shell; native full-catalog validation remains a CI gate. Native Windows tests and remaining platform CI were not executed here and are not claimed by the Linux cross-build.

Existing-work review

Reviewed all 78 open issues, all 14 existing open PRs, closed PR titles and targeted all-state searches before implementation. No existing PR owns #111's polynomial integration. The open Euclid integration (#309), parser (#304), secant (#305), Debye (#307), trapezoidal overflow (#308) and chart/platform work cover different capabilities.

Independently based on master fe1aba49b5f9538355ffaaa3d1683f69a23d2d9c. The shared alias/provider/reference files can also be edited by other catalog additions; preserve all additions when integrating. Draft for owner review and native CI; no merge performed.

Combined compatibility check — 2026-10-30

Also tested the final contributions in #311, #313, #314 and #315 together with the seven existing maintenance PRs (#304–#310), using the existing #312 candidate 189d28c0ec7acbf77d380f14f95ef450e7bfbd84 as the local integration base.

  • Complete combined Engine Release suite: 1,819 passed, zero failed/skipped.
  • Combined Python reference-authoring suite: 76 passed.
  • Windows-targeted Core.Tests and Desktop.Tests cross-builds: passed, zero errors, with existing warnings.
  • Deterministic reference check: passed, covering 1,251 articles and 1,351 completion items.

Eight shared paths required composition resolutions. These preserved all Euclid/ODE/polynomial aliases, completion and authoring registrations; Debye/unitary documentation; and Find/Replace/printing methods, test-source links and documentation entries. No feature behavior or numerical algorithm needed changing to combine the contributions. The independently published PRs remain based on master.

Combined local tree: 63225a973ea2883974a91ab26afcdc83d866e77b, SDK 10.0.403, Linux x64. The reference check used the authenticated master inventory plus current production reflection for changed entries through a portable UI shell. Native Windows tests, full native catalog execution and printer acceptance remain pending. The existing #312 PR was not changed by this local verification.

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.

1 participant