parameters: (start, startLam, maxLam, compute_lhs,
                       omega=1.0, hStart=0.03, maxDecel=1.1, maxIter=1000,
                       crit=None, callback=None)
return_statement: return x
docstring: Trace a differentiable path starting at the vector 'start' with
      parameter 'startLam', until 'maxLam' is reached.  lhs() returns the
      value of the LHS at any point (x, lam), and jac() returns the value
      of the Jacobian at any point (x, lam).  omega determines the orientation
      to trace the curve.  Optionally, 'crit' is a function to search for a
      zero of along the path.
docstring_summary: Trace a differentiable path starting at the vector 'start' with
      parameter 'startLam', until 'maxLam' is reached.  lhs() returns the
      value of the LHS at any point (x, lam), and jac() returns the value
      of the Jacobian at any point (x, lam).  omega determines the orientation
      to trace the curve.  Optionally, 'crit' is a function to search for a
      zero of along the path.
docstring_tokens: Trace a differentiable path starting at the vector start with parameter startLam until maxLam is reached . lhs () returns the value of the LHS at any point ( x lam ) and jac () returns the value of the Jacobian at any point ( x lam ) . omega determines the orientation to trace the curve . Optionally crit is a function to search for a zero of along the path .
function: def trace_path_nojac(start, startLam, maxLam, compute_lhs,
                       omega=1.0, hStart=0.03, maxDecel=1.1, maxIter=1000,
                       crit=None, callback=None):
      """
      Trace a differentiable path starting at the vector 'start' with
      parameter 'startLam', until 'maxLam' is reached.  lhs() returns the
      value of the LHS at any point (x, lam), and jac() returns the value
      of the Jacobian at any point (x, lam).  omega determines the orientation
      to trace the curve.  Optionally, 'crit' is a function to search for a
      zero of along the path.
      """
  
      # tol = 1.0e-4              # tolerance for corrector iteration
      # maxDist = 0.4             # maximal distance to curve
      # maxContr = 0.6            # maximal contraction rate in corrector
      # perturbation to avoid cancellation in calculating contraction rate
      # eta = 0.1
      h = hStart                # initial stepsize
      hmin = 1.0e-8             # minimal stepsize
  
      ctmax = 0.8
      dmax = 0.01
      dmin = 0.0001
      pert = 0.00001
      # hmax = 1.28
      hmin = 0.000001
      h = 0.03
      cdmax = 1000.0
      angmax = 3.141592654 / 3
      # maxstp = 9000
      acfac = 1.1
  
      newton = False            # using Newton steplength (for zero-finding)
  
      x = numpy.array([x for x in start] + [startLam])
      if callback is not None:
          callback(x)
  
      y = numpy.zeros(len(start))
      q = numpy.zeros((len(start)+1, len(start)+1))
      v = numpy.zeros(len(start)+1)
      p = numpy.zeros(len(start))
      pv = numpy.zeros(len(start))
      r = numpy.zeros(len(start))
  
      b = estimate_jac(x, compute_lhs)
      q = qr_decomp(b)
  
      while x[-1] >= 0.0 and x[-1] < maxLam:
          qq = q[:, :]
          bb = b[:, :]
  
          t = q[-1][:]               # last column is tangent
  
          if abs(h) <= hmin:
              # Stop.
              return x
  
          # Predictor step
          u = x + h*omega*t
          print("PREDICTOR")
          callback(u)
          w = compute_lhs(u)
          print(w)
          print(ynorm(w))
  
          test = upd(q, b, x, u, y, w, t, h, angmax)
          if not test:
              print("Fail angle test...")
              h = h / acfac
              q = qq
              b = bb
              continue
  
          test, r, v = newt(
              q, b, u, v, w, p, pv, r, pert, dmax, dmin, ctmax, cdmax,
              compute_lhs
          )
          if not test:
              print("Fail Newton test...")
              h = h / acfac
              q = qq
              b = bb
              continue
  
          if newton:
              # Newton-type steplength adaptation
              h = -(v[-1] - 1.0) / q[-1, -1]
              if abs(h) <= hmin:
                  # Stop
                  return x
          else:
              # Standard steplength adaptaiton
              h = abs(h) * acfac
              # if h > hmax:
              #    h = hmax
  
          # PC step was successful; update and iterate
          x = v[:]
          y = r[:]
  
          if callback is not None:
              print("ACCEPTED")
              callback(x)
          print(y)
          print(ynorm(y))
          print()
  
      return x
function_tokens: def trace_path_nojac ( start , startLam , maxLam , compute_lhs , omega = 1.0 , hStart = 0.03 , maxDecel = 1.1 , maxIter = 1000 , crit = None , callback = None ) : # tol = 1.0e-4              # tolerance for corrector iteration # maxDist = 0.4             # maximal distance to curve # maxContr = 0.6            # maximal contraction rate in corrector # perturbation to avoid cancellation in calculating contraction rate # eta = 0.1 h = hStart # initial stepsize hmin = 1.0e-8 # minimal stepsize ctmax = 0.8 dmax = 0.01 dmin = 0.0001 pert = 0.00001 # hmax = 1.28 hmin = 0.000001 h = 0.03 cdmax = 1000.0 angmax = 3.141592654 / 3 # maxstp = 9000 acfac = 1.1 newton = False # using Newton steplength (for zero-finding) x = numpy . array ( [ x for x in start ] + [ startLam ] ) if callback is not None : callback ( x ) y = numpy . zeros ( len ( start ) ) q = numpy . zeros ( ( len ( start ) + 1 , len ( start ) + 1 ) ) v = numpy . zeros ( len ( start ) + 1 ) p = numpy . zeros ( len ( start ) ) pv = numpy . zeros ( len ( start ) ) r = numpy . zeros ( len ( start ) ) b = estimate_jac ( x , compute_lhs ) q = qr_decomp ( b ) while x [ - 1 ] >= 0.0 and x [ - 1 ] < maxLam : qq = q [ : , : ] bb = b [ : , : ] t = q [ - 1 ] [ : ] # last column is tangent if abs ( h ) <= hmin : # Stop. return x # Predictor step u = x + h * omega * t print ( "PREDICTOR" ) callback ( u ) w = compute_lhs ( u ) print ( w ) print ( ynorm ( w ) ) test = upd ( q , b , x , u , y , w , t , h , angmax ) if not test : print ( "Fail angle test..." ) h = h / acfac q = qq b = bb continue test , r , v = newt ( q , b , u , v , w , p , pv , r , pert , dmax , dmin , ctmax , cdmax , compute_lhs ) if not test : print ( "Fail Newton test..." ) h = h / acfac q = qq b = bb continue if newton : # Newton-type steplength adaptation h = - ( v [ - 1 ] - 1.0 ) / q [ - 1 , - 1 ] if abs ( h ) <= hmin : # Stop return x else : # Standard steplength adaptaiton h = abs ( h ) * acfac # if h > hmax: #    h = hmax # PC step was successful; update and iterate x = v [ : ] y = r [ : ] if callback is not None : print ( "ACCEPTED" ) callback ( x ) print ( y ) print ( ynorm ( y ) ) print ( ) return x