{"id":13760378,"url":"https://github.com/sicmutils/sicmutils","last_synced_at":"2025-12-12T01:21:41.803Z","repository":{"id":37988745,"uuid":"23800451","full_name":"sicmutils/sicmutils","owner":"sicmutils","description":"Computer Algebra, Physics and Differential Geometry in Clojure.","archived":false,"fork":false,"pushed_at":"2024-03-22T05:30:38.000Z","size":5840,"stargazers_count":809,"open_issues_count":13,"forks_count":69,"subscribers_count":30,"default_branch":"main","last_synced_at":"2025-04-12T14:57:28.204Z","etag":null,"topics":["clojure","differential-geometry","hamiltonian","lagrangian","physics","physics-simulation","sussman","symbolic-differentiation","symbolic-math"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sicmutils.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"sritchie"}},"created_at":"2014-09-08T17:20:51.000Z","updated_at":"2025-04-11T21:49:29.000Z","dependencies_parsed_at":"2024-08-03T13:14:56.341Z","dependency_job_id":null,"html_url":"https://github.com/sicmutils/sicmutils","commit_stats":{"total_commits":1111,"total_committers":19,"mean_commits":"58.473684210526315","dds":0.3366336633663366,"last_synced_commit":"02e7a6edaab345e5c6a516f663ecaeb6507cda26"},"previous_names":["littleredcomputer/sicmutils"],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sicmutils%2Fsicmutils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sicmutils%2Fsicmutils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sicmutils%2Fsicmutils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sicmutils%2Fsicmutils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sicmutils","download_url":"https://codeload.github.com/sicmutils/sicmutils/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248586250,"owners_count":21128997,"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":["clojure","differential-geometry","hamiltonian","lagrangian","physics","physics-simulation","sussman","symbolic-differentiation","symbolic-math"],"created_at":"2024-08-03T13:01:08.978Z","updated_at":"2025-12-12T01:21:41.739Z","avatar_url":"https://github.com/sicmutils.png","language":"Clojure","readme":"# SICMUtils\n\nA Clojure(script) implementation of the\n[scmutils](https://groups.csail.mit.edu/mac/users/gjs/6946/refman.txt) system\nfor math and physics investigations in the Clojure and ClojureScript languages.\nSICMUtils provides facilities for\n\n- [symbolic\n  computation](https://cljdoc.org/d/sicmutils/sicmutils/CURRENT/doc/data-types/symbolic-expressions),\n  including state of the art TeX rendering and [expression\n  simplification](https://cljdoc.org/d/sicmutils/sicmutils/CURRENT/doc/simplification)\n- [automatic](https://cljdoc.org/d/sicmutils/sicmutils/CURRENT/doc/calculus/automatic-differentiation),\n  [numerical](https://cljdoc.org/d/sicmutils/sicmutils/CURRENT/doc/numerical-methods/numerical-derivative)\n  and\n  [symbolic](https://cljdoc.org/d/sicmutils/sicmutils/CURRENT/doc/calculus/automatic-differentiation)\n  differentiation\n- [numerical integration and\n  optimization](https://cljdoc.org/d/sicmutils/sicmutils/CURRENT/doc/numerical-methods)\n- investigations in [differential\n  geometry](https://cljdoc.org/d/sicmutils/sicmutils/CURRENT/doc/textbooks/functional-differential-geometry)\n  and [Lagrangian and Hamiltonian\n  mechanics](https://cljdoc.org/d/sicmutils/sicmutils/CURRENT/doc/textbooks/structure-and-interpretation-of-classical-mechanics)\n\nAnd implementations of many different [mathematical\nobjects](https://cljdoc.org/d/sicmutils/sicmutils/CURRENT/doc/data-types), all\nbuilt on a tower of [generic, extensible mathematical\noperations](https://cljdoc.org/d/sicmutils/sicmutils/CURRENT/doc/basics/generics).\n\nScmutils is extensively used in the textbooks [The Structure and Interpretation\nof Classical Mechanics][SICM] and [Functional Differential Geometry][FDG] by\nG.J. Sussman and J. Wisdom.\n\n\u003e :wave: Need help getting started? Say hi on\n\u003e [Twitter](https://twitter.com/sritchie) or [Clojurians\n\u003e Slack](http://clojurians.net/) in\n\u003e [#sicmutils](https://clojurians.slack.com/archives/C01ECA9AA74).\n\n[![Build Status](https://github.com/sicmutils/sicmutils/workflows/Clojure%20CI/badge.svg?branch=main)](https://github.com/sicmutils/sicmutils/actions?query=workflow%3A%22Clojure+CI%22)\n[![License](https://img.shields.io/badge/license-GPLv3-brightgreen.svg)](https://github.com/sicmutils/sicmutils/blob/main/LICENSE)\n[![Codecov branch](https://img.shields.io/codecov/c/github/sicmutils/sicmutils/main.svg?maxAge=3600)](https://codecov.io/github/sicmutils/sicmutils)\n[![cljdoc badge](https://cljdoc.org/badge/sicmutils/sicmutils)](https://cljdoc.org/d/sicmutils/sicmutils/CURRENT)\n[![Clojars Project](https://img.shields.io/clojars/v/sicmutils/sicmutils.svg)](https://clojars.org/sicmutils/sicmutils)\n\n## Quickstart\n\n\u003e SICMUtils is best experienced in an interactive environment like the\n\u003e [REPL](https://clojure.org/guides/repl/introduction). We [support many\n\u003e environments](https://cljdoc.org/d/sicmutils/sicmutils/CURRENT/doc/basics/how-to-use-sicmutils)\n\u003e with rich support for [TeX](https://en.wikipedia.org/wiki/TeX) rendering and\n\u003e plotting.\n\nInstall SICMUtils into your Clojure(script) project using the instructions at\nits Clojars page:\n\n[![Clojars Project](https://img.shields.io/clojars/v/sicmutils/sicmutils.svg)](https://clojars.org/sicmutils/sicmutils)\n\nInitialize the `sicmutils.env` \"Batteries Included\" environment at the REPL:\n\n```clojure\n(require '[sicmutils.env :as env])\n(env/bootstrap-repl!)\n```\n\nSee the [demo directory](./demo) for minimal examples of build configurations\nthat use the SICMUtils library.\n\nAlternatively, visit the [SICMUtils Tutorial on\nNextjournal](https://nextjournal.com/try/samritchie/sicmutils) to try all of the\nexamples below in your browser with no setup required:\n\n\u003cimg width=\"1152\" alt=\"nje\" src=\"https://user-images.githubusercontent.com/462255/109587851-9e1be280-7abc-11eb-9369-6d56519fb3cd.png\"\u003e\n\nMath works as expected (see\n[Generics](https://cljdoc.org/d/sicmutils/sicmutils/CURRENT/doc/basics/generics)\nfor the full menu of operations), but notice that the numeric tower includes\n[complex\nnumbers](https://cljdoc.org/d/sicmutils/sicmutils/CURRENT/doc/data-types/complex),\nand proper ratios in ClojureScript:\n\n```clojure\n(- (* 7 (/ 1 2)) 2)\n;;=\u003e 3/2\n\n(asin -10)\n;;=\u003e #sicm/complex [-1.5707963267948966 2.9932228461263786]\n```\n\nSymbols are interpreted as abstract complex numbers, and arithmetic on them\ngenerates symbolic expressions. You can render these with\n[`-\u003eTeX`](https://cljdoc.org/d/sicmutils/sicmutils/CURRENT/api/sicmutils.expression.render#-\u003eTeX)\nand\n[`-\u003einfix`](https://cljdoc.org/d/sicmutils/sicmutils/CURRENT/api/sicmutils.expression.render#-\u003einfix):\n\n```clojure\n(def render (comp -\u003einfix simplify))\n\n(square (sin (+ 'a 3)))\n;;=\u003e (expt (sin (+ a 3)) 2)\n\n(render (square (sin (+ 'a 3))))\n;;=\u003e \"sin²(a + 3)\"\n```\n\nUse the\n[`D`](https://cljdoc.org/d/sicmutils/sicmutils/CURRENT/api/sicmutils.calculus.derivative#D)\noperator to perform [forward-mode automatic\ndifferentiation](https://cljdoc.org/d/sicmutils/sicmutils/CURRENT/doc/calculus/automatic-differentiation)\nand\n[`simplify`](https://cljdoc.org/d/sicmutils/sicmutils/CURRENT/doc/simplification)\nto collapse symbolic expressions into tidy form:\n\n```clojure\n((D cube) 'x)\n;;=\u003e  (+ (* x (+ x x)) (* x x))\n\n(simplify ((D cube) 'x))\n;;=\u003e (* 3 (expt x 2))\n\n(-\u003einfix\n (simplify ((D cube) 'x)))\n;;-\u003e \"3 x²\"\n```\n\nSICMUtils is based on the engine behind [The Structure and Interpretation of\nClassical Mechanics][SICM], and has a built-in API for exploring Lagrangian and\nHamiltonian mechanics.\n\nDefine a [Lagrangian](https://en.wikipedia.org/wiki/Lagrangian_mechanics) for a\ncentral potential `U` acting on a particle with mass `m`:\n\n```clojure\n(defn L-central-polar [m U]\n  (fn [[_ [r] [rdot thetadot]]]\n    (- (* 1/2 m\n          (+ (square rdot)\n             (square (* r thetadot))))\n       (U r))))\n```\n\nand generate the two [Euler-Lagrange equations of\nmotion](https://en.wikipedia.org/wiki/Lagrangian_mechanics#Euler–Lagrange_equations_and_Hamilton's_principle)\nfor the `r` and `theta` coordinates:\n\n```clojure\n(let [potential-fn (literal-function 'U)\n      L     (L-central-polar 'm potential-fn)\n      state (up (literal-function 'r)\n                (literal-function 'theta))]\n  (render\n   (((Lagrange-equations L) state) 't)))\n;;=\u003e \"down(- m r(t) (Dθ(t))² + m D²r(t) + DU(r(t)), m (r(t))² D²θ(t) + 2 m r(t) Dr(t) Dθ(t))\"\n```\n\nThere is so much more! This is a dense library, and lots of documentation\nremains to be written. Some suggested next steps, for now:\n\n- Open up the live, interactive [SICMUtils tutorial on\nNextjournal](https://nextjournal.com/try/samritchie/sicmutils), play with the\nexamples above and start to explore on your own.\n- Read the [SICMUtils Reference Manual][REFMAN] (\"refman\") for inspiration. All\n  of the code snippets in the refman will work in the [Nextjournal\n  environment](https://nextjournal.com/try/samritchie/sicmutils). Use the two\n  together.\n- Visit our [CLJDocs][CLJDOCS] page for an introduction and detailed\n  documentation\n- Watch Colin's [\"Physics in Clojure\"][PHYSICS_IN_CLOJURE] talk for an overview\n  of SICMUtils and its implementation\n- Visit the HTML version of [Structure and Interpretation of Classical\n  Mechanics](https://tgvaughan.github.io/sicm/). Many of the SICM exercises have\n  been worked using SICMUtils; they live at [this Nextjournal\n  page](https://nextjournal.com/sicm).\n\n## Background\n\n[SICM][SICM] and [FDG][FDG] can be thought of as spiritual successors to [The\nStructure and Interpretation of Computer Programs][SICP], a very influential\ntext—as I can attest, since carefully reading this book in my 30s changed my\nlife as a programmer. To see the same techniques applied to differential\ngeometry and physics is an irresistible lure.\n\nScmutils is an excellent system, but it is written in an older variant of LISP\n(Scheme) and is tied to a particular implementation of Scheme—MIT/GNU Scheme.\n(There is a [port to Guile][GSCM], but due to the fact that Guile does not\nsupport MIT Scheme's [apply\nhooks](https://www.gnu.org/software/mit-scheme/documentation/stable/mit-scheme-ref/Application-Hooks.html)\nsome glue code is required to run examples from the book in that environment.)\n\nHaving the system in Clojure offers a number of advantages. It is not necessary\nto obtain or prepare a MIT/GNU Scheme executable to execute: only a Java runtime\nis required. It does not require the X Window System for graphics, as MIT Scheme\ndoes. All of the standard tooling for Java and Clojure become available, and\nthis is a lot compared to what we get with MIT/GNU scheme. Clojure support is\nnow extensive in any number of editors and IDEs. Even better, you can interact\nwith the system in the context of a [Jupyter notebook](./jupyter).\n\nYou can invoke the system from within Java or Javascript code or use any Java or\nJS packages you like together with the mathematics system. It's my hope that\ncontinuing this project will extend the reach of SICM and FDG by allowing\nexperimentation and collaboration with them in modern environments.\n\n## Citing SICMUtils\n\nTo cite this repository, see the \"Cite this Repository\" link on the top right of\nthe Github page. Citation information is generated from\n[`CITATION.cff`](CITATION.cff).\n\nHere is the generated BibTeX entry:\n\n```\n@software{Ritchie_SICMUtils_Functional_Computer_2016},\nauthor = {Ritchie, Sam and Smith, Colin},\nlicense = {GPL-3.0},\nmonth = {4},\ntitle = {{SICMUtils: Functional Computer Algebra in Clojure}},\nurl = {https://github.com/sicmutils/sicmutils},\nversion = {0.23.0},\nyear = {2016}\n```\n\nIn the above BibTeX entry, the version number is intended to be that from\n[project.clj](./project.clj), and the year corresponds to the project's\nopen-source release.\n\n## License\n\n[GPL v3](LICENSE).\n\n[CLJDOCS]: https://cljdoc.org/d/sicmutils/sicmutils/CURRENT\n[SICM]: https://mitpress.mit.edu/books/structure-and-interpretation-classical-mechanics-second-edition\n[FDG]: http://mitpress.mit.edu/books/functional-differential-geometry\n[SICP]: http://mitpress.mit.edu/sicp/\n[GSCM]: http://www.cs.rochester.edu/~gildea/guile-scmutils/\n[REFMAN]: https://cljdoc.org/d/sicmutils/sicmutils/CURRENT/doc/reference-manual\n[PHYSICS_IN_CLOJURE]: https://www.youtube.com/watch?v=7PoajCqNKpg\n\nCopyright © 2016 Colin Smith\n","funding_links":["https://github.com/sponsors/sritchie"],"categories":["Clojure"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsicmutils%2Fsicmutils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsicmutils%2Fsicmutils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsicmutils%2Fsicmutils/lists"}