Let's say I have these two lists:
u_deteminer = [0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0]
u_H = [0.368, 0.303, 0.301, 0.301, 0.301, 0.301, 0.301, 0.301, 0.301, 0.301]
I am given the value: 1.276819
.
The value at each index in u_determiner
maps out to a value in u_H
(e.g. 0.2 maps to 0.368). Using the given value, I would like to interpolate a value for u_H
. Suggestions?
CodePudding user response:
Numpy should make this easy.
import numpy as np
u_deteminer = [0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0]
u_H = [0.368, 0.303, 0.301, 0.301, 0.301, 0.301, 0.301, 0.301, 0.301, 0.301]
np.interp(2.5, u_deteminer, u_H)
Output
0.301