{"id":17674687,"url":"https://github.com/dedoussis/algebrain","last_synced_at":"2025-06-26T07:02:35.899Z","repository":{"id":44084895,"uuid":"197836576","full_name":"dedoussis/algebrain","owner":"dedoussis","description":"algebra + typescript = 💙","archived":false,"fork":false,"pushed_at":"2022-12-09T22:02:08.000Z","size":1762,"stargazers_count":7,"open_issues_count":17,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-08T20:53:26.736Z","etag":null,"topics":["algebra","cas","compiler","mathematics","symbolic","symbolic-computation","transformations","typescript"],"latest_commit_sha":null,"homepage":"https://algebrain.io","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dedoussis.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2019-07-19T20:18:39.000Z","updated_at":"2025-04-09T03:06:25.000Z","dependencies_parsed_at":"2023-01-25T23:31:58.870Z","dependency_job_id":null,"html_url":"https://github.com/dedoussis/algebrain","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dedoussis/algebrain","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dedoussis%2Falgebrain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dedoussis%2Falgebrain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dedoussis%2Falgebrain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dedoussis%2Falgebrain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dedoussis","download_url":"https://codeload.github.com/dedoussis/algebrain/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dedoussis%2Falgebrain/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259742933,"owners_count":22904633,"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":["algebra","cas","compiler","mathematics","symbolic","symbolic-computation","transformations","typescript"],"created_at":"2024-10-24T07:08:22.542Z","updated_at":"2025-06-15T13:05:38.654Z","avatar_url":"https://github.com/dedoussis.png","language":"TypeScript","readme":"# Algebrain 🧠\n[![Build Status](https://travis-ci.com/dedoussis/algebrain.svg?branch=master)](https://travis-ci.com/dedoussis/algebrain)\n[![Coverage Status](https://coveralls.io/repos/github/dedoussis/algebrain/badge.svg?branch=master)](https://coveralls.io/github/dedoussis/algebrain?branch=master)\n\nCombuter Algebra System focusing on symbolic transformations.\n\n100% writen in typescript.\n\nParser generated using [ANTLR4](https://www.antlr.org/).\n\n*Note: Algebrain is still at a very early and unstable stage.*\n\n## Install\n\n```bash\n$ npm install algebrain\n```\n\n## Usage\n\n### Expressions\n```javascript\nimport Algebrain from \"algebrain\";\n\nconst expr = Algebrain.parse(\"(3^2)*1.6+5/(y-12.34)\");\n// Your string expression is now a tree of nodes:\n//  +\n//  ├── *\n//  │   ├── 1.6\n//  │   └── ^\n//  │       ├── 3\n//  │       └── 2\n//  └── /\n//      ├── 5\n//      └── -\n//          ├── y\n//          └── 12.34\n\nconst evaluated = expr.evaluate();\n// Evaluated tree of the following form:\n// +\n// ├── 14.4\n// └── /\n//     ├── 5\n//     └── -\n//         ├── y\n//         └── 12.34\n\nconsole.log(`My evaluated expression is: ${evaluated}`);\n// \u003e My evaluated expression is: 14.4+5/(y-12.34)\n```\n\nUnder the hood, the above parsing uses an extensive API for structuring algebraic expressions:\n```javascript\n// Algebrain heavily relies on the immutable package for persistent data structures\nimport { List } from \"immutable\";\nimport { Operator, Num, Symbol, OperatorSymbol } from \"algebrain\";\n\n// The above expression: 14.4+5/(y-12.34), is constructed as:\nconst expr = new Operator(OperatorSymbol.Plus, List([\n    new Num(14.4),\n    new Operator(OperatorSymbol.Div, List([\n        new Num(5),\n        new Operator(OperatorSymbol.Minus, List([\n            new Symbol(\"y\"),\n            new Num(12.34)\n        ]))\n    ]))\n]));\n\nconsole.log(expr.toString());\n// \u003e 14.4+5/(y-12.34)\n```\n\n### Transformations\n\nBy exploiting the concept of [rewriting rules](https://en.wikipedia.org/wiki/Rewriting), Algebrain enables the use of custom transformations, that can be entirely developed and compiled within its environment.\n\n```javascript\nimport Algebrain, { Transformation } from \"algebrain\";\n\nconst rules = [\n    Algebrain.parse(\"fib(0)=0\"),\n    Algebrain.parse(\"fib(1)=1\"),\n    Algebrain.parse(\"fib($a)=fib($a-1)+fib($a-2) if const($a)\"),\n];\n\nconst fibonacci = new Transformation(\"fib\", rules);\n\nconst expr = Algebrain.parse(\"fib(15)\");\n\nconsole.log(`The 15th term of fibonacci is: ${expr.transform(fibonacci)}`);\n// \u003e The 15h term of fibonacci is 610\n```\n\n### Interpreter - The execution framework of Algebrain\n\nSimilar to any traditional Computer Algebra System, Algebrain provides a progamming language and an intepreter.\nEvery Algebrain statement or expression, when parsed, results to an object implementing the `Executable` interface.\n\n✍️ more documentation to come...\n\n## Web UI\n\nThere is a web-app client that materiliases a friendly interface for exploring algebrain at https://algebrain.io \n\nThe source repo of the React app can be found [here](https://github.com/dedoussis/algebrain.io).\n\n## Develop\n\n```bash\n# Linting\nnpm run lint\n\n# Unit tests w/ coverage thresholds\nnpm run test\n\n# Compile typescript\nnpm run build\n\n# Please commit through the following npm scripts\nnpm run precommit\nnpm run commit\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdedoussis%2Falgebrain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdedoussis%2Falgebrain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdedoussis%2Falgebrain/lists"}