DEV Community

Fenju Fu
Fenju Fu

Posted on

Two roots, one valid size: a local Spark-X2.5-1.7B and SymPy demonstration

Two roots, one valid size: a local Spark-X2.5-1.7B and SymPy demonstration

A synthetic rectangular packaging insert has an area of 40 cm². Its length is 3 cm greater than its width. Solving the equation returns −8 and 5. The negative root is a valid algebraic solution: its corresponding length is −5, and their product is 40. Physical dimensions require another check.

In this local demonstration, Spark-X2.5-1.7B extracted two parameters from the synthetic requirement. The same saved response then entered a SymPy calculation. Positive-dimension checks left a width of 5 cm and a length of 8 cm, with the original area and gap verified.

What each project actually did

Spark-X2.5-1.7B is the language model used locally here. Its role was parameter extraction. One actual model request returned:

{"area_cm2": 40, "gap_cm": 3}
Enter fullscreen mode Exit fullscreen mode

Scientific Agent Skills is a scientific computing skill library. It appeared as the third entry in the live GitHub Trending daily snapshot captured on October 16, 2026. We followed its SymPy skill version 1.5, pinned to repository commit a1043ef544e3a100c28e70a736b6cf32554d0677: create symbols, use exact numbers, specify the solution domain and verify results.

A local demonstration adapter connects these steps. It reads the actual saved model JSON, checks the field names, integer types and permitted ranges, then constructs a SymPy expression from symbols and Integer objects. This is a locally implemented demonstration, rather than an official integration between the projects.

Original recording crop: Spark-X2.5-1.7B local request, HTTP 200 and actual integer response

Original recording crop: SymPy real roots, substitution residuals and positive 5-by-8 size

These images are direct landscape crops of model.png and solve.png, the original terminal recording end frames actually used in this episode. They show the same actual model call and the subsequent symbolic calculation reading that response. Only the frame boundaries were cropped; the output text was not changed. Both original commands exited 0. The visible data consists of public tool/model information and the synthetic test input.

Solve, substitute, then check the task constraints

Let x be the width. The length is x+3. Width times (width plus three) equals forty; the parentheses keep the whole length expression together. The original expression is:

x × (x + 3) − 40 = 0
Enter fullscreen mode Exit fullscreen mode

SymPy 1.14.0 used solveset with domain=S.Reals. It returned −8 and 5. Substituting either root into the original expression produced a residual of zero.

Width Length Original-expression residual Both dimensions positive
−8 −5 0 No
5 8 0 Yes

Filtering for positive width and length retained 5 × 8 cm. The final checks were 5×8=40 and 8−5=3. The lesson is to carry the original physical conditions through the calculation. The negative root does not show a model error.

The landscape crops above come from the actual model and solver recordings used in this episode, rec/model.mp4 and rec/solve.mp4. They add no model request.

Actual environment and evidence

This run used Windows, Python 3.12, SymPy 1.14.0 and mpmath 1.3.0. The inference tool was llama.cpp b10833 (9ac8c408a). Both the request and response identify Spark-X2.5-1.7B. The weights were ngquocvinh community Q4_K_M GGUF, derived from the public XHToken model.

The model request used temperature=0, thinking disabled and an integer-JSON schema. This demonstration recorded one actual model request with HTTP 200. The local deliverables retain the request, raw response, parameter JSON, SymPy result, command exit codes and original recordings. SymPy recorded the SHA-256 of the parameter file it consumed. The adapter uses exact integers and does not evaluate model-generated expression strings.

This synthetic example verifies a concrete data flow: requirement parameters, symbolic calculation, then original-constraint checks. Its useful result is a checkable size and an explicit reason for rejecting the other root. A single example does not establish a broader accuracy or business-performance result.

Start with the smallest check

Prepare Python with SymPy, open the pinned skill and run a real-domain solve of the same expression:

import sympy as sp
x = sp.symbols('x', real=True)
original = x * (x + sp.Integer(3)) - sp.Integer(40)
roots = sp.solveset(original, x, domain=sp.S.Reals)
print(roots)
for width in roots:
    length = width + 3
    print(width, length, sp.simplify(original.subs(x, width)),
          bool(width > 0 and length > 0))
Enter fullscreen mode Exit fullscreen mode

First check that the roots are {−8, 5} and both substitution residuals are zero. Then require positive dimensions and verify the original area and gap. To reproduce the natural-language extraction step as well, use a local Spark-X2.5-1.7B inference service and an adapter that validates integer JSON before passing it to SymPy. The demonstration scripts, model-call.mjs and solve-sizing.py, are retained in the local delivery directory. The public starting points are the linked model and skill.

Video: https://www.youtube.com/shorts/QYTkE-Np6kg

Music and licensing

Music: “Trumpet Canon and Fugue No.1293” by Michel Rondeau; composed, performed and published by Michel Rondeau (two trumpets); IMSLP #1065200; CC BY-SA 4.0. Excerpt, silence removal, crossfade, level adjustment and narration mix.

Recording source: https://imslp.org/wiki/Trumpet_Canon_and_Fugue_No.1293_(Rondeau,_Michel)#IMSLP1065200

License: https://creativecommons.org/licenses/by-sa/4.0/

The Chinese and English audiovisual edits synchronizing this recording are provided under CC BY-SA 4.0. The software and model retain their respective licenses.

Top comments (0)