https://github.com/tpaviot/linearintegerinterpolation
https://github.com/tpaviot/linearintegerinterpolation
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/tpaviot/linearintegerinterpolation
- Owner: tpaviot
- License: gpl-3.0
- Created: 2021-05-06T16:28:56.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-05-07T03:47:03.000Z (about 5 years ago)
- Last Synced: 2025-01-29T13:29:26.939Z (over 1 year ago)
- Language: Python
- Size: 21.5 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
Linear Integer Interpolation
A python script to compute, from any real function, a linear interpolation using integer coefficients.
Given a real function
defined on a real interval
and a number of subinterval
, compute interpolated segments of the form
where n and m are integer numbers.
```python
from math import sin, cos
def f(x):
return -10.11 * sin(x) + 125.221 *cos(45.2 * x)
interp = linear_interpolation(f, interval=[10, 50], segments=20)
print(interp)
```
```bash
[(56, 26), (23, 422), (-26, 1108), (-56, 1587), (-44, 1372),
(1, 472), (44, -475), (53, -692), (22, 114), (-25, 1429), (-51, 2209),
(-38, 1793), (5, 332), (44, -1072), (48, -1224), (14, 137), (-31, 2027),
(-54, 3039), (-35, 2166), (12, -90), (50, -1990)]
```
