pagheca
Mechanical
- Nov 27, 2005
- 31
Hi,
I'm looking for the simplest way to find the index of the element of a vector that is closer to a given value.
Suppose the vector is f[i:=i^2 and the value V:40 .
The solution is i=6 as 6^2=36. How to find that i value? Do there is any function doing that? Do you know any trick using the programming?
See attachment for an attempt to solve it (not working.
regards and thanks in advance
I'm looking for the simplest way to find the index of the element of a vector that is closer to a given value.
Suppose the vector is f[i:=i^2 and the value V:40 .
The solution is i=6 as 6^2=36. How to find that i value? Do there is any function doing that? Do you know any trick using the programming?
See attachment for an attempt to solve it (not working.
regards and thanks in advance