Expressions, dimensions, and transforms

Use Numeric expression functions and check dimensional compatibility, transforms, and evaluation requirements.

Numerical computing, models, statistics, and Datasets with Python

Represent quantities

Declare symbols, units, and the domain before evaluating. The grammar supports the documented operations and scalar parameters. To evaluate x+y with both inputs in meters, explicitly request millimeters with output_unit='mm'. Adding meters to seconds triggers a dimensional error. Before taking the logarithm of a measurement, form a dimensionless ratio with a strictly positive reference in the same units.

Local root finding

To check a root, use a finite interval and compare the residual with the declared tolerance. A finite scan may miss tangential roots or jumps. Release the handle of a registered Python function in finally. For a declared model, query modelKinds first. The solver builds the function from the type and data in the recipe.

Operation reference

Jump to an operation

expression_evaluate

Access
Registered in the Python Job
Arguments
expression text, symbol scalar/vector map, symbol unit map, optional output_unit options
Units
Units follow NUMERIC_API_v1 operation contract
Result
finite real values, output unit and shared dimensional receipt; no code evaluation
Effect
Evaluate bounded pointwise expressions through shared CORE grammar units and Numeric
Types
text,struct,struct
Declared shape
finite_real_scalar_or_equal_vectors_max65536
Expansion
scalar_expansion
Options
output_unit=explicit_linear_unit
Nonfinite values
error
Units rule
CORE_UNIT_DIMENSION_API_v1
gxtxt_api_call("NUMERIC_API_v1", "expression_evaluate", args)
Recorded result · expression_evaluate

Download the example script (ZIP).

Example operands, preview

[
  "x+y",
  {
    "x": {
      "shape": [
        2
      ],
      "dtype": "float64",
      "values": [
        1.0,
        2.0
      ]
    },
    "y": 1.0
  },
  {
    "x": "m",
    "y": "m"
  },
  {
    "output_unit": "mm"
  }
]

Result, preview

{
  "schema": "gxtxt.numeric_expression.v1",
  "values": {
    "shape": [
      2,
      1
    ],
    "dtype": "float64",
    "values": [
      2000.0,
      3000.0
    ]
  },
  "unit": "mm",
  "dimensions": {
    "schema": "gxtxt.expression_dimensions.v1",
    "expression": "x+y",
    "symbol_units": {
      "x": "m",
      "y": "m",
      "pi": "1",
      "e": "1"
    },
    "symbol_scales": {
      "x": 1.0,
      "y": 1.0
    },
    "inferred_parameter_ids": [],
    "used_symbols": [
      "x",
      "y"
    ],
    "output_unit": "mm",
    "output_scale": 0.001,
    "dimensions": {
      "m": 1.0
    },
    "dimension_label": "m",
    "normalization": "explicit_symbol_to_canonical_then_output_scale",
    "variable_exponent_policy": "dimensionless_base_and_exponent",
    "constraint_count": 2.0
  },
  "expression": "x+y",
  "symbol_ids": [
    "x",
    "y"
  ],
  "domain_policy": "finite_real_or_error",
  "grammar_owner": "CORE gxtxt_analysis_expression_parse",
  "numeric_owner": "NUMERIC_API_v1"
}
Negative test or attempted call · expression_evaluate:incompatible-unit

Download the example script (ZIP).

Example operands, preview

[
  "x+y",
  {
    "x": 1.0,
    "y": 1.0
  },
  {
    "x": "m",
    "y": "s"
  }
]

Result, preview

"GXTXT:UnitDimensions: Incompatible dimensions in expression or requested output unit"

expression_analyze

Access
Registered in the Python Job
Arguments
request with expression, variable, finite interval, scalar symbols, symbol_units and mode; optional tolerances/evaluation budget
Units
Units follow NUMERIC_API_v1 operation contract
Result
classified candidates, residuals, physical units and exact evaluation budget; finite sampling is not a completeness proof
Effect
Analyze bounded expressions with existing Numeric roots and minimization and honest sampling limits
Types
struct
Declared shape
explicit_interval_scalar_parameters
Options
sample_count=5..4097;max_evaluations=5..65536;max_iterations=1..256;x_tolerance=positive;response_tolerance=positive;output_unit=explicit_linear_unit
Nonfinite values
error
Units rule
CORE_UNIT_DIMENSION_API_v1
gxtxt_api_call("NUMERIC_API_v1", "expression_analyze", args)
Recorded result · expression_analyze

Download the example script (ZIP).

Example operands, preview

[
  {
    "expression": "x^2-4",
    "variable": "x",
    "interval": [
      -3.0,
      3.0
    ],
    "symbol_units": {
      "x": "1"
    },
    "symbols": {},
    "mode": "roots"
  }
]

Result, preview

{
  "schema": "gxtxt.numeric_expression_analysis.v1",
  "mode": "roots",
  "status": "roots_found",
  "expression": "x^2-4",
  "expression2": "",
  "variable": "x",
  "interval": {
    "shape": [
      2,
      1
    ],
    "dtype": "float64",
    "values": [
      -3.0,
      3.0
    ]
  },
  "variable_unit": "1",
  "response_unit": "1",
  "roots": {
    "shape": [
      2,
      1
    ],
    "dtype": "float64",
    "values": [
      -2.0,
      2.0
    ]
  },
  "root_residuals": {
    "shape": [
      2,
      1
    ],
    "dtype": "float64",
    "values": [
      0.0,
      0.0
    ]
  },
  "root_kinds": [
    "sign_change_verified",
    "sign_change_verified"
  ],
  "extrema_x": {
    "shape": [
      0,
      0
    ],
    "dtype": "float64",
    "values": []
  },
  "extrema_y": {
    "shape": [
      0,
      0
    ],
    "dtype": "float64",
    "values": []
  },
  "extrema_kinds": [],
  "domain_endpoints": {
    "shape": [
      2,
      1
    ],
    "dtype": "float64",
    "values": [
      -3.0,
      3.0
    ]
  },
  "endpoint_values": {
    "shape": [
      2,
      1
    ],
    "dtype": "float64",
    "values": [
      5.0,
      5.0
    ]
  },
  "sample_count": 129.0
}

log_ratio

Access
Registered in the Python Job
Arguments
values, positive reference in the same units
Units
Units follow NUMERIC_API_v1 operation contract
Result
unchanged-shape log values and reference receipt
Effect
Natural log of positive values divided by an explicit same-unit reference
Types
array,scalar
Declared shape
same_as_input
Nonfinite values
error
Units rule
dimensionless_ratio
gxtxt_api_call("NUMERIC_API_v1", "log_ratio", args)
Recorded result · log_ratio

Download the example script (ZIP).

Example operands, preview

[
  {
    "shape": [
      4
    ],
    "dtype": "float64",
    "values": [
      1.0,
      2.0,
      3.0,
      4.0
    ]
  },
  1.0
]

Result, preview

{
  "schema": "gxtxt.log_ratio.v1",
  "values": {
    "shape": [
      4,
      1
    ],
    "dtype": "float64",
    "values": [
      0.0,
      0.6931471805599453,
      1.0986122886681098,
      1.3862943611198906
    ]
  },
  "n": 4.0,
  "reference": 1.0,
  "base": "natural",
  "input_shape": {
    "shape": [
      1,
      2
    ],
    "dtype": "float64",
    "values": [
      4.0,
      1.0
    ]
  },
  "method": "dimensionless_natural_log_with_log1p_near_reference"
}

log_response_retransform

Access
Registered in the Python Job
Arguments
log predictions, explicit reference and optional variance/interval facts
Units
Units follow NUMERIC_API_v1 operation contract
Result
physical arrays, bounded method and eligibility facts; CORE owns interpretation
Effect
Physical response retransformation with explicit median mean and captured interval facts
Types
array
Declared shape
same_as_input
Options
reference=positive_scalar;log_standard_deviation=nonnegative_scalar;lower=array;upper=array;interval_kind=none,log_mean_confidence,log_new_observation;confidence=probability
Nonfinite values
paired_nan_interval_gaps
Units rule
physical_response
gxtxt_api_call("NUMERIC_API_v1", "log_response_retransform", args)
Recorded result · log_response_retransform

Download the example script (ZIP).

Example operands, preview

[
  {
    "shape": [
      4
    ],
    "dtype": "float64",
    "values": [
      0.0,
      0.6931471805599453,
      1.0986122886681098,
      1.3862943611198906
    ]
  },
  {
    "reference": 1.0
  }
]

Result, preview

{
  "schema": "gxtxt.log_response_retransform.v1",
  "n": 4.0,
  "reference": 1.0,
  "base": "natural",
  "median": {
    "shape": [
      4,
      1
    ],
    "dtype": "float64",
    "values": [
      1.0,
      2.0,
      3.0000000000000004,
      4.0
    ]
  },
  "mean": {
    "shape": [
      0,
      0
    ],
    "dtype": "float64",
    "values": []
  },
  "log_standard_deviation": {
    "shape": [
      0,
      0
    ],
    "dtype": "float64",
    "values": []
  },
  "log_bias_correction": {
    "shape": [
      0,
      0
    ],
    "dtype": "float64",
    "values": []
  },
  "mean_available": false,
  "lower": {
    "shape": [
      0,
      0
    ],
    "dtype": "float64",
    "values": []
  },
  "upper": {
    "shape": [
      0,
      0
    ],
    "dtype": "float64",
    "values": []
  },
  "interval_kind": "none",
  "confidence": {
    "shape": [
      0,
      0
    ],
    "dtype": "float64",
    "values": []
  },
  "interval_available_count": 0.0,
  "method": "monotone_exponential_of_dimensionless_log_response"
}
Negative test or attempted call · log_response_retransform

Download the example script (ZIP).

Result, preview

"GXTXT:Numeric:InvalidArguments: Logarithmic operations require values and explicit reference/options"

expression_dimensions

Access
Registered in the Python Job
Arguments
expression, symbol_units, optional output_unit and unknown_parameter_ids
Units
Units follow NUMERIC_API_v1 operation contract
Result
versioned CORE dimensions and symbol-scale receipt without evaluating scientific data
Effect
Validate expression dimensions and infer uniquely determined parameter units
Types
text,struct,text,cell
Declared shape
bounded_symbol_metadata
Nonfinite values
error
Units rule
CORE_UNIT_DIMENSION_API_v1
gxtxt_api_call("NUMERIC_API_v1", "expression_dimensions", args)
Recorded result · expression_dimensions

Download the example script (ZIP).

Example operands, preview

[
  "a*x",
  {
    "a": "1",
    "x": "m"
  },
  "m"
]

Result, preview

{
  "schema": "gxtxt.expression_dimensions.v1",
  "expression": "a*x",
  "symbol_units": {
    "a": "1",
    "x": "m"
  },
  "symbol_scales": {
    "a": 1.0,
    "x": 1.0
  },
  "inferred_parameter_ids": [],
  "used_symbols": [
    "a",
    "x"
  ],
  "output_unit": "m",
  "output_scale": 1.0,
  "dimensions": {
    "m": 1.0
  },
  "dimension_label": "m",
  "normalization": "explicit_symbol_to_canonical_then_output_scale",
  "variable_exponent_policy": "dimensionless_base_and_exponent",
  "constraint_count": 1.0
}

foundation

Access
Registered in the Python Job
Arguments
family, action, three typed operands or execution-scoped callback handles, optional options struct
Units
Units follow NUMERIC_API_v1 operation contract
Result
structured mathematical result
Effect
Vector tensor grid calculus geometry sparse equations variational statistics ODE and special-function foundation
Types
typed_nodes
Declared shape
action_specific
Options
method=action_specific;extrapolation=error,nan,nearest
Nonfinite values
error
Units rule
caller_owned
gxtxt_api_call("NUMERIC_API_v1", "foundation", args)
Recorded result · family.parameter_interpolate

Download the example script (ZIP).

Example operands, preview

[
  "family",
  "parameter_interpolate",
  {
    "kind": "array",
    "shape": [
      2,
      1
    ],
    "real": [
      0.0,
      1.0
    ]
  },
  {
    "kind": "array",
    "shape": [
      2,
      2
    ],
    "real": [
      0.0,
      1.0,
      2.0,
      5.0
    ]
  },
  {
    "kind": "array",
    "shape": [
      2,
      1
    ],
    "real": [
      0.25,
      0.75
    ]
  }
]

Result, preview

{
  "value_real": {
    "shape": [
      2,
      2
    ],
    "dtype": "float64",
    "values": [
      0.5,
      2.0,
      1.5,
      4.0
    ]
  },
  "value_imaginary": {
    "shape": [
      2,
      2
    ],
    "dtype": "float64",
    "values": [
      0.0,
      0.0,
      0.0,
      0.0
    ]
  },
  "parameter": {
    "shape": [
      2,
      1
    ],
    "dtype": "float64",
    "values": [
      0.25,
      0.75
    ]
  }
}
Negative test or attempted call · variational.constrained:callback-boundary

Download the example script (ZIP).

Result, preview

"GXTXT:Numeric:CallbackRequired: variational.constrained requires the original in-process Octave function handle or its admitted typed model declaration"