Skip to main content

A package for undergraduate microeconomics.

Project description

Intro-Microeconomics

This is a package for introductory microeconomics topics. Find additional code, albeit unpackaged, in the loose-code branch. This new refactor does not yet have all of the same capabilities as in the old unpackaged code.

Example Usage

Demand and Supply objects can be created in several ways, but most naturally with the from_formula class method. The method requires an explicit slope, so "P=12-1*Q" or "P=12-1Q" must be used instead of "P=12-Q".

from freeride.curves import Demand, Supply
d1 = Demand.from_formula("Q = 10 - 1*P")
d2 = Demand.from_formula("P = 15 - 2*Q")
s1 = Supply.from_formula('Q = 2*P')
s2 = Supply.from_formula('Q = 2*P - 1')

The addition operator performs horizontal summation, allowing aggregation.

d = d1 + d2
s = s1 + s2

Then you can solve for and plot an equilibrium.

from freeride.equilibrium import Equilibrium
e = Equilibrium(d, s)
print(e.p, e.q)
e.plot()

Use matplotlib to customize plots further.

import matplotlib.pyplot as plt

ax = e.plot()
ax.set_ylim(0, 16)

# Label curves
ax.text(2, d(2) + 0.05,
        s='D',
        fontsize=16,
        horizontalalignment='left',
        verticalalignment='bottom')

ax.text(16, s(16) + 0.05,
        s='S',
        fontsize=16,
        horizontalalignment='right',
        verticalalignment='bottom')

# Label equilibrium
ax.text(e.q, e.p + 2,
        s=f'Q={e.q:.2f}, P={e.p:.2f}',
        horizontalalignment='center',
        verticalalignment='bottom')

plt.savefig("equilibrium.svg", transparent=True)
plt.show()

equilibrium.svg

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

freeride-0.0.7.tar.gz (26.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

freeride-0.0.7-py3-none-any.whl (29.5 kB view details)

Uploaded Python 3

File details

Details for the file freeride-0.0.7.tar.gz.

File metadata

  • Download URL: freeride-0.0.7.tar.gz
  • Upload date:
  • Size: 26.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for freeride-0.0.7.tar.gz
Algorithm Hash digest
SHA256 5a6f5dace6f9715ee0fc28fe72b047b9a5f58e8a6b4baa2753579a3328584701
MD5 1387aeb7ea5fa1fce9bf379c596447fc
BLAKE2b-256 179133c5e2c05c21730810ee9e30904c719f3198eb1eac6fb5a2e63372fff040

See more details on using hashes here.

File details

Details for the file freeride-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: freeride-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 29.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for freeride-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 1407dd2ca9bf888736d5e90dbc29604fd5af20fd8cded9c4e74f1103565da35f
MD5 8815926ab538c4768acd65d9658cd7c0
BLAKE2b-256 b73189ae7feb24b0bd508b460cc4d378e18279cd83e3fc9ac5f4275d93e19d1f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page