I have a file(Data.txt), which contains data like (two column data)
0.105785959943 9.75133617601e+15
0.111906693211 9.03309900398e+15
0.118381569654 9.10020956844e+15
0.125231079854 9.92284743442e+15
0.132476899971 8.90313525209e+15
0.140141960337 8.94055824107e+15
0.148250518026 9.26206609674e+15
0.156828233614 8.91802025262e+15
The file may contain 100 lines. Let me call the values in first column as r_i
and second column as d_i
(i
may change from 0
to 100
). My problem is to write a code to compute
C*(r_(i+1)-r_i)^3 * d_i
, where C
is a constant.
And also I want to write these data into a new file containing 3 columns, in which the third column should be our new computed data.
How can I achieve this? Does any body know how to solve this problem?