<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _run_reactive(self, x):
 """r Repeatedly updates 'A', 'b', and the solution guess within according to the applied source term then calls '_solve' to solve the resulting system of linear equations. Stops when the residual falls below 'r_tolerance' or when the maximum number of iterations is reached. Parameters x : ND-array Initial guess of unknown variable Returns ------- x_new : ND-array Solution array. """

        if x is None:
            x = np.zeros(shape=[self.Np, ], dtype=float)
        self[self.settings['quantity']] = x
        relax = self.settings['relaxation_quantity']
        res = 1e+06  # Initialize the residual
        for itr in range(int(self.settings['max_iter'])):
            if res >= self.settings['r_tolerance']:
                logger.info('Tolerance not met: ' + str(res))
                self[self.settings['quantity']] = x
                self._build_A(force=True)
                self._build_b(force=True)
                self._apply_BCs()
                self._apply_sources()
                x_new = self._solve()
                # Relaxation
                x_new = relax*x_new + (1-relax)*self[self.settings['quantity']]
                self[self.settings['quantity']] = x_new
                res = np.sum(np.absolute(x**2 - x_new**2))
                x = x_new
            if (res < self.settings['r_tolerance'] or
                    self.settings['sources'] == []):
                logger.info('Solution converged: ' + str(res))
                break
        return x_new