{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# This notebook demonstrates some functionality of MuMoT when working with one-dimensional systems. " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import mumot\n", "\n", "mumot.__version__\n", "mumot.about()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## This model corresponds to the normal form of a pitchfork bifurcation in 1D #######" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "model1 = mumot.parseModel(r\"\"\"\n", "\\emptyset + \\alpha_\\beta -> \\alpha_\\beta + \\alpha_\\beta : r\n", "\\alpha_\\beta + \\alpha_\\beta + \\alpha_\\beta -> \\emptyset + \\emptyset + \\emptyset : b\n", "\"\"\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "model1.showODEs()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "model1.showMasterEquation()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "model1.showVanKampenExpansion()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "model1.showFokkerPlanckEquation()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "model1.showODEs(method='vanKampen')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "model1.showODEs()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "model1.showNoiseEquations()" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "scrolled": true }, "outputs": [], "source": [ "model1.showNoiseSolutions()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "mint1 = model1.integrate(initWidgets={'maxTime': [10,1,50,1]})" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "mint1.showLogs()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "model1.noiseCorrelations(initWidgets={'maxTime': [10,1,50,1]})" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "bif1 = model1.bifurcation('r', r'\\alpha_\\beta')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "bif1.showLogs()" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "scrolled": false }, "outputs": [], "source": [ "mc1 = mumot.MuMoTmultiController([model1.integrate(params=[('b',2)], choose_yrange=[0,1], silent=True),\n", " model1.integrate(params=[('b',1)], choose_yrange=[0,1], silent=True)],\n", " shareAxes = False, silent=False);" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "mc1.showLogs()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "mumot.MuMoTmultiController([model1.integrate(initWidgets={'maxTime':[10,5,50,1], \n", " 'initialState':{'\\\\alpha_\\\\beta': [0.3,0,1,0.01]}},\n", " conserved=False, silent=True),\n", " model1.noiseCorrelations(initWidgets={'maxTime':[10,5,50,1], \n", " 'initialState':{'\\\\alpha_\\\\beta': [0.5,0,1,0.01]}},\n", " conserved=False, silent=True)], shareAxes = False)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## This model is from van Kampen's book (1985, pp. 254), where analytical resultsare available for comparison (it works!)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "model2 = mumot.parseModel(r\"\"\"\n", "(A) -> X : k\n", "X + X -> \\emptyset + \\emptyset : h\n", "\"\"\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "model2.show()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "model2.showODEs()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "model2.showODEs(method='vanKampen')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "model2.showMasterEquation()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "model3 = model2.substitute('h = v, k = m')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "model3.showODEs()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "model3.showODEs(method='vanKampen')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "model3.showNoiseEquations()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "model3.showNoiseSolutions()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "model2.integrate()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "model3.integrate()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "model3.showStoichiometry()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "model2.showStoichiometry()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "model2.noiseCorrelations()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "model3.bifurcation('A','X')" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.5.4" }, "toc": { "nav_menu": {}, "number_sections": true, "sideBar": true, "skip_h1_title": false, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": false, "toc_position": {}, "toc_section_display": true, "toc_window_display": false } }, "nbformat": 4, "nbformat_minor": 2 }