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()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file freeride-0.0.6.tar.gz
.
File metadata
- Download URL: freeride-0.0.6.tar.gz
- Upload date:
- Size: 22.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ac65fd7e35cd1f6cf1aa010cffa9233ad4c67688d41a6ffc309d8234fd6cad9 |
|
MD5 | 0e01a8ad9fcb8cbbf0b279774c65fead |
|
BLAKE2b-256 | 3e8bfaf59f851cf82a30f2dbf708a483604e8b1f6919fa0d5129000d25be3327 |
File details
Details for the file freeride-0.0.6-py3-none-any.whl
.
File metadata
- Download URL: freeride-0.0.6-py3-none-any.whl
- Upload date:
- Size: 26.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | db276afdd15170f5ff7f04929bf100ae06b5c8b52087d8352729f6ba771d19e6 |
|
MD5 | 64f700d3cdbe4ebe269c6d18f708671b |
|
BLAKE2b-256 | 3c608c4ddc38204c0eeba4af25f607fce1a3a514b2790faab94d615a1631268f |