auto-economics


Nameauto-economics JSON
Version 0.0.4 PyPI version JSON
download
home_pagehttps://github.com/uh2000/auto_economics
SummaryAutomated Economics
upload_time2024-06-22 17:36:15
maintainerNone
docs_urlNone
authorUlrik Haugland
requires_python>=3.7
licenseApache Software License 2.0
keywords nbdev jupyter notebook python
VCS
bugtrack_url
requirements pandas numpy matplotlib seaborn sympy nbdev ipykernel
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # auto_economics

<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

This file will become your README and also the index of your
documentation.

## Install

``` sh
pip install auto_economics
```

Link: https://pypi.org/project/auto-economics/

## How to use

``` python
supply_function = f"{0} + {1} * x"
demand_function = f"{10} - {1} * x"
free_market = Free_market(supply_function, demand_function)


print(f"supply function {supply_function}\ndemand function {demand_function}")
free_market.get_graph(complete=True)
```

    supply function 0 + 1 * x
    demand function 10 - 1 * x
    cannot multiply variables with zero

![](index_files/figure-commonmark/cell-2-output-2.png)

``` python
supply = "x"
demand = "10 -  x"
monopoly = Monopoly(supply, demand)
monopoly.get_graph(complete=True)
```

    {0: 10.0, 1: 9.0, 2: 8.0, 3: 7.0, 4: 6.0, 5: 5.0, 6: 4.0, 7: 3.0, 8: 2.0, 9: 1.0, 10: 0.0} [3.3333333333333335, 4, 5]
    dead_loss_x_range is: [3.3333333333333335, 4, 5]
    demand_array is: [7. 6. 5.]
    mc_array is: [3. 4. 5.], price_free_market is: 5

![](index_files/figure-commonmark/cell-3-output-2.png)

``` python
consumer_surplus_free_market = free_market.get_consumer_surplus()
consumer_surplus_monopoly = monopoly.get_consumer_surplus()

print(f"Consumer Surplus free market:  {round(consumer_surplus_free_market)}\n"
    +f"Consumer Surplus monopoly: {round(consumer_surplus_monopoly)}")

producer_surplus_free_market = free_market.get_producer_surplus()
producer_surplus_monopoly = monopoly.get_producer_surplus()

print(f"Producer Surplus free market: {round(producer_surplus_free_market)}\n"
    +f"Producer Surplus monopoly: {round(producer_surplus_monopoly)}")

economic_surplus_free_market = free_market.get_economic_surplus()
economic_surplus_monopoly = monopoly.get_economic_surplus()

print(f"Economic Surplus free market: {round(economic_surplus_free_market)}\n"
    +f"Economic Surplus monopoly: {round(economic_surplus_monopoly)}")
```

    Consumer Surplus free market:  12
    Consumer Surplus monopoly: 6
    Producer Surplus free market: 12
    Producer Surplus monopoly: 17
    Economic Surplus free market: 25
    Economic Surplus monopoly: 22

``` python
price_free_market = free_market.get_price()
price_monopoly = monopoly.get_price()

print(f"Price free market: {round(price_free_market)}\n"
      +f"Price monopoly: {round(price_monopoly)}")

quantity_free_market = free_market.get_quantity()
quantity_monopoly = monopoly.get_quantity()

print(f"Quantity free market: {round(quantity_free_market)}\n"
        +f"Quantity monopoly: {round(quantity_monopoly)}")
```

    Price free market: 5
    Price monopoly: 7
    Quantity free market: 5
    Quantity monopoly: 3

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/uh2000/auto_economics",
    "name": "auto-economics",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "nbdev jupyter notebook python",
    "author": "Ulrik Haugland",
    "author_email": "ulrikhaugland1@hotmail.no",
    "download_url": null,
    "platform": null,
    "description": "# auto_economics\n\n<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->\n\nThis file will become your README and also the index of your\ndocumentation.\n\n## Install\n\n``` sh\npip install auto_economics\n```\n\nLink: https://pypi.org/project/auto-economics/\n\n## How to use\n\n``` python\nsupply_function = f\"{0} + {1} * x\"\ndemand_function = f\"{10} - {1} * x\"\nfree_market = Free_market(supply_function, demand_function)\n\n\nprint(f\"supply function {supply_function}\\ndemand function {demand_function}\")\nfree_market.get_graph(complete=True)\n```\n\n    supply function 0 + 1 * x\n    demand function 10 - 1 * x\n    cannot multiply variables with zero\n\n![](index_files/figure-commonmark/cell-2-output-2.png)\n\n``` python\nsupply = \"x\"\ndemand = \"10 -  x\"\nmonopoly = Monopoly(supply, demand)\nmonopoly.get_graph(complete=True)\n```\n\n    {0: 10.0, 1: 9.0, 2: 8.0, 3: 7.0, 4: 6.0, 5: 5.0, 6: 4.0, 7: 3.0, 8: 2.0, 9: 1.0, 10: 0.0} [3.3333333333333335, 4, 5]\n    dead_loss_x_range is: [3.3333333333333335, 4, 5]\n    demand_array is: [7. 6. 5.]\n    mc_array is: [3. 4. 5.], price_free_market is: 5\n\n![](index_files/figure-commonmark/cell-3-output-2.png)\n\n``` python\nconsumer_surplus_free_market = free_market.get_consumer_surplus()\nconsumer_surplus_monopoly = monopoly.get_consumer_surplus()\n\nprint(f\"Consumer Surplus free market:  {round(consumer_surplus_free_market)}\\n\"\n    +f\"Consumer Surplus monopoly: {round(consumer_surplus_monopoly)}\")\n\nproducer_surplus_free_market = free_market.get_producer_surplus()\nproducer_surplus_monopoly = monopoly.get_producer_surplus()\n\nprint(f\"Producer Surplus free market: {round(producer_surplus_free_market)}\\n\"\n    +f\"Producer Surplus monopoly: {round(producer_surplus_monopoly)}\")\n\neconomic_surplus_free_market = free_market.get_economic_surplus()\neconomic_surplus_monopoly = monopoly.get_economic_surplus()\n\nprint(f\"Economic Surplus free market: {round(economic_surplus_free_market)}\\n\"\n    +f\"Economic Surplus monopoly: {round(economic_surplus_monopoly)}\")\n```\n\n    Consumer Surplus free market:  12\n    Consumer Surplus monopoly: 6\n    Producer Surplus free market: 12\n    Producer Surplus monopoly: 17\n    Economic Surplus free market: 25\n    Economic Surplus monopoly: 22\n\n``` python\nprice_free_market = free_market.get_price()\nprice_monopoly = monopoly.get_price()\n\nprint(f\"Price free market: {round(price_free_market)}\\n\"\n      +f\"Price monopoly: {round(price_monopoly)}\")\n\nquantity_free_market = free_market.get_quantity()\nquantity_monopoly = monopoly.get_quantity()\n\nprint(f\"Quantity free market: {round(quantity_free_market)}\\n\"\n        +f\"Quantity monopoly: {round(quantity_monopoly)}\")\n```\n\n    Price free market: 5\n    Price monopoly: 7\n    Quantity free market: 5\n    Quantity monopoly: 3\n",
    "bugtrack_url": null,
    "license": "Apache Software License 2.0",
    "summary": "Automated Economics",
    "version": "0.0.4",
    "project_urls": {
        "Homepage": "https://github.com/uh2000/auto_economics"
    },
    "split_keywords": [
        "nbdev",
        "jupyter",
        "notebook",
        "python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a85b1277dff0aa88fd41925a4b194a9d74f5f44ab9792cb4191c072788aa9c2f",
                "md5": "7fe1490a38ad0cafb1c4d25668baafc7",
                "sha256": "52e6bc9fa710b80d9a72e1b68c24db24218aaa230eff1d82d7f541c03d2b6c6a"
            },
            "downloads": -1,
            "filename": "auto_economics-0.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7fe1490a38ad0cafb1c4d25668baafc7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 10490,
            "upload_time": "2024-06-22T17:36:15",
            "upload_time_iso_8601": "2024-06-22T17:36:15.354259Z",
            "url": "https://files.pythonhosted.org/packages/a8/5b/1277dff0aa88fd41925a4b194a9d74f5f44ab9792cb4191c072788aa9c2f/auto_economics-0.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-22 17:36:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "uh2000",
    "github_project": "auto_economics",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "pandas",
            "specs": []
        },
        {
            "name": "numpy",
            "specs": []
        },
        {
            "name": "matplotlib",
            "specs": []
        },
        {
            "name": "seaborn",
            "specs": []
        },
        {
            "name": "sympy",
            "specs": []
        },
        {
            "name": "nbdev",
            "specs": []
        },
        {
            "name": "ipykernel",
            "specs": []
        }
    ],
    "lcname": "auto-economics"
}
        
Elapsed time: 0.26573s