code wiki / (root) / nx_calc.nx

nx_calc.nx

buildroot/runtime/nx_calc.nx

6367 B147 linesdepth 6pulls 6 transitivereach 8 importersview sourcekind librarytopic calc
docsdependenciesstructsconstsfunctions

about

nx_calc.nx -- symbolic calculus engine. Native NishiLang symbolic differentiation by structural recursion over Term values. No third-party CAS; output is itself a *Term that downstream proofs can manipulate via SUBST/EQ_TRANS in the v2 kernel. Patent-clean implementation: standard derivative rules from any calculus textbook.

dependencies 1 imports · 4 importers

nx_kernel_v2.nx nx_calc.nx nx_calc_integrate.nx nx_calc_series.nx nx_calc_solve.nx nx_capabilities_test.nx

imports: nx_kernel_v2.nx

imported by: nx_calc_integrate.nxnx_calc_series.nxnx_calc_solve.nxnx_capabilities_test.nx

structs

none

consts

19const NX_CALC_SYM_X: nx_int = 414001 // distinguished variable
20const NX_CALC_SYM_ADD: nx_int = 414002
21const NX_CALC_SYM_SUB: nx_int = 414003
22const NX_CALC_SYM_MUL: nx_int = 414004
23const NX_CALC_SYM_DIV: nx_int = 414005
24const NX_CALC_SYM_POW: nx_int = 414006
25const NX_CALC_SYM_NEG: nx_int = 414007
26const NX_CALC_SYM_SIN: nx_int = 414008
27const NX_CALC_SYM_COS: nx_int = 414009
28const NX_CALC_SYM_EXP: nx_int = 414010
29const NX_CALC_SYM_LN: nx_int = 414011
30const NX_CALC_SYM_CONST: nx_int = 414012 // wraps an integer literal

functions

33func nx_calc_var(var_id: nx_int) -> *Term
calls 1: nx_term_var
37func nx_calc_const_int(n: nx_int) -> *Term
43func nx_calc_x() -> *Term { return nx_term_var(NX_CALC_SYM_X) }
45func nx_calc_bin(sym: nx_int, a: *Term, b: *Term) -> *Term
54func nx_calc_un(sym: nx_int, a: *Term) -> *Term
60func nx_calc_add(a: *Term, b: *Term) -> *Term { return nx_calc_bin(NX_CALC_SYM_ADD, a, b) }
61func nx_calc_sub(a: *Term, b: *Term) -> *Term { return nx_calc_bin(NX_CALC_SYM_SUB, a, b) }
62func nx_calc_mul(a: *Term, b: *Term) -> *Term { return nx_calc_bin(NX_CALC_SYM_MUL, a, b) }
63func nx_calc_pow(a: *Term, b: *Term) -> *Term { return nx_calc_bin(NX_CALC_SYM_POW, a, b) }
64func nx_calc_sin(a: *Term) -> *Term { return nx_calc_un(NX_CALC_SYM_SIN, a) }
65func nx_calc_cos(a: *Term) -> *Term { return nx_calc_un(NX_CALC_SYM_COS, a) }
66func nx_calc_exp(a: *Term) -> *Term { return nx_calc_un(NX_CALC_SYM_EXP, a) }
67func nx_calc_ln(a: *Term) -> *Term { return nx_calc_un(NX_CALC_SYM_LN, a) }
called by 1: nx_calc_integrate calls 1: nx_calc_un
90func nx_calc_deriv(t: *Term, var_id: nx_int) -> *Term