{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Glycolysis Model and Metabolic Control Analysis" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "%matplotlib inline\n", "from ecell4.prelude import *" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## A Simple Model of the Glycolysis of Human Erythrocytes" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This is a model for the glycolysis of human erythrocytes which takes into account ATP-synthesis and -consumption.\n", "This model is based on the model introduced in the following publications:" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "Heinrich R, Rapoport TA, Mathematical analysis of multienzyme systems. II. Steady state and transient control. *Bio Systems*, **1**(7), 130-6, 1975. [10.1016/0303-2647(75)90050-7](https://doi.org/10.1016/0303-2647(75)90050-7). PubMed PMID: [125616](https://www.ncbi.nlm.nih.gov/pubmed/125616)." ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "citation(125616)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "Rapoport TA, Heinrich R, Mathematical analysis of multienzyme systems. I. Modelling of the glycolysis of human erythrocytes. *Bio Systems*, **1**(7), 120-9, 1975. [10.1016/0303-2647(75)90049-0](https://doi.org/10.1016/0303-2647(75)90049-0). PubMed PMID: [168932](https://www.ncbi.nlm.nih.gov/pubmed/168932)." ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "citation(168932)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The model consists of seven reactions and is at the steady state." ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "scrolled": true }, "outputs": [], "source": [ "with reaction_rules():\n", " 2 * ATP > 2 * A13P2G + 2 * ADP | (3.2 * ATP / (1.0 + (ATP / 1.0) ** 4.0))\n", " A13P2G > A23P2G | 1500\n", " A23P2G > PEP | 0.15\n", " A13P2G + ADP > PEP + ATP | 1.57e+4\n", " PEP + ADP > ATP | 559\n", " # AMP + ATP > 2 * ADP | (1.0 * (AMP * ATP - 2.0 * ADP * ADP))\n", " AMP + ATP > 2 * ADP | 1.0 * AMP * ATP\n", " 2 * ADP > AMP + ATP | 2.0 * ADP * ADP\n", " ATP > ADP | 1.46\n", "\n", "m = get_model()" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "2 * ATP > 2 * A13P2G + 2 * ADP | ((3.2 * ATP) / (1.0 + pow((ATP / 1.0), 4.0)))\n", "A13P2G > A23P2G | 1500.0\n", "A23P2G > PEP | 0.15\n", "A13P2G + ADP > PEP + ATP | 15700.0\n", "PEP + ADP > ATP | 559.0\n", "AMP + ATP > 2 * ADP | (1.0 * AMP * ATP)\n", "2 * ADP > AMP + ATP | (2.0 * ADP * ADP)\n", "ATP > ADP | 1.46\n" ] } ], "source": [ "show(m)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "y0 = {\"A13P2G\": 0.0005082, \"A23P2G\": 5.0834, \"PEP\": 0.020502,\n", " \"AMP\": 0.080139, \"ADP\": 0.2190, \"ATP\": 1.196867}" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "ret = run_simulation(100, model=m, y0=y0)" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXgAAAEGCAYAAABvtY4XAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAUDUlEQVR4nO3dfbBkdX3n8fdnZniQETKCMyYCk0ECuqiIeEUMllEkLqKLpnQtLJO1XGtnH3Al0doY1Kwxu5u4WYuoWWPtqEQ0BkNEF4LPEpClNiIzkiBP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MAMA/VNUvTqUwaYLsJql9XpLfAR6oqndNuxZpkmyikfaQ5IHm8XlJvpzkoiTfTPLOJK9O8tUkX09ydLPd2iQXJ7m2+TllumcgDRjw0mhPYzAm/VOBXwOOraqTGAxh/B+bbd7DYOzyZwIvb16Tps42eGm0a6sZByTJ3wFfaNZ/HXh+8/w04LjBUCoAHJLk4BqM3S9NjQEvjfbg0PNdQ8u7ePj/zwrg2VX1k8UsTJqLTTTS+L4AvH73QpITpliL9I8MeGl8bwBmmgmSbwL+3bQLksBukpLUW97BS1JPGfCS1FMGvCT1lAEvST1lwEtSTxnwktRTBrwk9dT/B6eT73uR6cAWAAAAAElFTkSuQmCC\n", "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "ret" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Metabolic Control Analysis" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [], "source": [ "import numpy" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [], "source": [ "w = ret.world\n", "sim = ode.Simulator(w, m)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "First of all, `get_stoichiometry` gives a stoichiometry matrix from the given species and reactions as follows:" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([[ 2., -1., 0., -1., 0., 0., 0., 0.],\n", " [ 0., 1., -1., 0., 0., 0., 0., 0.],\n", " [ 2., 0., 0., -1., -1., 2., -2., 1.],\n", " [ 0., 0., 0., 0., 0., -1., 1., 0.],\n", " [-2., 0., 0., 1., 1., -1., 1., -1.],\n", " [ 0., 0., 1., 1., -1., 0., 0., 0.]])" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "numpy.array(get_stoichiometry(m.list_species(), m.reaction_rules()))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The `evaluate` method of `ode.ODEWorld` returns current fluxes of the given reactions." ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([1.25489042, 0.76235178, 0.76235178, 1.74742906, 2.50978084,\n", " 0.0959183 , 0.0959183 , 1.74742906])" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "numpy.array(w.evaluate(m.reaction_rules()))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`ode.ODESimulator` has methods for the fundamental properties related to metabolic control analysis." ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([5.08234520e-04, 5.08234520e+00, 2.05016233e-02, 8.01410043e-02,\n", " 2.18995778e-01, 1.19686922e+00])" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "x = numpy.array(sim.values())\n", "x" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([ 0.00000000e+00, -7.32716110e-11, -1.27009514e-13, 1.07631959e-12,\n", " 1.09356968e-12, -2.16981988e-12])" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dxdt = numpy.array(sim.derivatives())\n", "dxdt" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([[-4.93823371e+03, 0.00000000e+00, 0.00000000e+00,\n", " 0.00000000e+00, -7.97928197e+00, -3.54260035e+00],\n", " [ 1.50000000e+03, -1.50000000e-01, 0.00000000e+00,\n", " 0.00000000e+00, 0.00000000e+00, 0.00000000e+00],\n", " [ 3.43823371e+03, 1.50000000e-01, -1.22418640e+02,\n", " 0.00000000e+00, -3.48112548e+00, 0.00000000e+00],\n", " [ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n", " -1.19686922e+00, 8.75985548e-01, -8.01410043e-02],\n", " [-3.43823371e+03, 0.00000000e+00, -1.22418640e+02,\n", " 2.39373844e+00, -2.11916605e+01, -1.92231834e+00],\n", " [ 3.43823371e+03, 0.00000000e+00, 1.22418640e+02,\n", " -1.19686922e+00, 2.03156750e+01, 2.00245935e+00]])" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "J = numpy.array(sim.jacobian())\n", "J" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([[ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n", " 0.00000000e+00, 0.00000000e+00, -1.77130018e+00],\n", " [ 1.50000000e+03, 0.00000000e+00, 0.00000000e+00,\n", " 0.00000000e+00, 0.00000000e+00, 0.00000000e+00],\n", " [ 0.00000000e+00, 1.50000000e-01, 0.00000000e+00,\n", " 0.00000000e+00, 0.00000000e+00, 0.00000000e+00],\n", " [ 3.43823371e+03, 0.00000000e+00, 0.00000000e+00,\n", " 0.00000000e+00, 7.97928197e+00, 0.00000000e+00],\n", " [ 0.00000000e+00, 0.00000000e+00, 1.22418640e+02,\n", " 0.00000000e+00, 1.14604074e+01, 0.00000000e+00],\n", " [ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n", " 1.19686922e+00, 0.00000000e+00, 8.01410043e-02],\n", " [ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n", " 0.00000000e+00, 8.75985548e-01, 0.00000000e+00],\n", " [ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n", " 0.00000000e+00, 0.00000000e+00, 1.46000000e+00]])" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "E = numpy.array(sim.elasticity())\n", "E" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`ode.ODESimulator` also provides a stoichiometry matrix and fluxes." ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([[ 2., -1., 0., -1., 0., 0., 0., 0.],\n", " [ 0., 1., -1., 0., 0., 0., 0., 0.],\n", " [ 0., 0., 1., 1., -1., 0., 0., 0.],\n", " [ 0., 0., 0., 0., 0., -1., 1., 0.],\n", " [ 2., 0., 0., -1., -1., 2., -2., 1.],\n", " [-2., 0., 0., 1., 1., -1., 1., -1.]])" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "S = numpy.array(sim.stoichiometry())\n", "S" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([1.25489042, 0.76235178, 0.76235178, 1.74742906, 2.50978084,\n", " 0.0959183 , 0.0959183 , 1.74742906])" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "v = numpy.array(sim.fluxes())\n", "v" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "These properties satisfy some relations at the steady state." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$\\frac{\\mathrm{d}}{\\mathrm{d}t}\\mathbf{x} = \\mathbf{S} \\mathbf{v}$" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([ True, True, True, True, True, True])" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "numpy.isclose(dxdt, S @ v)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$\\mathbf{J} = \\frac{\\mathrm{d}^2}{\\mathrm{d}t^2}\\mathbf{x} = \\mathbf{S}\\left(\\frac{\\mathrm{d}}{\\mathrm{d}t}\\mathbf{v}\\right) = \\mathbf{S} \\mathbf{E}$" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([[ True, True, True, True, True, True],\n", " [ True, True, True, True, True, True],\n", " [ True, True, True, True, True, True],\n", " [ True, True, True, True, True, True],\n", " [ True, True, True, True, True, True],\n", " [ True, True, True, True, True, True]])" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "numpy.isclose(J, S @ E)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Next, the `ecell4.mca` submodule provides useful functions for metabolic network and control analyses." ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [], "source": [ "from ecell4.mca import *" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`generate_full_rank_matrix` gives square matrix to be full rank. In this model, 5 out of 8 reactions are independent." ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[[ 1. 0. 0. 0. 0.]\n", " [ 0. 1. 0. 0. 0.]\n", " [ 0. 0. 1. 0. 0.]\n", " [ 0. 0. 0. 1. 0.]\n", " [ 0. 0. 0. 0. 1.]\n", " [ 0. 0. 0. -1. -1.]]\n", "[[-0. -0. 0.5]\n", " [-0. -1. 1. ]\n", " [-0. -1. 1. ]\n", " [-0. 1. 0. ]\n", " [ 0. 0. 1. ]\n", " [ 1. 0. 0. ]\n", " [ 1. 0. 0. ]\n", " [ 0. 1. 0. ]]\n", "[0 1 2 3 4]\n" ] } ], "source": [ "(link_matrix, kernel_matrix, independent_list) = generate_full_rank_matrix(S)\n", "print(link_matrix)\n", "print(kernel_matrix)\n", "print(independent_list)" ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([[ 2., -1., 0., -1., 0., 0., 0., 0.],\n", " [ 0., 1., -1., 0., 0., 0., 0., 0.],\n", " [ 0., 0., 1., 1., -1., 0., 0., 0.],\n", " [ 0., 0., 0., 0., 0., -1., 1., 0.],\n", " [ 2., 0., 0., -1., -1., 2., -2., 1.]])" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "reduced_matrix = numpy.take(S, independent_list, 0)\n", "reduced_matrix" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The original stoichiometry matrix can be reproduced from these reduced matrices:" ] }, { "cell_type": "code", "execution_count": 24, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([[ True, True, True, True, True, True, True, True],\n", " [ True, True, True, True, True, True, True, True],\n", " [ True, True, True, True, True, True, True, True],\n", " [ True, True, True, True, True, True, True, True],\n", " [ True, True, True, True, True, True, True, True],\n", " [ True, True, True, True, True, True, True, True]])" ] }, "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ "S == link_matrix @ reduced_matrix" ] }, { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([[ True, True, True],\n", " [ True, True, True],\n", " [ True, True, True],\n", " [ True, True, True],\n", " [ True, True, True],\n", " [ True, True, True]])" ] }, "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ "0 == S @ kernel_matrix" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Finally, `ecell4.mca` provides two functions, `unscaled_control_coefficients` and `scaled_control_coefficients`, which calculate concentration and flux control coefficients from stoichiometry and elasticity matrices." ] }, { "cell_type": "code", "execution_count": 26, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[[ 4.45754267e-04 -2.22877134e-04 0.00000000e+00 -1.93612289e-04\n", " 0.00000000e+00 -7.45294400e-04 7.45294400e-04 -2.92648441e-05]\n", " [ 4.45754267e+00 4.43789533e+00 -6.66666667e+00 -1.93612289e+00\n", " 0.00000000e+00 -7.45294400e+00 7.45294400e+00 -2.92648441e-01]\n", " [ 2.20583561e-02 -2.86048736e-03 0.00000000e+00 1.24794630e-03\n", " -8.16869067e-03 -4.03592231e-02 4.03592231e-02 -4.10843366e-03]\n", " [-1.22757774e-01 6.13788871e-02 0.00000000e+00 -2.67777988e-02\n", " 0.00000000e+00 -5.85505375e-01 5.85505375e-01 8.81566859e-02]\n", " [-1.43377537e-01 7.16887683e-02 0.00000000e+00 -3.12756961e-02\n", " 0.00000000e+00 3.62033276e-01 -3.62033276e-01 1.02964464e-01]\n", " [ 2.66135311e-01 -1.33067655e-01 0.00000000e+00 5.80534949e-02\n", " 0.00000000e+00 2.23472099e-01 -2.23472099e-01 -1.91121150e-01]]\n", "[[ 5.28594477e-01 2.35702761e-01 0.00000000e+00 -1.02830166e-01\n", " 0.00000000e+00 -3.95836168e-01 3.95836168e-01 3.38532927e-01]\n", " [ 6.68631401e-01 6.65684300e-01 0.00000000e+00 -2.90418434e-01\n", " 0.00000000e+00 -1.11794160e+00 1.11794160e+00 -4.38972662e-02]\n", " [ 6.68631401e-01 6.65684300e-01 1.11022302e-16 -2.90418434e-01\n", " 0.00000000e+00 -1.11794160e+00 1.11794160e+00 -4.38972662e-02]\n", " [ 3.88557554e-01 -1.94278777e-01 0.00000000e+00 8.47581026e-02\n", " 0.00000000e+00 3.26269264e-01 -3.26269264e-01 7.20963121e-01]\n", " [ 1.05718895e+00 4.71405523e-01 0.00000000e+00 -2.05660332e-01\n", " 0.00000000e+00 -7.91672336e-01 7.91672336e-01 6.77065854e-01]\n", " [-1.25596650e-01 6.27983250e-02 0.00000000e+00 -2.73970578e-02\n", " 0.00000000e+00 3.17135918e-01 6.82864082e-01 9.01953828e-02]\n", " [-1.25596650e-01 6.27983250e-02 0.00000000e+00 -2.73970578e-02\n", " 0.00000000e+00 3.17135918e-01 6.82864082e-01 9.01953828e-02]\n", " [ 3.88557554e-01 -1.94278777e-01 0.00000000e+00 8.47581026e-02\n", " 0.00000000e+00 3.26269264e-01 -3.26269264e-01 7.20963121e-01]]\n" ] } ], "source": [ "ccc, fcc = unscaled_control_coefficients(S, E)\n", "print(ccc)\n", "print(fcc)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Unscaled control coefficients satisfies connectivity theorem:" ] }, { "cell_type": "code", "execution_count": 27, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([[ True, True, True, True, True],\n", " [ True, True, True, True, True],\n", " [ True, True, True, True, True],\n", " [ True, True, True, True, True],\n", " [ True, True, True, True, True],\n", " [ True, True, True, True, True],\n", " [ True, True, True, True, True],\n", " [ True, True, True, True, True]])" ] }, "execution_count": 27, "metadata": {}, "output_type": "execute_result" } ], "source": [ "numpy.isclose(fcc @ (E @ link_matrix), 0)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "and" ] }, { "cell_type": "code", "execution_count": 28, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([[ True, True, True, True, True],\n", " [ True, True, True, True, True],\n", " [ True, True, True, True, True],\n", " [ True, True, True, True, True],\n", " [ True, True, True, True, True]])" ] }, "execution_count": 28, "metadata": {}, "output_type": "execute_result" } ], "source": [ "numpy.isclose(numpy.take(ccc, independent_list, 0) @ (E @ link_matrix), -numpy.identity(link_matrix.shape[1]))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "On the other hand, scaled control coefficients" ] }, { "cell_type": "code", "execution_count": 29, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[[ 1.10061937 -0.3343157 0. -0.6656843 0. -0.14065824\n", " 0.14065824 -0.10061937]\n", " [ 1.10061937 0.6656843 -1. -0.6656843 0. -0.14065824\n", " 0.14065824 -0.10061937]\n", " [ 1.35017697 -0.10636707 0. 0.10636707 -1. -0.18882349\n", " 0.18882349 -0.35017697]\n", " [-1.92220644 0.58387469 0. -0.58387469 0. -0.70077336\n", " 0.70077336 1.92220644]\n", " [-0.82158249 0.2495576 0. -0.2495576 0. 0.15856752\n", " -0.15856752 0.82158249]\n", " [ 0.27903688 -0.0847581 0. 0.0847581 0. 0.01790928\n", " -0.01790928 -0.27903688]]\n", "[[ 5.28594477e-01 1.43190526e-01 0.00000000e+00 -1.43190526e-01\n", " 0.00000000e+00 -3.02559747e-02 3.02559747e-02 4.71405523e-01]\n", " [ 1.10061937e+00 6.65684300e-01 0.00000000e+00 -6.65684300e-01\n", " 0.00000000e+00 -1.40658239e-01 1.40658239e-01 -1.00619373e-01]\n", " [ 1.10061937e+00 6.65684300e-01 1.11022302e-16 -6.65684300e-01\n", " 0.00000000e+00 -1.40658239e-01 1.40658239e-01 -1.00619373e-01]\n", " [ 2.79036879e-01 -8.47581026e-02 0.00000000e+00 8.47581026e-02\n", " 0.00000000e+00 1.79092784e-02 -1.79092784e-02 7.20963121e-01]\n", " [ 5.28594477e-01 1.43190526e-01 0.00000000e+00 -1.43190526e-01\n", " 0.00000000e+00 -3.02559747e-02 3.02559747e-02 4.71405523e-01]\n", " [-1.64316956e+00 4.99116585e-01 0.00000000e+00 -4.99116585e-01\n", " 0.00000000e+00 3.17135918e-01 6.82864082e-01 1.64316956e+00]\n", " [-1.64316956e+00 4.99116585e-01 0.00000000e+00 -4.99116585e-01\n", " 0.00000000e+00 3.17135918e-01 6.82864082e-01 1.64316956e+00]\n", " [ 2.79036879e-01 -8.47581026e-02 0.00000000e+00 8.47581026e-02\n", " 0.00000000e+00 1.79092784e-02 -1.79092784e-02 7.20963121e-01]]\n" ] } ], "source": [ "ccc, fcc = scaled_control_coefficients(S, E, v, x)\n", "print(ccc)\n", "print(fcc)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "satisfies summation theorem:" ] }, { "cell_type": "code", "execution_count": 30, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([ True, True, True, True, True, True])" ] }, "execution_count": 30, "metadata": {}, "output_type": "execute_result" } ], "source": [ "numpy.isclose(ccc.sum(axis=1), 0)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "and" ] }, { "cell_type": "code", "execution_count": 31, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([ True, True, True, True, True, True, True, True])" ] }, "execution_count": 31, "metadata": {}, "output_type": "execute_result" } ], "source": [ "numpy.isclose(fcc.sum(axis=1), 1)" ] } ], "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.7.1" } }, "nbformat": 4, "nbformat_minor": 1 }