All problems
Gauss Newton Exponential Fit Step
Problem
For the model y = a * exp(b t) with residuals r_i = a exp(b t_i) - y_i, the Jacobian rows are [exp(b t_i), a t_i exp(b t_i)]. One Gauss-Newton step solves (J^T J) delta = -J^T r and returns [a, b] + delta.
Given the current parameters [a, b], the times, and the observed values, return the updated parameters.
Hint
Build J from the partial derivatives, then solve the normal equations.
Test cases
case 1
in: [[1,0.5],[0,1,2],[1,1.6487212707,2.7182818285]]
expected: [0.9999999999941608,0.5000000000100576]
case 2
in: [[2,-0.5],[0,1],[2,1.2130613194]]
expected: [2,-0.500000000020829]
case 3
in: [[1.5,0.1],[0,2,4],[1.5,1.8321552334,2.2378621183]]
expected: [1.499999958803758,0.10001397680764107]
Starter codePython
def gauss_newton_exponential_fit_step(params, times, values):
# Your code here
pass3 test cases · run your code against them in the editor