{"id":20160191,"url":"https://github.com/trizen/bacovia","last_synced_at":"2025-03-03T02:26:26.874Z","repository":{"id":68775960,"uuid":"83165784","full_name":"trizen/bacovia","owner":"trizen","description":"Symbolic math library for Sidef.","archived":false,"fork":false,"pushed_at":"2021-10-07T14:29:29.000Z","size":71,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-13T13:49:59.270Z","etag":null,"topics":["library","sidef","symbolic","symbolic-math"],"latest_commit_sha":null,"homepage":"https://trizenx.blogspot.com/2017/03/bacovia-new-symbolic-math-library.html","language":"Ruby","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/trizen.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-25T21:59:06.000Z","updated_at":"2021-10-07T14:29:33.000Z","dependencies_parsed_at":"2024-06-05T18:33:04.248Z","dependency_job_id":null,"html_url":"https://github.com/trizen/bacovia","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/trizen%2Fbacovia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trizen%2Fbacovia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trizen%2Fbacovia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trizen%2Fbacovia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trizen","download_url":"https://codeload.github.com/trizen/bacovia/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241597914,"owners_count":19988335,"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":["library","sidef","symbolic","symbolic-math"],"created_at":"2024-11-14T00:12:43.311Z","updated_at":"2025-03-03T02:26:26.868Z","avatar_url":"https://github.com/trizen.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bacovia\n\nA symbolic math library for Sidef.\n\n# EXAMPLE\n\n```ruby\ninclude('lib/bacovia.sf')\n\nvar x = Symbol('x')\nvar y = Symbol('y')\n\nsay x+y               #=\u003e Sum(Symbol('x'), Symbol('y'))\nsay x-y               #=\u003e Difference(Symbol('x'), Symbol('y'))\nsay x*y               #=\u003e Product(Symbol('x'), Symbol('y'))\nsay x/y               #=\u003e Fraction(Symbol('x'), Symbol('y'))\n\nsay x**y              #=\u003e Power(Symbol('x'), Symbol('y'))\n\nsay Log(x)            #=\u003e Log(Symbol('x'))\nsay Log(x)+Log(y)     #=\u003e Log(Product(Symbol('x'), Symbol('y')))\n\nsay Exp(x)            #=\u003e Exp(Symbol('x'))\nsay Exp(x)*Exp(y)     #=\u003e Exp(Sum(Symbol('x'), Symbol('y')))\n\n\nsay \"\\n=\u003e Sum:\"\nvar sum = Fraction(0, 1)\n\nfor n in (1..10) {\n    sum += Fraction(1, n)\n}\nsay sum                     #=\u003e Fraction(10628640, 3628800)\nsay sum.numeric.as_frac     #=\u003e 7381/2520\n\n\nsay \"\\n=\u003e Product:\"\nvar prod = Fraction(1, 1)\n\nfor n in (0..3) {\n    prod *= Exp(Fraction(1, n!))\n}\nsay prod                    #=\u003e Product(Fraction(1, 1), Exp(Fraction(1, 1)), Exp(Fraction(1, 1)), Exp(Fraction(1, 2)), Exp(Fraction(1, 6)))\nsay prod.numeric            #=\u003e 14.39191609514989...\n\n\nsay \"\\n=\u003e Alternative representations:\"\nPower(3, 5).alternatives.each { .say }    #=\u003e [Exp(Product(Log(3), 5)), Power(3, 5), 243]\n```\n\n# DESCRIPTION\n\nThe types supported by this library are described bellow:\n\n#### # `Symbol(name, value=nil)`\n\nRepresents a symbolic value. Optionally, it can have a numeric value.\n\n#### # `Fraction(numerator, denominator)`\n\nRepresents a symbolic fraction.\n\n#### # `Difference(minuend, subtrahend)`\n\nRepresents a symbolic difference.\n\n#### # `Power(base, power)`\n\nRepresents a symbolic exponentiation in a symbolic base.\n\n#### # `Log(x)`\n\nRepresents the natural logarithm of a symbolic value.\n\n#### # `Exp(x)`\n\nRepresents the natural exponentiation of a symbolic value.\n\n#### # `Sum(a, b, c, ...)`\n\nRepresents a summation of an arbitrary (finite) number of symbolic values.\n\n#### # `Product(a, b, c, ...)`\n\nRepresents a product of an arbitrary (finite) number of symbolic values.\n\n# SPECIAL METHODS\n\nAn interesting feature is the support for alternative representations (provided by the method `.alternatives`),\nwhich uses common mathematical identities to create symbolically equivalent expressions from the self-expression.\n\nBellow we describe the special methods provided by this library:\n\n#### # `.alternatives()`\n\nReturns an array with alternative representations from the self-expression.\n\n```ruby\nExp(Log(3) * 2) -\u003e alternatives.each { .say }\n```\n\nOutput:\n\n```ruby\nExp(Product(Log(3), 2))\nPower(3, 2)\n9\n```\n\n#### # `.simple()`\n\nReturns a simplification of the self-expression.\n\n```ruby\nExp(Log(Log(Exp(Exp(Log(Symbol('x'))))))) -\u003e simple.say\n```\n\nOutput:\n\n```ruby\nSymbol('x')\n```\n\n#### # `.pretty()`\n\nReturns a human-readable stringification of the self-expression.\n\n```ruby\nPower(3, Log(Fraction(1, 2))) -\u003e pretty.say\n```\n\nOutput:\n```ruby\n3^log(1/2)\n```\n\n#### # `.numeric()`\n\nEvaluates the self-expression numerically and returns the result as a Number or a Complex object.\n\n```ruby\nvar x = Symbol('x')\nvar expr = (x**2 - x + 41)\n\nfor n in (1..3) {\n    x.value = n              # sets `x` to the value of `n`\n    say expr.numeric         # evaluates the expression numerically\n}\n```\n\nOutput:\n```ruby\n41\n43\n47\n```\n\n# REQUIREMENTS\n\nThe library requires the Sidef programming language: [https://github.com/trizen/sidef](https://github.com/trizen/sidef)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrizen%2Fbacovia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrizen%2Fbacovia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrizen%2Fbacovia/lists"}