{"id":19636595,"url":"https://github.com/barton-willis/operator_algebra","last_synced_at":"2026-02-07T15:33:33.854Z","repository":{"id":110177258,"uuid":"348808535","full_name":"barton-willis/operator_algebra","owner":"barton-willis","description":"A Maxima package for operator algebra","archived":false,"fork":false,"pushed_at":"2024-09-19T10:55:25.000Z","size":121,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-20T04:56:25.122Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Common Lisp","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/barton-willis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-17T18:14:36.000Z","updated_at":"2024-09-19T10:55:29.000Z","dependencies_parsed_at":"2024-09-17T22:38:56.861Z","dependency_job_id":"90721584-c124-4904-bf8a-452c31f855b3","html_url":"https://github.com/barton-willis/operator_algebra","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/barton-willis/operator_algebra","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barton-willis%2Foperator_algebra","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barton-willis%2Foperator_algebra/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barton-willis%2Foperator_algebra/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barton-willis%2Foperator_algebra/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/barton-willis","download_url":"https://codeload.github.com/barton-willis/operator_algebra/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barton-willis%2Foperator_algebra/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29198178,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T14:35:27.868Z","status":"ssl_error","status_checked_at":"2026-02-07T14:25:51.081Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-11-11T12:29:55.907Z","updated_at":"2026-02-07T15:33:33.840Z","avatar_url":"https://github.com/barton-willis.png","language":"Common Lisp","readme":"# A Maxima package for operator algebra\n\nThis is a package for handling operator algebra within the Maxima Computer Algebra System, with a particular emphasis on quantum mechanical operators.\n\n### Installation\n\nTo install the `operator_algebra` package:\n\n1. Copy the `operator_algebra` folder to a location where Maxima can find it.\n2. If needed, add new entries to the `file_search_maxima` and `file_search_lisp` lists so that Maxima can locate the package.\n3. Load the package manually using the following command:\n\n```\n(%i1)  load(\"operator_algebra\")$\n```\n\n### Documentation\n\nThe user documentation is located in the doc folder. Additionally, a demo file is included. To run this demo, append the path to the `operator_algebra` package to `file_search_demo`. Now you \nshould be able to run the demo using the commands:\n```\n(%i1) load(operator_algebra)$\n(%i2) batch(demo_qm_operators,'demo);\n```\n\n### Basic usage\n\nOperator composition is denoted by `.`, which is Maxima's generic noncommutative multiplication operator, and the composition of an operator with itself is denoted by `^^`, which\nis  Maxima's generic noncommutative exponentiation operator.\n\nTo declare that a symbol is an operator, use the Maxima function `declare`. Additionally, we will declare some constants:\n\n```\n(%i1)\tdeclare([f,g],operator)$\n(%i2)\tdeclare([α,β], constant)$\n```\nNow we can compute some commutators:\n```\n(%i3)\tcommutator(α*f, β*g);\n(%o3)\tα*β*(f . g) - α*β*(g . f)\n\n(%i4)\tcommutator(f, f);\n(%o4)\t0\n\n(%i5)\tcommutator(f,f^^2);\n(%o5)\t0\n\n(%i6)\tcommutator(f + g, g);\n(%o6)\t-(g . (g + f)) + g^^2 + f . g\n\n(%i7)\texpand(%);\n(%o7)\tf . g - g . f\n```\nIn the last example, you need to manually apply expand to simplify the result.\nAlternatively, the user can automatically expand results by setting the option variable dotdistrib to `true:`\n```\n(%i8)\tblock([dotdistrib : true], commutator(f + g, g));\n(%o8)\tf . g - g . f\n```\n\nTo assign a formula to an operator,  use `put`. For example, to define an operator `Dx`\nthat differentiates with respect to `x` and an operator `X` that multiplies an expression \nby `x`, we first need to declare `Dx` and `X` as operators. Next, we define the functions for these operators with put:\n```\n(%i1)\tdeclare(Dx, operator, X, operator)$\n\n(%i2)\tput(Dx, lambda([q], diff(q,x)), 'formula);\n(%o2)\tlambda([q],'diff(q,x,1))\n\n(%i3)\tput(X, lambda([q],  x*q), 'formula);\n(%o3)\tlambda([q],x*q)\n```\nThe function `operator_apply` applies a function to an argument:\n```\n(%i4)\toperator_apply(Dx, x^2);\n(%o4)\tDx(x^2)\n```\nTo use the formula for `Dx`, apply the function `operator_express`:\n```\n(%i5)\toperator_express(%);\n(%o5)\t2*x\n```\nHere is an example that uses both operators `Dx` and `X`:\n```\n(%i6)\toperator_apply(X.Dx.X, x^2);\n(%o6)\tX(Dx(X(x^2)))\n\n(%i7)\toperator_express(%);\n(%o7)\t3*x^3\n```\n\nIn output `(%o6)` above, we see that `operator_apply` effectively changes the dotted notation\nfor function composition (in this case `X.Dx.X` to traditional parenthesized function\nnotation `X(Dx(X(x^2)))`. The traditional notation allows the use of the `simplifying` \npackage to define operators as simplifying functions. \n\nWe will start by loading the simplifying package and defining predicates that detect whether the main operator\nof an expression is `Dx` or `X`. \n```\n(%i1)\tload(simplifying)$\n\n(%i2)\tDx_p(e) := not mapatom(e) and inpart(e,0) = 'Dx$\n\n(%i3)\tX_p(e) := not mapatom(e) and inpart(e,0) = 'X$\n```\nAfter that, we can define a simplification function for `Dx` that applies the rule \n`Dx . X = Dx + X . Dx`. Our code is\n```\n(%i4)\tsimp_Dx (e) := block([],\n\t    /* Dx . X = Dx + X.Dx */\n\t    if X_p(e) then (\n\t        Dx(first(e)) + X(Dx(first(e))))\n\t   else simpfuncall(Dx,e))$\n\t    \n(%i5)\tsimplifying('Dx, 'simp_Dx)$\n```\nSome simple examples:\n```\n(%i6)\toperator_simp(Dx . X);\n(%o6)\tX . Dx + Dx\n\n(%i7)\tblock([dotdistrib : true], operator_simp(Dx . X^^2 - X^^2 . Dx));\n(%o7)\t2*(X . Dx) + Dx\n```\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarton-willis%2Foperator_algebra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbarton-willis%2Foperator_algebra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarton-willis%2Foperator_algebra/lists"}