Skip to content

joshhilton/pyMicroeconomics

Repository files navigation

pyMicroeconomics

pyMicroeconomics is a Python package designed for symbolic analysis and visualization of market equilibrium conditions. This package allows you to define various supply and demand curves, calculate market equilibrium points, and visualize these using interactive plots. It integrates several powerful libraries, such as Sympy and Matplotlib, making it a versatile tool for microeconomic analysis.

Features

  • Define different types of supply and demand curves (linear, power, exponential, quadratic).
  • Calculate key market metrics, including equilibrium price and quantity.
  • Compute consumer surplus, producer surplus, and total surplus.
  • Visualize market equilibrium interactively with ipywidgets and Matplotlib.

Table of Contents

  1. Getting Started
  2. Installation
  3. Usage Examples
  4. Documentation
  5. Contributing
  6. License
  7. Acknowledgments

Getting Started

To get started with pyMicroeconomics, follow these steps:

Prerequisites

  • Python 3.8 or later
  • Jupyter Notebook or JupyterLab for interactive usage

Installation

To install pyMicroeconomics, use pip:

pip install pyMicroeconomics

This package is intended to be used interactively within Jupyter Notebooks to visualize economic concepts dynamically.

Setting Up the Environment

You can also use the provided Dockerfile and devcontainer.json to set up a complete development environment. This is especially useful if you use Visual Studio Code or GitHub Codespaces. To start developing with pyMicroeconomics, clone the repository and spin up a Docker container:

git clone https://github.com/joshhilton/pyMicroeconomics.git
cd pyMicroeconomics
docker build -t pymicroeconomics .
docker run -it -v $(pwd):/app pymicroeconomics

Usage Examples

Example 1: Basic Market Equilibrium

Below is a simple example of finding the market equilibrium using linear supply and demand curves:

import pyMicroeconomics as pm

# Define demand and supply curves
demand = pm.linear_demand()
supply = pm.linear_supply()

# Calculate equilibrium
equilibrium = pm.market_equilibrium(demand, supply)

# Display equilibrium details
pm.display_equilibrium(equilibrium)
pm.plot_equilibrium(equilibrium)

This visualization allows users to adjust the parameters interactively and observe changes in real-time.

Documentation

The complete documentation for pyMicroeconomics, including detailed guides, examples, and the API reference, is available here.

If you need specific help on running tests or contributing, check out the Developer Guide and Testing Guide in the docs/ directory.

Contributing

We welcome contributions to the project! Please follow these steps to get involved:

  1. Fork the repository.
  2. Create a feature branch (git checkout -b feature/AmazingFeature).
  3. Commit your changes (git commit -m 'Add some AmazingFeature').
  4. Push to the branch (git push origin feature/AmazingFeature).
  5. Open a Pull Request.

Please refer to the CONTRIBUTING.md document for more detailed guidelines.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Built using SymPy, Matplotlib, and ipywidgets.

If you have any questions or need further help, please feel free to open an issue on GitHub.

Badges

PyPI - Python Version Build Status License


About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published