def _fidfi(y): # fi first f = self._model(tnext, y) fi = deepcopy(f) beta = deepcopy(fi) for n in self._sequence: fi[n] = 137.0*y[n] - 300.0*s[n] + \ 300.0*self.__prev[3][n] - \ 200.0*self.__prev[2][n] + \ 75.0*self.__prev[1][n] - \ 12.0*self.__prev[0][n] - 60.0*h*f[n] beta[n] = - fi[n] # then fid = dfi[n]/dy[m] = 137*dy[n]/dy[m] - 60*h*df[n]/dy[m], # or - 60*h*df[n]/dy[m]; n != m, and # 137 - 60*h*df[n]/dy[m]; n == m jacob = self._jake3(tnext, y, hf, ha) fid = Matrix() for n in self._sequence: derivs = array('d', []) for m in self._sequence: deriv = 137.0*krond(n, m) - 60.0*h*jacob[n][m] derivs.append(deriv) fid.append(derivs) alpha = Matrix(fid) return alpha, beta
def _fidfi(y): # fi first f = self._model(tnext, y) fi = deepcopy(f) beta = deepcopy(fi) for n in self._sequence: fi[n] = y[n] - s[n] - h*f[n] beta[n] = - fi[n] # then fid = dfi[n]/dy[m] = dy[n]/dy[m] - h*df[n]/dy[m], or # - h*df[n]/dy[m]; n != m, and # 1.0 - h*df[n]/dy[m]; n == m jacob = self._jake3(tnext, y, hf, ha) fid = Matrix() for n in self._sequence: derivs = array('d', []) for m in self._sequence: deriv = 1.0*krond(n, m) - h*jacob[n][m] derivs.append(deriv) fid.append(derivs) alpha = Matrix(fid) return alpha, beta
def _fidfi(y): # fi first f = self._model(tnext, y) fi = deepcopy(f) beta = deepcopy(fi) for n in self._sequence: fi[n] = 25.0*y[n] - 48.0*s[n] + 36.0*self.__prev[2][n] - \ 16.0*self.__prev[1][n] + \ 3.0*self.__prev[0][n] - 12.0*h*f[n] beta[n] = - fi[n] # then fid = dfi[n]/dy[m] = 3*dy[n]/dy[m] - 2*h*df[n]/dy[m], or # - 12*h*df[n]/dy[m]; n != m, and # 25 - 12*h*df[n]/dy[m]; n == m jacob = self._jake3(tnext, y, hf, ha) fid = Matrix() for n in self._sequence: derivs = array('d', []) for m in self._sequence: deriv = 25.0*krond(n, m) - 12.0*h*jacob[n][m] derivs.append(deriv) fid.append(derivs) alpha = Matrix(fid) return alpha, beta