Skip to main content

FreeRide

This is a package for introductory microeconomics topics. Find additional code, albeit unpackaged, in the loose-code branch.

freeridebanner

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')

Formula strings that don't match the expected patterns raise FormulaParseError for quick troubleshooting.

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

Metadata

Release files for freeride 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for freeride 0.1.1
File Size Uploaded Provenance Actions
freeride-0.1.1.tar.gz 42.8 kB Without provenance Details for freeride-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for freeride 0.1.1
File Interpreter ABI Platform Actions
freeride-0.1.1-py3-none-any.whl Python 3 none any Details for freeride-0.1.1-py3-none-any.whl

Total release size: 94.0 kB

Release files / freeride-0.1.1.tar.gz

Download URL freeride-0.1.1.tar.gz
Size 42.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b9c3b8dbf50e3a2a292e9c19adaa760d23f7711185922e1bd90f52245f11d9d8
BLAKE2b-256 checksum
How to use checksums
843e15448a367c33a23db8a90fef3d4d580a6175931665721620c0e82bfbed42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.22

Release files / freeride-0.1.1-py3-none-any.whl

Download URL freeride-0.1.1-py3-none-any.whl
Size 51.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9fcee52ea90537e7d1c0401bd9fb90cc8f9b5adf0c5a3433caaf578d3d113e0e
BLAKE2b-256 checksum
How to use checksums
0fb0a6535081f0ea0412742c3f8f8b65839bd48680fc639ee2fad5d2b5e70135
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.22

Security for freeride 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page