{ "cells": [ { "cell_type": "markdown", "id": "b99b9acb", "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": "2c761a13", "metadata": { "execution": { "iopub.execute_input": "2026-04-16T05:27:35.467674Z", "iopub.status.busy": "2026-04-16T05:27:35.467397Z", "iopub.status.idle": "2026-04-16T05:27:35.693410Z", "shell.execute_reply": "2026-04-16T05:27:35.692735Z" } }, "outputs": [], "source": [ "from stormvogel import parametric" ] }, { "cell_type": "markdown", "id": "45436d91", "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": "989db974", "metadata": { "execution": { "iopub.execute_input": "2026-04-16T05:27:35.695716Z", "iopub.status.busy": "2026-04-16T05:27:35.695425Z", "iopub.status.idle": "2026-04-16T05:27:35.699902Z", "shell.execute_reply": "2026-04-16T05:27:35.699302Z" } }, "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": "8bd42b56", "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": "ef86a1da", "metadata": { "execution": { "iopub.execute_input": "2026-04-16T05:27:35.701702Z", "iopub.status.busy": "2026-04-16T05:27:35.701522Z", "iopub.status.idle": "2026-04-16T05:27:35.922340Z", "shell.execute_reply": "2026-04-16T05:27:35.921743Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "
\n", "