{ "cells": [ { "cell_type": "markdown", "id": "e345497b", "metadata": {}, "source": [ "# Parametric and Interval Models\n", "In this notebook, we will show how to create and work with parametric and interval models.\n", "## Parametric Models" ] }, { "cell_type": "code", "execution_count": 1, "id": "196b7968", "metadata": { "execution": { "iopub.execute_input": "2026-03-26T10:41:58.939599Z", "iopub.status.busy": "2026-03-26T10:41:58.939436Z", "iopub.status.idle": "2026-03-26T10:41:59.166786Z", "shell.execute_reply": "2026-03-26T10:41:59.166077Z" } }, "outputs": [], "source": [ "from stormvogel import parametric" ] }, { "cell_type": "markdown", "id": "a86f74a9", "metadata": {}, "source": [ "Polynomials are represented as dictionaries where the keys are the exponents and the values are coefficients. In addition, we must also supply a list of variable names. Rational functions are then represented as a pair of two polynomials (numerator and denominator)." ] }, { "cell_type": "code", "execution_count": 2, "id": "11a9656d", "metadata": { "execution": { "iopub.execute_input": "2026-03-26T10:41:59.168977Z", "iopub.status.busy": "2026-03-26T10:41:59.168700Z", "iopub.status.idle": "2026-03-26T10:41:59.173148Z", "shell.execute_reply": "2026-03-26T10:41:59.172630Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "x^2 + y^2\n", "2.0*1 + z + 6.0*z^3\n", "(x^2 + y^2)/(2.0*1 + z + 6.0*z^3)\n" ] } ], "source": [ "polynomial1 = parametric.Polynomial([\"x\", \"y\"])\n", "polynomial1.add_term((2, 0), 1)\n", "polynomial1.add_term((0, 2), 1)\n", "\n", "print(polynomial1)\n", "\n", "polynomial2 = parametric.Polynomial([\"z\"])\n", "polynomial2.add_term((0,), 2)\n", "polynomial2.add_term((1,), 1)\n", "polynomial2.add_term((3,), 6)\n", "\n", "print(polynomial2)\n", "\n", "rational_function = parametric.RationalFunction(polynomial1, polynomial2)\n", "\n", "print(rational_function)" ] }, { "cell_type": "markdown", "id": "a8d71243", "metadata": {}, "source": [ "To create a parametric model (e.g. pmc or pmdp) we simply have to set such a value as a transition probability. As an example, we provide the knuth yao dice, but with parameters instead of concrete probabilities." ] }, { "cell_type": "code", "execution_count": 3, "id": "f0ea2ddc", "metadata": { "execution": { "iopub.execute_input": "2026-03-26T10:41:59.174883Z", "iopub.status.busy": "2026-03-26T10:41:59.174697Z", "iopub.status.idle": "2026-03-26T10:41:59.398706Z", "shell.execute_reply": "2026-03-26T10:41:59.398119Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "
\n", "