<jupyter_start><jupyter_text>Appendix 6: Iterative Estimation Methods A6.1 Newton Iteration<jupyter_code>import numpy as np
def f(P):
    X = none
    return X
def Jacobian(P):
    J = none
    return J
def Init():
    P = none
    return P
def pseudo_inverse(J):
    return (J^T*J)^(-1)*J^T
def solve(J, e):
    return -pseudo_inverse(J) * e
def step(P, X):
    e = f(P) - X
    J = Jacobian(P)
    delta = solve(J, e)
    return delta
# It is possible that this iteration procedure converges to a local minimum value, or does not converge at all.
def newton_iterate(X):
    P = Init()
    delta = none
    while continue_cond(delta):
        delta = step(P, X)
        P += delta<jupyter_output><empty_output><jupyter_text>Weighted iterationAssume the measurement X satisfies a Gaussian distribution which covariance matrix $\Sigma_X$, and wishes to minimize the Mahalanobis distance $||f(\hat{P}) - X||_\Sigma$<jupyter_code>def pseudo_inverse_mahalanobis(J, C):
    return (J^T * C^(-1) * J)^(-1) * J^T * C^(-1)
def solve_mahalanobis(J, C, e):
    return -pseudo_inverse_mahalanobis(J, C)* e<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup