I have two dataframes:
df1 = pd.DataFrame({'Time (sec)': [0,0.001,0.002,0.003,0.004],
'P_supply': [3098,4001,3099,4002,4003],
'Real_position': [0.000078, 0.000079,0.000088,0.000099, 0.0011],
'Ku': [0.0002,0.0006,0.00011,0.00018,0.00025]})
df2 = pd.DataFrame({'time': [0,0.001,0.002,0.003,0.004],
'Input_psi': [4000,4000,4000,4000,4000]})
I am trying to add two columns to df2: 'position' and 'Ku2'. Ku2 depends on position, and position depends on Ku2. Ku2 is a cubic interpolation, it takes the position value at that row and interpolates df1['Real_position'] and df1['Ku'].
At the same time, position is found by using the following formula:
position_i = position_i-1 + np.sqrt(Input_psi_i * ku2_i)*(time_i - time_i-1)
How can I iteratively solve this using Newton Raphson? An initial guess for position is 0.
Thank you
I could not figure this out