{"id":17274368,"url":"https://github.com/xetera/derivative-calc","last_synced_at":"2025-03-26T13:26:56.240Z","repository":{"id":113233897,"uuid":"505046937","full_name":"Xetera/derivative-calc","owner":"Xetera","description":"Derivative calculator but it's actually fun because it's not for school","archived":false,"fork":false,"pushed_at":"2022-06-19T10:54:02.000Z","size":6,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-31T14:48:17.459Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Xetera.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"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":"2022-06-19T07:59:32.000Z","updated_at":"2022-06-20T13:28:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"d91f3ed1-e8b1-40b2-a41f-75115ee5b1db","html_url":"https://github.com/Xetera/derivative-calc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xetera%2Fderivative-calc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xetera%2Fderivative-calc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xetera%2Fderivative-calc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xetera%2Fderivative-calc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Xetera","download_url":"https://codeload.github.com/Xetera/derivative-calc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245661574,"owners_count":20651883,"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":[],"created_at":"2024-10-15T08:53:45.013Z","updated_at":"2025-03-26T13:26:56.221Z","avatar_url":"https://github.com/Xetera.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Derivatives\n\n\nAn expression-based calculator capable of dealing with derivatives and simplifying the results with a varying degree of success.\n\n## Example\n\nInput: $\\frac{d}{dx} \\dfrac{x^3 * x^3 - (2x - x)}{x^2}$\n\nSimplification: $\\frac{d}{dx} \\dfrac{x^6 - 3x}{x^2}$\n\nDerivative: $\\dfrac{x^2(6x^5 - 3) - 2x(x^6 - 3x)}{x^4}$\n\nSolution at x = 2 $32.75$\n\n## Features\n\nSome of these features are left out because they're tedious to encode since they involve deep pattern matching on commutative operations.\n\nSome other identities are tricky since they don't necessarily always make things simpler. For example: $ln(xy) = ln(x) + ln(y)$\n\n### Derivatives\n- [x] Sum Rule\n- [x] Difference Rule\n- [x] Product Rule\n- [x] Chain Rule\n- [x] Power Rule\n- [x] Quotient Rule\n- [x] Logarithms\n- [ ] `e`\n- [ ] Regular trig rules (sin, cos, tan)\n- [ ] Confusing trig rules (cot, sin^-1, cos^-1, tan^-1)\n- [ ] The ones that made me fail calc1 class (sinh, cosh, tanh)\n- [ ] Square roots\n\n### Simplification \u0026 Algebra\n- [x] Constant operations for addition, subtraction, division, multiplication\n- [x] Identity operations, eg: `n * 1 = n` or `n + 0 = n`\n- [x] Exponent Rules, eg: `a^m + a^n = a^(m + n)`\n- [x] Variable substitution\n- [ ] Combining same terms at arbitrary levels `2x^2 + 5x^2`\n- [ ] Distributing terms\n- [ ] A bunch of other things\n\n## Encoding an Equation\n```rs\nlet operation = div(\n  sub(\n    mult(\n      pow(\n        x.clone(),\n        constant(3.0),\n      ),\n      pow(x.clone(), constant(3.0)),\n    ),\n    add(mult(constant(2.0), x.clone()), x.clone())\n  ),\n  pow(\n    x.clone(),\n    constant(2.0),\n  ),\n);\n\nlet derivative = Derivative::of(\u0026operation.simplify())\n// (((x^2 * (6x^5 - 3)) - ((x^6 - 3x) * 2x))/x^4)\n\nlet terms = HashMap::from(\n  [(\u0026x, Math::Constant(2.0))]\n);\n\nlet solution = derivative.solve(\u0026terms);\n// Math::Constant(32.75)\n```\n\n```\ninput = \"(((x^3 * x^3) - (2x + x))/x^2)\"\ninput (simplified) = \"((x^6 - 3x)/x^2)\"\nderivative (simplified) = \"(((x^2 * (6x^5 - 3)) - ((x^6 - 3x) * 2x))/x^4)\"\nderivative solution (simplified) {x = 2} = \"32.75\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxetera%2Fderivative-calc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxetera%2Fderivative-calc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxetera%2Fderivative-calc/lists"}