{ "cells": [ { "cell_type": "markdown", "id": "f43cd6af-d772-43f7-a4da-30bcc41c7e50", "metadata": {}, "source": [ "## A strong, localized transient concentration becomes irrelevant with distance\n", "\n", "Diffusion of a narrow, bell-shaped, initial concentration of a single chemical. \n", "With increasing distance from the initial location of the transient signal, hardly any change with time is detected as the system goes to equilibrium" ] }, { "cell_type": "markdown", "id": "6398f935-72f9-458e-90ab-f02a05132302", "metadata": {}, "source": [ "### TAGS : \"diffusion 1D\"" ] }, { "cell_type": "code", "execution_count": 1, "id": "2b6f0de7-d66f-4f4e-8850-8a092fca20b8", "metadata": {}, "outputs": [], "source": [ "LAST_REVISED = \"Aug. 10, 2025\"\n", "LIFE123_VERSION = \"1.0.0rc6\" # Library version this experiment is based on" ] }, { "cell_type": "code", "execution_count": 2, "id": "806647d0-4c0b-4abf-8d86-53460378d93e", "metadata": {}, "outputs": [], "source": [ "#import set_path # Using MyBinder? Uncomment this before running the next cell!" ] }, { "cell_type": "code", "execution_count": 3, "id": "f6e0f263", "metadata": {}, "outputs": [], "source": [ "#import sys\n", "#sys.path.append(\"C:/some_path/my_env_or_install\") # CHANGE to the folder containing your venv or libraries installation!\n", "# NOTE: If any of the imports below can't find a module, uncomment the lines above, or try: import set_path \n", "\n", "from life123 import BioSim1D, ChemData, check_version" ] }, { "cell_type": "code", "execution_count": 4, "id": "fe26e828-4428-4754-af9b-b54739b3a109", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "OK\n" ] } ], "source": [ "check_version(LIFE123_VERSION)" ] }, { "cell_type": "code", "execution_count": null, "id": "79045ff7-ed3f-4c3a-be79-9f8a4476f3de", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 5, "id": "a7c31adc-b1b2-419e-8a09-e049e6a95f5d", "metadata": {}, "outputs": [], "source": [ "# Initialize the system\n", "chem_data = ChemData(diffusion_rates=10.) # Name \"A\" automatically assigned to only chemical\n", "\n", "bio = BioSim1D(n_bins=500, chem_data=chem_data)" ] }, { "cell_type": "code", "execution_count": 6, "id": "c984f746-d373-4a8a-89a4-9c3f0a3fca69", "metadata": {}, "outputs": [], "source": [ "# Set up the initial bell-shape concentration, with the very narrow peak close to one end of the system,\n", "# centered at 1/10 of the width of the system, i.e. at bin 50\n", "bio.inject_bell_curve(chem_label=\"A\", center=0.1, sd=0.005, amplitude=0.1, bias=10.)" ] }, { "cell_type": "code", "execution_count": null, "id": "fd77de9f-a68c-491b-a586-b4e85fcaff78", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 7, "id": "543d4c99-5d9b-4ea0-9a2d-d78b03d9b45d", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "SYSTEM STATE at Time t = 0:\n", "500 bins and 1 chemical species\n" ] }, { "data": { "text/html": [ "
| \n", " | Species | \n", "Diff rate | \n", "Bin 0 | \n", "Bin 1 | \n", "Bin 2 | \n", "Bin 3 | \n", "Bin 4 | \n", "Bin 5 | \n", "Bin 6 | \n", "Bin 7 | \n", "... | \n", "Bin 490 | \n", "Bin 491 | \n", "Bin 492 | \n", "Bin 493 | \n", "Bin 494 | \n", "Bin 495 | \n", "Bin 496 | \n", "Bin 497 | \n", "Bin 498 | \n", "Bin 499 | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "A | \n", "10.0 | \n", "10.0 | \n", "10.0 | \n", "10.0 | \n", "10.0 | \n", "10.0 | \n", "10.0 | \n", "10.0 | \n", "10.0 | \n", "... | \n", "10.0 | \n", "10.0 | \n", "10.0 | \n", "10.0 | \n", "10.0 | \n", "10.0 | \n", "10.0 | \n", "10.0 | \n", "10.0 | \n", "10.0 | \n", "
1 rows × 502 columns
\n", "| \n", " | Bin 36 | \n", "Bin 38 | \n", "Bin 40 | \n", "Bin 42 | \n", "Bin 44 | \n", "Bin 46 | \n", "Bin 48 | \n", "Bin 50 | \n", "Bin 52 | \n", "Bin 54 | \n", "Bin 56 | \n", "Bin 58 | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "10.000001 | \n", "10.000092 | \n", "10.003041 | \n", "10.053076 | \n", "10.487152 | \n", "12.351638 | \n", "15.970526 | \n", "17.972439 | \n", "15.598946 | \n", "12.068034 | \n", "10.40174 | \n", "10.041046 | \n", "