I am trying to write a for loop to calculate error bars by using the derivative method. The formula is relatively simple, however I seem to be running into errors in my code with respect to vector/array sizes. There are a lot of defined vectors in my code, and I have checked the length of all of them. All of the inputs into the for-loop are 1x25 sized arrays.
I've tried changing the indices in the for loop from range(1,25) to range(0,24) but that doesn't seem to work.
# Creating vectors dfdvg = np.zeros(25) dfdxi0 = np.zeros(25) sigsquare = np.zeros(25) vgerr = vrs xi0err = xi0s Asq = np.zeros(25) Bsq= np.zeros(25) sig = np.zeros(25) # calculating derivatives and error vectors for i in range(0,24): dfdvg[i] = (np.multiply(rms[:,i],delta[:,i]))**-1 dfdxi0[i] = -vr[:,i]/(vr[:,i]*(np.power(delta[:,i],2))) Asq[i] = np.power(np.multiply(dfdvg[i],vgerr[i]),2) Bsq[i] = np.power(np.multiply(dfdxi0[i],xi0err[i]),2) sigsquare[i] = Asq[i] + Bsq[i] sig[i] = np.power(sigsquare[i],0.5) q = np.power(np.multiply(rms,delta),-1) left = np.multiply(vg,q) right = -(beta*H)/(3*(1+zeff))
What I want is the "sig" vector, representing the propagated error for each index.