| load_dataC | Load a CSV/TSV/TXT/JSON/NPY file and return its shape, preview, summary and data. |
| save_dataC | Save numeric data as CSV, JSON or NPY under the configured output directory. |
| describe_fileC | Describe one numeric column of a CSV/TSV/TXT/JSON/NPY file. |
| plot_fileC | Plot columns from a CSV/TSV/TXT/JSON/NPY file to a PNG in the output directory. |
| health_checkA | Report tool module import status and the current tool surface. |
| mixed_lmA | Fit a linear mixed-effects model with a random-effects structure. ``data`` is either a ``{column: list}`` mapping or an ``"@<path>.csv"``
reference (relative paths resolve against ``output_dir()``). ``groups``
names the grouping column. ``re_formula`` optionally describes the random
effects (e.g. ``"~1"`` for random intercepts only). ``reml`` selects REML
(default) or maximum likelihood.
Returns fixed-effect estimates with standard errors, z values and p values,
the random-intercept variance, AIC/BIC and the convergence flag.
|
| geeB | Fit a generalized estimating equation model. ``data`` is either a ``{column: list}`` mapping or an ``"@<path>.csv"``
reference. ``groups`` names the clustering column. ``family`` is one of
gaussian, binomial or poisson; ``cov_struct`` is one of independence,
exchangeable or autoregressive.
Returns population-averaged coefficients with robust standard errors,
z values and p values.
|
| monte_carloC | Sample distributions with scipy.stats and evaluate a sympy expression over the samples. ``variables`` maps each symbol used in ``expression`` to a dict whose ``dist``
entry names a scipy.stats distribution; the remaining entries are passed to
``dist.rvs`` as keyword arguments (``uniform`` additionally accepts
``low``/``high``). The same ``seed`` always reproduces the same output.
|
| solve_navier_stokes_2dA | Solve 2D incompressible Navier-Stokes on [0, 2*pi]^2 with periodic boundaries. Vorticity-streamfunction form: ``omega_t + u*omega_x + v*omega_y =
nu*laplacian(omega)``, with ``laplacian(psi) = -omega``, ``u = psi_y``,
``v = -psi_x``. The Poisson solve and all spatial derivatives use FFT
(Fourier spectral method); time integration is explicit RK2 (midpoint).
``initial_vorticity`` is a sympy expression in x and y (no Python eval).
The grid is periodic with ``nx`` x ``ny`` points and spacing
``2*pi/nx``, ``2*pi/ny``. Before stepping, the tool requires
``nu*dt/dx^2 <= 0.5`` and ``max|u|*dt/dx <= 0.5`` (``dx`` = smaller
spacing, ``dt = t_end/nt``); otherwise it returns ``err`` and asks for a
larger ``nt``. ``nx``/``ny`` are limited to 8..256 with
``nx*ny <= 65536``, and ``nt <= 100000``.
The full (t, y, x) vorticity history, grid and energy/enstrophy series are
saved to .npz. Returned arrays are downsampled to at most 50 x 50 spatial
points and 20 time levels. This is not a general CFD solver.
|
| nonlinear_mixed_lmA | Fit a nonlinear model with one random intercept per group, approximately. The model is ``y = f(x; params) + b_g + error`` where ``b_g`` is a random
intercept shared by the observations of group ``g``. ``model`` is a sympy
expression in ``x`` (the independent-variable name is always ``x``, taken
from the column named by the ``x`` argument) and the parameter names given
by the keys of ``p0``.
``data`` is either a ``{column: list}`` mapping or an ``"@<path>.csv"``
reference (relative paths resolve against ``output_dir()``). ``groups``,
``x`` and ``y`` are column names. All fixed parameters and every ``b_g``
are optimized together with ``scipy.optimize.least_squares``, minimizing
``sum((y - f(x; params) - b_g)^2) + penalty * sum(b_g^2)``. Setting
``random_effect=False`` drops the ``b_g`` terms and returns no
``random_effects`` field.
This is a **penalized least-squares approximation**, not a full nonlinear
mixed-effects marginal-likelihood fit: random-effect variance components
are not estimated, there is no integration over random effects, and no
standard errors are produced. The response always carries
``approximation: true`` and an explanatory ``note``.
|
| solve_odeB | Solve an initial-value ODE system with scipy solve_ivp. ``rhs`` is one expression (state variable ``y``) or a list of expressions
(state variables ``y0, y1, ...`` in the same order as ``y0``). The time
variable is ``t``; keys of ``params`` are injected as extra constants.
|
| optimize_minimizeA | Minimize a scalar expression with scipy.optimize.minimize. Variables are named ``x0, x1, ...`` in the order of ``x0``. When ``method``
is omitted, SLSQP is used if ``constraints`` is given, otherwise L-BFGS-B
is used if ``bounds`` is given, otherwise scipy's default (BFGS).
Each constraint is ``{"kind": "ineq"|"eq", "expr": "..."}`` where ``expr``
is a sympy expression parsed with the variables and ``params``; ``ineq``
means ``expr >= 0`` and ``eq`` means ``expr == 0``.
|
| matrix_computeC | Perform a dense linear-algebra operation on matrix a (and optional b). |
| find_rootsB | Find a scalar root of an expression using brentq (bracket) or Newton's method (x0). |
| fft_analysisC | Compute the single-sided amplitude spectrum of a real signal via numpy rfft. |
| interpolate_1dC | Interpolate y(x) at points xi using scipy interp1d (linear/quadratic/cubic). |
| global_optimizeB | Minimize a scalar expression with a global optimizer. Variables are named ``x0, x1, ...`` in the order of ``bounds`` (or ``x0``).
``method`` is ``differential_evolution`` or ``dual_annealing`` (both require
finite ``bounds``) or ``basinhopping`` (requires a starting point ``x0``).
Keys of ``params`` are injected as additional symbolic constants.
|
| dsolve_odeC | Solve an ODE analytically with sympy.dsolve, optionally with initial conditions. |
| solve_heat_1dA | Solve u_t = alpha*u_xx with explicit FTCS and configurable ends. ``nx`` is the number of spatial intervals (nx+1 grid points) and ``nt`` the
number of time steps. The scheme requires r = alpha*dt/dx^2 <= 0.5; larger
values are rejected as unstable. Each of ``left``/``right`` is either a
float (Dirichlet value) or a dict:
``{"type": "dirichlet", "value": v}``,
``{"type": "neumann", "flux": q}`` or
``{"type": "robin", "h": h, "ambient": a}``.
Sign conventions: ``flux`` is the x-derivative du/dx at the boundary, not
the outward-normal derivative. At the left end the outward normal is -x,
so the outward-normal derivative there is -flux; at the right end it is
+flux. The Robin condition uses the same x-derivative convention at both
ends: ``h*(u - ambient) + du/dx = 0`` (unit conductivity k), i.e.
``h*(u - ambient) - du/dn = 0`` on the left and
``h*(u - ambient) + du/dn = 0`` on the right. Neumann/Robin ends use ghost
nodes; Robin is applied at the new time level so that large h remains
stable. The full grid is saved as .npz, while the returned arrays are
downsampled to at most 100 spatial and 50 time points.
|
| solve_wave_1dA | Solve u_tt = c^2*u_xx with explicit central differences. ``initial_displacement`` and ``initial_velocity`` are expressions in ``x``.
The Courant condition c*dt/dx <= 1 is enforced. Each of ``left``/``right``
is either a float (Dirichlet displacement) or a dict:
``{"type": "dirichlet", "value": v}``,
``{"type": "neumann", "flux": q}`` or
``{"type": "robin", "h": h, "ambient": a}``; boundary conditions act on the
displacement. ``flux`` is du/dx at the boundary (not the outward-normal
derivative): the left outward normal is -x so its outward-normal derivative
is -flux, while the right end's is +flux. Robin means
``h*(u - ambient) + du/dx = 0`` at both ends with the same x-derivative
convention (unit conductivity k). Neumann/Robin ends use ghost
nodes, with Robin applied at the new time level for stability at large h.
The full grid is saved as .npz, while the returned arrays are downsampled
to at most 100 spatial and 50 time points.
|
| solve_laplace_2dA | Solve u_xx + u_yy = 0 on the unit square with constant Dirichlet edges. Red-black Gauss-Seidel is iterated until max|u_new-u_old| < tol. If
``max_iter`` is reached first the call still succeeds, with
``converged = False`` and the achieved ``iterations`` count. The full grid
is saved as .npz; the returned grid is downsampled to at most 100x100.
|
| solve_heat_3dA | Solve u_t = alpha*(u_xx + u_yy + u_zz) on the unit cube with explicit FTCS. ``nx``, ``ny``, ``nz`` are the number of intervals per axis (dx = 1/nx,
...) and ``nt`` the number of time steps. ``initial`` is an expression in
x, y and z; all six faces use the constant Dirichlet value ``boundary``.
The scheme requires r = alpha*dt/min(dx,dy,dz)^2 <= 1/6; larger values are
rejected as unstable. Grids above 500,000 cells are rejected. The full
(t, z, y, x) grid is saved to .npz; returned arrays are downsampled to at
most 20 points per dimension and 20 time points.
|
| solve_laplace_3dA | Solve u_xx + u_yy + u_zz = 0 on the unit cube with Dirichlet faces. ``x0``/``x1`` are the values on the faces x=0 and x=1 (likewise for y and
z). A vectorised Jacobi iteration is run until max|u_new-u_old| < tol; if
``max_iter`` is reached first the call still succeeds with
``converged = False`` and the achieved ``iterations``. Grids above 500,000
cells are rejected. The full (z, y, x) grid is saved to .npz and returned
downsampled to at most 20 points per axis.
|
| solve_burgers_1dA | Solve u_t + uu_x = nuu_xx with explicit finite differences. ``u_x`` uses a centred difference and ``u_xx`` a second-order centred
difference. ``initial`` is an expression in x; the ends use the constant
Dirichlet values ``left`` and ``right``. The explicit scheme requires
dt <= dx^2/(2*nu) (diffusion) and dt <= dx/max|u| (CFL); a violation is
reported as an error with a hint to increase nt. The full (t, x) grid is
saved to .npz and returned downsampled to at most 20 space and 20 time
points.
|
| solve_heat_1d_variableA | Solve u_t = d/dx(alpha(x) * du/dx) with an explicit flux scheme. ``alpha_expr`` is an expression in x and must be strictly positive on the
spatial grid. Face conductivities ``alpha(x_{i+1/2})`` and
``alpha(x_{i-1/2})`` are evaluated on half nodes, giving the conservative
flux form
u_i^{n+1} = u_i^n + dt/dx^2 * (
alpha_{i+1/2} (u_{i+1}^n - u_i^n)
- alpha_{i-1/2} (u_i^n - u_{i-1}^n))
The explicit scheme is rejected when ``dt * max(alpha) / dx^2 > 0.5``.
``nx`` is the number of intervals (nx+1 nodes), ``nt`` the number of time
steps. The ends use constant Dirichlet values. The full (t, x) grid is
saved to .npz; returned arrays are downsampled to at most 100 space and
50 time points.
|
| solve_pde_1dA | Solve u_t = F(x, t, u, u_x, u_xx) with an explicit Euler scheme. ``equation`` is a sympy expression for ``F`` in the symbols ``x``, ``t``,
``u``, ``u_x`` and ``u_xx``. Spatial derivatives are second-order centred
differences evaluated on the interior nodes at every step; the ends keep
the constant Dirichlet values ``left``/``right``.
This is only a *semi-general* solver: no stability condition can be
derived for arbitrary ``F``. The result therefore always contains a
``stability_note`` recommending smaller steps or a specialized solver.
If a step produces a non-finite value the solver stops and returns
``err(...)`` with the offending step number.
The full (t, x) grid is saved to .npz; returned arrays are downsampled to
at most 100 space and 50 time points.
|
| solve_wave_3dA | Solve u_tt = c^2 (u_xx + u_yy + u_zz) on the unit cube. ``nx``, ``ny``, ``nz`` are the number of intervals per axis and ``nt`` the
number of time steps. The interior uses the explicit second-order central
scheme; the first time level uses the Taylor expansion
``u(dt) = u0 + dt*v0 + c^2*dt^2/2 * Laplacian(u0)``. All six faces use the
constant Dirichlet value ``boundary``.
Stability requires ``c*dt*sqrt(3)/min(dx,dy,dz) <= 1``. Grids above
500,000 cells and histories above 20,000,000 stored points are rejected.
The full (t, z, y, x) grid is saved to .npz; returned arrays are
downsampled to at most 20 points per spatial axis and 20 time points.
|
| physical_constantA | Look up a physical constant by alias, exact name, or keyword; return value, unit and uncertainty. |
| unit_convertB | Convert a numeric value between units, including offset units such as degC. |
| unit_calculateC | Evaluate a unit-bearing arithmetic expression and return its value and unit. |
| linear_programB | Minimize c @ x subject to linear inequality/equality constraints. ``fun`` is the minimum objective value; negate ``c`` to maximize. Default
bounds are scipy's ``(0, None)`` (all variables non-negative).
|
| integer_programC | Minimize c @ x with scipy.optimize.milp (mixed-integer linear programming). ``integrality`` uses 1 for integer and 0 for continuous variables and
defaults to all-integer. ``fun`` is the minimum objective value; negate
``c`` to maximize. Default bounds are ``0 <= x <= inf``.
|
| run_pythonA | Execute Python code in a subprocess and return captured output plus produced files. Resource controls: code is limited to 100,000 characters; stdout and stderr
are each truncated to 20,000 characters. On timeout the whole process tree
is terminated (Windows: ``taskkill /F /T``) and the error result carries the
output captured so far plus ``elapsed_seconds`` and changed ``files``.
On Windows the child (and its descendants) is assigned to a Job Object with
a per-process memory cap: 2048 MiB by default, overridable with the
environment variable ``SCI_MCP_SANDBOX_MEMORY_MB`` (16..65536). Exceeding
the cap surfaces as ``MemoryError`` in ``stderr``. If the Job Object cannot
be created or assigned, execution continues without a hard memory cap. On
non-Windows platforms no hard memory cap is applied (the standard library
``resource`` module is not available on Windows and no portable equivalent
is used); rely on ``timeout_seconds`` and the caller's own limits there.
|
| filter_signalB | Filter a signal with a Butterworth design and zero-phase filtfilt. ``kind`` is lowpass, highpass, bandpass or bandstop. ``cutoff`` is in Hz;
lowpass/highpass take a scalar and bandpass/bandstop take ``[low, high]``.
|
| convolveC | Compute the discrete convolution of two signals with numpy.convolve. |
| power_spectrumC | Estimate the power spectral density with Welch's method. |
| find_peaksC | Find local maxima in a signal, optionally filtered by height, distance or prominence. |
| stftB | Compute a short-time Fourier transform and return the magnitude spectrogram. The full magnitude matrix is saved as .npz when it exceeds 100 x 100 cells.
``save_spectrogram`` additionally renders a PNG with matplotlib (Agg).
|
| sparse_computeA | Compute with sparse matrices: info, solve, matmul, transpose, norm, eigsh or svds. ``a`` accepts ``{"rows", "cols", "values", "shape"}`` triplets, an
``@<path>.mtx`` Matrix Market file, or a dense two-dimensional list.
``b`` (solve/matmul) accepts a dense vector/matrix, a sparse triplet dict,
or an ``@<path>`` reference to .mtx/.npy/.csv/.tsv/.txt/.json data.
``solver`` applies to ``operation="solve"`` only: ``"direct"`` (default,
``spsolve``), ``"cg"`` (symmetric positive definite) or ``"gmres"``
(general square). Iterative solvers use a Jacobi preconditioner when every
diagonal entry is non-zero, honour ``tol`` as the relative residual
tolerance and ``maxiter`` as the iteration cap. Passing a non-direct
``solver`` with another operation returns ``err``. Solve results include
``"solver"``, ``"iterations"`` (``null`` for direct) and ``"residual"``
(``max(abs(a @ x - b))``).
|
| t_testB | Run a one-sample, two-sample or paired t-test with an optional one-sided alternative. Samples may be passed inline or as an ``"@<path>"`` file reference.
|
| chi2_testB | Run a chi-square goodness-of-fit test (1-D) or independence test (2-D table). |
| anovaB | Run a one-way ANOVA and return the F statistic, p value and degrees of freedom. ``groups`` is a nested list of samples; ``"@<path>"`` file references are
not supported for this parameter.
|
| correlationA | Compute the Pearson, Spearman or Kendall correlation coefficient and its p value. ``x`` and ``y`` may be passed inline or as ``"@<path>"`` file references.
|
| linear_regressionA | Fit an ordinary least-squares regression, simple or multiple, and report coefficient inference. ``x`` and ``y`` may be passed inline or as ``"@<path>"`` file references;
a file for ``x`` may contain a one- or two-dimensional array.
|
| glmB | Fit a generalized linear model from a formula and a data table. ``family`` is one of gaussian, binomial, poisson, gamma, inverse_gaussian
or negativebinomial. ``data`` is either a ``{column: list}`` mapping or an
``"@<path>.csv"`` reference (relative paths resolve against ``output_dir()``).
|
| arimaB | Fit an ARIMA model and optionally forecast. ``series`` may be an inline list or an ``"@<path>"`` file reference.
``forecast_steps`` is limited to 0..10000; ``conf_alpha`` must be in (0, 1).
|
| time_series_decomposeB | Decompose a series into trend, seasonal and residual components. ``period`` must be at least 2 and smaller than the series length. The full
components are saved as ``.npz`` under ``output_dir()``; returned arrays are
evenly downsampled to at most 2000 points each.
|
| stationarity_testB | Run the Augmented Dickey-Fuller test and report stationarity at 5%. ``regression`` is one of c, ct, ctt or n. ``autolag`` is AIC, BIC, t-stat
or None (no automatic lag selection).
|
| describeB | Return descriptive statistics (mean, sample std, quartiles, skew, kurtosis) for a sample. |
| distributionC | Evaluate pdf/cdf/ppf/rvs or fit a scipy.stats distribution by attribute name. |
| curve_fitC | Fit y = model(x) to data with scipy.optimize.curve_fit using a sympy-parsed expression. |
| plotC | Render a line/scatter/hist/bar/errorbar/contour/surface plot to a PNG file. |
| cox_regressionB | Fit a Cox proportional hazards regression with statsmodels PHReg. ``formula`` contains only the covariate terms (for example ``"x1 + x2"``).
``data`` is a ``{column: list}`` mapping or an ``"@<path>.csv"`` reference.
Event indicators must be 0/1 and durations must be positive.
|
| kaplan_meierB | Estimate survival curves with the Kaplan-Meier product-limit method. ``durations`` and ``events`` may be inline lists or ``"@<path>"`` references.
``groups`` optionally supplies one group label per observation (inline list
or ``"@<path>"`` file); when given, a separate curve is returned per group.
|
| symbolic_calculusC | Perform symbolic calculus on an expression: diff, integrate, limit, series, simplify, expand, factor. |
| symbolic_solveC | Solve one equation or a system of equations symbolically for the given variables. |
| symbolic_evaluateC | Substitute numeric or symbolic-constant values into an expression and evaluate it numerically. |
| gradientC | Compute the gradient of a scalar expression with respect to the given variables. |
| divergenceC | Compute the divergence of a vector field with respect to the given variables. |
| curlC | Compute the curl of a 3-dimensional vector field. |
| laplacianB | Compute the Laplacian of a scalar expression as the sum of second derivatives. |
| wavelet_transformB | Decompose a signal with a discrete wavelet transform (pywt.wavedec). The maximum level is used when ``level`` is omitted. Full coefficient arrays
are saved to a .npz file; the return value carries lengths, energies and a
short preview of each level.
|
| wavelet_denoiseC | Denoise a signal with wavelet shrinkage. Detail coefficients are thresholded with :func:`pywt.threshold`. When
``threshold`` is omitted, the universal threshold ``sigma*sqrt(2*log(n))``
is used with ``sigma`` estimated from the finest detail coefficients via MAD.
|
| analyze_datasetC | Profile a CSV file: numeric summaries, correlations, optional target regression and plots. |
| forecastB | Forecast a univariate series with ARIMA or Holt-Winters exponential smoothing. ARIMA uses the given ``order`` (default ``[1, 0, 0]``); when
``seasonal_period`` is set the seasonal order is ``[1, 0, 0, period]``.
Exponential smoothing uses an additive trend and, when a period is given,
an additive seasonal component. ARIMA intervals are analytic; exponential
smoothing intervals are a normal approximation from the residual standard
deviation.
|