Data and Math

vcontrol

Transfer functions for control systems, written as plain lists of coefficients.

Released v1.0.0 · 2026-09-28
Import
use "stdlib/control.ven"
vcontrol.ven
print transfer_function([1.0], [1.0, 1.0])
Reference (11 functions)

API reference

transfer_function(numerator, denominator)

Builds a transfer function from numerator and denominator coefficient Lists.

transfer_function([1.0], [1.0, 1.0])

evaluate_polynomial(coefficients, x)

Evaluates a polynomial with the given coefficients at x using Horner's method.

evaluate_polynomial([1.0, 2.0, 3.0], 2.0)

polynomial_roots(coefficients, who)

Solves for the roots of a constant, linear, or quadratic polynomial.

polynomial_roots([1.0, 5.0, 6.0], "poles")

poles(tf)

Gives back a transfer function's poles: the roots of its denominator.

poles(([1.0], [1.0, 3.0, 2.0]))

zeros(tf)

Gives back a transfer function's zeros: the roots of its numerator.

zeros(([2.0, 4.0], [1.0, 1.0]))

is_stable(tf)

Tests whether every pole of a transfer function has a strictly negative real part.

is_stable(([1.0], [1.0, 1.0]))

simulate_response(tf, duration, steps, is_impulse)

Simulates a step or impulse response by Euler-discretizing the transfer function's ODE.

simulate_response(([1.0], [1.0, 1.0]), 2.0, 4, no)

step_response(tf, duration, steps)

Simulates the unit step response of a transfer function by Euler integration.

step_response(([1.0], [1.0, 1.0]), 2.0, 4)

impulse_response(tf, duration, steps)

Simulates the impulse response of a transfer function by Euler integration.

impulse_response(([1.0], [1.0, 1.0]), 2.0, 4)

pid_controller(kp, ki, kd)

Builds a new PID controller with the given gains and zeroed running state.

pid_controller(1.0, 0.5, 0.1)

pid_update(pid, error, dt)

Advances a PID controller by one time step, mutating and returning its output.

pid_update(pid_controller(1.0, 0.5, 0.1), 2.0, 0.1)

Get notified when vcontrol changes

Get notified about

New versions and security advisories.

New and updated packages, once a day.

News on the math model built in Venutian.