class_docstr: Base/abstract class defining the quadratic model for trust-region
  minimization. Child classes must implement the ``solve`` method.
  
  Values of the objective function, Jacobian and Hessian (if provided) at
  the current iterate ``x`` are evaluated on demand and then stored as
  attributes ``fun``, ``jac``, ``hess``.
class_docstr_tok: ["Base\/abstract","class","defining","the","quadratic","model","for","trust-region","minimization",".","Child","classes","must","implement","the","``","solve","``","method",".","Values","of","the","objective","function",",","Jacobian","and","Hessian","(","if","provided",")","at","the","current","iterate","``","x","``","are","evaluated","on","demand","and","then","stored","as","attributes","``","fun","``",",","``","jac","``",",","``","hess","``","."]
docstr: Solve the scalar quadratic equation ||z + t d|| == trust_radius.
  This is like a line-sphere intersection.
  Return the two values of t, sorted from low to high.
docstr_tok: ["Solve","the","scalar","quadratic","equation","||z","+","t","d||","==","trust_radius",".","This","is","like","a","line-sphere","intersection",".","Return","the","two","values","of","t",",","sorted","from","low","to","high","."]
code: def get_boundaries_intersections(self, z, d, trust_radius):
      """
      Solve the scalar quadratic equation ||z + t d|| == trust_radius.
      This is like a line-sphere intersection.
      Return the two values of t, sorted from low to high.
      """
      a = np.dot(d, d)
      b = 2 * np.dot(z, d)
      c = np.dot(z, z) - trust_radius**2
      sqrt_discriminant = math.sqrt(b * b - 4 * a * c)
  
      # The following calculation is mathematically
      # equivalent to:
      # ta = (-b - sqrt_discriminant) / (2*a)
      # tb = (-b + sqrt_discriminant) / (2*a)
      # but produce smaller round off errors.
      # Look at Matrix Computation p.97
      # for a better justification.
      aux = b + math.copysign(sqrt_discriminant, b)
      ta = -aux / (2 * a)
      tb = -2 * c / aux
      return sorted([ta, tb])
  
file_path: catboost/contrib/python/scipy/py3/scipy/optimize/_trustregion.py
imports: import math
  import numpy
  import scipy.linalg
  from .optimize import _check_unknown_options, _wrap_function, _status_message, OptimizeResult, _prepare_scalar_function
  from scipy.optimize._hessian_update_strategy import HessianUpdateStrategy
  from scipy.optimize._differentiable_functions import FD_METHODS
label_desc: Use image node_id 8 for calling the BaseQuadraticSubproblem obj's underlying member method code with example usage: obj.get_boundaries_intersections(z, d, trust_radius) and returns: sorted