Engineering verification function with localized pass/fail indicators.
Compares two expressions (already evaluated to numeric values) using a test function and displays a formatted message based on the pass/fail status. Return message can be templated as Latex object. The most common case is to be passed to a show_eqn function as secondary dict (the object will be formatted according to cell_formatter specification).
NOTE: if the test cannot evaluate to either True or False, an error will be raised. Common cause for this is that one of the arguments passed are not in the numeric form, but still in symbolic form.
Parameters
Name
Type
Description
Default
lhs
int | float
evaluated left-hand side expression (e.g., calculated stress or utilization ratio).
required
rhs
int | float
evaluated right-hand side expression (e.g., allowable limit or capacity).
required
test
type
Comparison function from SymPy’s relational module. Options: - Le: LessThan (default, less than or equal) - Ge: GreaterThan (greater than or equal) - Lt: StrictLessThan (strictly less than) - Gt: StrictGreaterThan (strictly greater than) - Eq: Equality - Ne: Unequality Defaults to Le (less than or equal to).
Le
template
TemplateChoice | None
Named template set for formatting. Options: “default”, “boxed”, “minimal”. Controls visual presentation of verification result.
None
success_template
str | None
Custom template string for passing checks. Available variables: {symbol}, {rhs}, {verified_text}, {color}, {test_result}, {result_text}.
None
failure_template
str | None
Custom template string for failing checks. Same variables as success_template.
None
**kwargs
Any
Additional keyword arguments: - language (str): Document-level language override (e.g., ‘it’, ‘de’, ‘fr’) - substitutions (dict): Custom translation dictionary for “VERIFIED”/“NOT_VERIFIED”
{}
Returns
Name
Type
Description
Latex
IPython.display.Latex object that depends on conditions (true or false).
from keecas import show_eqn# Capacity check (demand <= capacity)N_Ed, N_Rd = symbols(r"N_{Ed}, N_{Rd}")_p = {N_Ed: 850*u.kN, N_Rd: 1200*u.kN}_e = { k: k | pc.subs(_p) | pc.N for k in [N_Ed/N_Rd]}_c = { k: check(v, 1.0) for k, v in _e.items()}# use along show_eqnshow_eqn([_p | _e, _c])