arrays - Python function which will call a 1D vector values -
i have next sequence of numbers of array( array 1d )
- -1.7654142212e-06
- 7.0737426918e-07
- 1.63230254789e-06
- 1.88255344022e-06
- 5.00966829007e-06
- 1.88631278169e-06
- -4.08751917695e-06
- 9.12971786351e-07
- 5.33615185204e-06
- -1.01338496378e-05
are 100 values, 10.
i need function call these numbers.
edit
using x, x= np.linspace(0,1000,10)
i used scipy.interpolate.interp1d , not working good...
edit
the interpolation take first , last value, , aproximation. in case values small, , accuracy important. also, values changing on each x step, enough cause error after few iterations.
so if our array
a = ((-1.7654142212e-06 , ....,-1.01338496378e-05 ))`
i need function work that:
edit
e.a. a_function(0) = -1.7654142212e-06 ....
to call value want, without call approximation of value, (for specific #number of x) inside function on main or second script.
why don't create function takes 2 inputs: array, , number
in [15]: out[15]: array([-4611686018427387904, -4611686018427387904, 7, 0, -4611686018427387904, 5764616295532855496, -4611686018427387899, -4611686018427387904, 4, 1407374883553280]) in [16]: def grab_item(array,number): ....: return array[number] ....: in [17]: grab_item(a,8) out[17]: 4
after multitude of comments, here example of believe want through using function:
in [24]: x = np.linspace(0,1000,100) in [25]: grab_item(x,9) out[25]: 90.909090909090907
Comments
Post a Comment