Cubic spline interpolation with Numba compatibility
Project description
Cubic Spline Interpolation
This package carries out cubic spline interpolation. The intended use of this package is to solve dynamic decision problems of heterogeneous agents in conjunction with the Sequence-Space Jacobian (SSJ) package.
The approach differs from the CubicSpline method of SciPy in that our package is compatible with Numba commands which increase performance in large problems. However, for now, the package is limited to the natural boundary condition.
In this package, we use basic spline interpolation of exactly degree 3, the cubic spline. We follow the methods found here: https://en.wikipedia.org/wiki/Spline_interpolation. We use the natural boundary condition, which is extends a straight line from the end points at the same slope as that end point. In formal terms, the second derivative at the end points is equal to 0. We make this choice to efficiently solve the interpolation problem. The natural boundary gives a tridiagonal matrix when the constraints are put in matrix form, and this allows for the Thomas algorithm to quickly solve the matrix problem. In SciPy, we can carry out the same interpolation and get very nearly the same results by running
interpolate.CubicSpline(x, y, bc_type='natural')
Installation
cubic_spline runs on NumPy and Numba. The pacakge was developed with Python 3.9 with NumPy version 1.21 and Numba version 0.55. To install run the following command
pip install cubic-spline
Using the Pacakge
cubic_spline.py and tools.py are the necessary files for carrying out cubic interpolation. Users will normally only need to interact with cubic_spline as it contains the high level wrapper functions. The other files, vfi_demo and firm_engine, provide an application of this cubic interpolation package to a heterogeneous firm optimization problem. firm_engine requires the SSJ pacakge to be installed. vfi_demo is a notebook that walks through the canonical lumpy investment problem with value function iteration making use of the cubic_spline methods.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cubic-spline-0.1.1.tar.gz.
File metadata
- Download URL: cubic-spline-0.1.1.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70697ad9ccdf2277eb2599e367dba697853c272f79075a9182fb6933d934445f
|
|
| MD5 |
696d963070409200ed0ea95deac73cd2
|
|
| BLAKE2b-256 |
0c4cd23a81c4fcebcae66a481adcad033c9c3c9b35a924aed0da1ae985a6451a
|
File details
Details for the file cubic_spline-0.1.1-py3-none-any.whl.
File metadata
- Download URL: cubic_spline-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99202cd4d3d72c70488a50754b8fd330e57ea2ed3132006edacce9ca7b4795ec
|
|
| MD5 |
e656ab2b350e654b82e46d9b74c67a19
|
|
| BLAKE2b-256 |
903efbe26da405e886555e14894f1c1399bb04e3198ff38736ee3c6fea572201
|