{"id":16927768,"url":"https://github.com/bjodah/batemaneq","last_synced_at":"2025-04-11T17:43:22.865Z","repository":{"id":57414160,"uuid":"41328138","full_name":"bjodah/batemaneq","owner":"bjodah","description":"The Bateman equation in C++ and a Python wrapper thereof.","archived":false,"fork":false,"pushed_at":"2020-03-09T21:53:52.000Z","size":6803,"stargazers_count":4,"open_issues_count":2,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-25T13:46:01.813Z","etag":null,"topics":["analytic","arbitrary-precision","decay"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bjodah.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGES.rst","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-24T21:33:38.000Z","updated_at":"2020-03-09T21:52:34.000Z","dependencies_parsed_at":"2022-08-26T20:44:29.185Z","dependency_job_id":null,"html_url":"https://github.com/bjodah/batemaneq","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjodah%2Fbatemaneq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjodah%2Fbatemaneq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjodah%2Fbatemaneq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjodah%2Fbatemaneq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bjodah","download_url":"https://codeload.github.com/bjodah/batemaneq/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248429122,"owners_count":21101785,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analytic","arbitrary-precision","decay"],"created_at":"2024-10-13T20:35:02.400Z","updated_at":"2025-04-11T17:43:22.848Z","avatar_url":"https://github.com/bjodah.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"batemaneq\n=========\n\n.. image:: http://hera.physchem.kth.se:9090/api/badges/bjodah/batemaneq/status.svg\n   :target: http://hera.physchem.kth.se:9090/bjodah/batemaneq\n   :alt: Build status\n.. image:: https://img.shields.io/pypi/v/batemaneq.svg\n   :target: https://pypi.python.org/pypi/batemaneq\n   :alt: PyPI version\n.. image:: https://img.shields.io/badge/python-2.7,3.4,3.5-blue.svg\n   :target: https://www.python.org/\n   :alt: Python version\n.. image:: https://img.shields.io/pypi/l/batemaneq.svg\n   :target: https://github.com/bjodah/batemaneq/blob/master/LICENSE\n   :alt: License\n.. image:: http://hera.physchem.kth.se/~batemaneq/branches/master/htmlcov/coverage.svg\n   :target: http://hera.physchem.kth.se/~batemaneq/branches/master/htmlcov\n   :alt: coverage\n\n\n``batemaneq`` provides a `C++ implementation \u003cinclude/bateman.hpp\u003e`_ of the `Bateman equation \u003chttps://en.wikipedia.org/wiki/Bateman_Equation\u003e`_,\nand a `Python \u003chttp://www.python.org\u003e`_ bidning thereof.\n\nDocumentation\n-------------\nAutogenerated API documentation is found here: `\u003chttp://hera.physchem.kth.se/~batemaneq/branches/master/html\u003e`_\n\nInstallation\n------------\nSimplest way to install batemaneq and is to use `pip` (requires a C++11 compliant compiler to be installed for the C++ version):\n\n::\n\n   $ pip install batemaneq\n\nor using the `conda package manager \u003chttp://conda.pydata.org/docs/\u003e`_:\n\n::\n\n   $ conda install -c bjodah batemaneq pytest\n   $ python -m pytest --pyargs batemaneq\n\n\nExamples\n--------\nSee `examples/ \u003chttps://github.com/bjodah/batemaneq/tree/master/examples\u003e`_, and rendered jupyter notebooks here:\n`\u003chttp://hera.physchem.kth.se/~batemaneq/branches/master/examples\u003e`_\n\n\nThe Thorium series\n^^^^^^^^^^^^^^^^^^\nHalf-lives shorter than 1h excluded from the `decay chain \u003chttps://en.wikipedia.org/wiki/Decay_chain\u003e`_:\n\nIn Python:\n\n.. code:: python\n\n   \u003e\u003e\u003e from batemaneq import bateman_parent\n   \u003e\u003e\u003e from math import log as ln\n   \u003e\u003e\u003e d = 1./365  # Th-232 Ra-228 Ac-228 Th-228\n   \u003e\u003e\u003e h = d/24    # Ra-224 Pb-212 Bi-212 (Pb-208)\n   \u003e\u003e\u003e Thalf = [1.405e10, 5.75, 6.25*h, 1.9116, 3.6319*d, 10.64*h, 60.55/60*h]\n   \u003e\u003e\u003e bateman_parent([ln(2)/x for x in Thalf], 100)  # 100 years\n   [0.9999999950665681, 4.0925028658312447e-10, 5.078051001187696e-14, 1.3605575316895603e-10, 7.082081172329036e-13, 8.64484883194704e-14, 8.199335787638167e-15]\n\nIn C++:\n\n.. code:: C++\n\n   #include \u003ccmath\u003e\n   #include \u003ciostream\u003e\n   #include \u003ciomanip\u003e\n   #include \u003cvector\u003e\n   #include \"bateman.hpp\"\n\n   using vec_t = std::vector\u003cdouble\u003e;\n   double exp_cb(double arg){\n       return std::exp(arg);\n   }\n\n   int main(){\n      double one = 1;\n      double d = one/365;\n      double h = d/24;\n      double ln2 = std::log(2);\n      vec_t lmbd {{ ln2/1.405e10, ln2/5.75, ln2/(6.25*h),\n          ln2/1.9116, ln2/(3.6319*d), ln2/(10.64*h), ln2/(60.55/60*h) }};\n      auto p = bateman::bateman_parent(lmbd, 100.0, exp_cb);\n      std::cout \u003c\u003c std::setprecision(17);  // all significant digits\n      for (auto v : p)\n          std::cout \u003c\u003c v \u003c\u003c \" \";\n      std::cout \u003c\u003c std::endl;\n      return 0;\n   }\n\n::\n\n   $ g++ -std=c++11 double.cpp -I../include\n   $ ./a.out\n   0.99999999506656811 4.0925028658312447e-10 5.0780510011876959e-14 1.3605575316895603e-10 7.0820811723290359e-13 8.6448488319470398e-14 8.1993357876381666e-15\n\nIn C++ using ``boost::multiprecision::cpp_dec_float_50``:\n\n.. code:: C++\n\n   #include \u003ccmath\u003e\n   #include \u003ciostream\u003e\n   #include \u003cvector\u003e\n   #include \u003cboost/multiprecision/cpp_dec_float.hpp\u003e\n   #include \"bateman.hpp\"\n\n   using Real_t = boost::multiprecision::cpp_dec_float_50;\n   using vec_t = std::vector\u003cReal_t\u003e;\n   Real_t exp_cb(Real_t arg){\n       return boost::multiprecision::exp(arg);\n   }\n\n   int main(){\n      Real_t one = 1;\n      Real_t d = one/365;\n      Real_t h = d/24;\n      Real_t ln2 = boost::multiprecision::log(2*one);\n      vec_t lmbd {{ ln2/1.405e10, ln2/5.75, ln2/(6.25*h),\n          ln2/1.9116, ln2/(3.6319*d), ln2/(10.64*h), ln2/(60.55/60*h) }};\n      auto p = bateman::bateman_parent(lmbd, static_cast\u003cReal_t\u003e(100), exp_cb);\n      std::cout \u003c\u003c std::setprecision(30);  // show 30 of our 50 digits\n      for (auto v : p)\n          std::cout \u003c\u003c v \u003c\u003c \" \";\n      std::cout \u003c\u003c std::endl;\n      return 0;\n   }\n\n\n::\n\n   $ g++ -std=c++11 multi.cpp -I../include\n   $ ./a.out\n   0.999999995066568122063002778128 4.09250286583124398565537707859e-10 5.07805100118769662240802082504e-14 1.3605575316895606205575997585e-10 7.08208117232903695657287769184e-13 8.6448488319470425326824303941e-14 8.19933578763816849146541981927e-15\n\nWe see that the concentration of the final nuclide only varies in the 15th decimal place (we had no catastropic cancelation in this example).\n\nLicense\n=======\nThe source code is Open Source and is released under the very permissive\n\"simplified (2-clause) BSD license\". See ``LICENSE.txt`` for further details.\n\nContributors are welcome to suggest improvements at https://github.com/bjodah/batemaneq\n\nAuthor\n======\nBjörn I. Dahlgren, contact:\n\n- gmail address: bjodah\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbjodah%2Fbatemaneq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbjodah%2Fbatemaneq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbjodah%2Fbatemaneq/lists"}