original_docstring: 
      WORK IN PROGRESS -- NOT OPTIMIZED
      Returns the production for each company, calculated by their
      marginal costs and demand curve. Only works for 3 companies
      
docstring: WORK IN PROGRESS -- NOT OPTIMIZED
  Returns the production for each company, calculated by their
  marginal costs and demand curve. Only works for 3 companies
docstring_tokens: WORK IN PROGRESS -- NOT OPTIMIZED Returns the production for each company calculated by their marginal costs and demand curve . Only works for 3 companies
code: def estimate_comp_productions(
          demand: Demand,
          marginal_costs: Tuple[pd.Series, pd.Series, pd.Series]
  ) -> Tuple[pd.Series, pd.Series, pd.Series]:
      """
      WORK IN PROGRESS -- NOT OPTIMIZED
      Returns the production for each company, calculated by their
      marginal costs and demand curve. Only works for 3 companies
      """
      c1, c2, c3 = marginal_costs
      q1, q2, q3 = [], [], []
      for i in range(len(c1)):
          x = np.full((3, 3), .5, dtype=float)
  
          # Replace the diagonal of the matrix with (M_i + 2 * B)
          # This creates matrix named H in the documentation above
          # noinspection PyTypeChecker
          np.fill_diagonal(x, np.ones((3,), dtype=float))
  
          # Create a matrix MC_i / 2*B
          constants = [(demand[0] - c1[i]) / demand[1],
                       (demand[0] - c2[i]) / demand[1],
                       (demand[0] - c3[i]) / demand[1]]
  
          # Our solution is an array of quantities, length N.
          productions = np.linalg.solve(x, constants).tolist()
          q1.append(productions[0])
          q2.append(productions[1])
          q3.append(productions[2])
  
      pd_q1 = pd.Series(q1, name='q1')
      pd_q2 = pd.Series(q2, name='q2')
      pd_q3 = pd.Series(q3, name='q3')
  
      return pd_q1, pd_q2, pd_q3
code_tokens: def estimate_comp_productions ( demand : Demand , marginal_costs : Tuple [ pd . Series , pd . Series , pd . Series ] ) -> Tuple [ pd . Series , pd . Series , pd . Series ] : c1 , c2 , c3 = marginal_costs q1 , q2 , q3 = [ ] , [ ] , [ ] for i in range ( len ( c1 ) ) : x = np . full ( ( 3 , 3 ) , .5 , dtype = float ) np . fill_diagonal ( x , np . ones ( ( 3 , ) , dtype = float ) ) constants = [ ( demand [ 0 ] - c1 [ i ] ) / demand [ 1 ] , ( demand [ 0 ] - c2 [ i ] ) / demand [ 1 ] , ( demand [ 0 ] - c3 [ i ] ) / demand [ 1 ] ] productions = np . linalg . solve ( x , constants ) . tolist ( ) q1 . append ( productions [ 0 ] ) q2 . append ( productions [ 1 ] ) q3 . append ( productions [ 2 ] ) pd_q1 = pd . Series ( q1 , name = 'q1' ) pd_q2 = pd . Series ( q2 , name = 'q2' ) pd_q3 = pd . Series ( q3 , name = 'q3' ) return pd_q1 , pd_q2 , pd_q3
short_docstring: WORK IN PROGRESS -- NOT OPTIMIZED
  Returns the production for each company, calculated by their
  marginal costs and demand curve.
short_docstring_tokens: WORK IN PROGRESS -- NOT OPTIMIZED Returns the production for each company calculated by their marginal costs and demand curve .
comment: """
      WORK IN PROGRESS -- NOT OPTIMIZED
      Returns the production for each company, calculated by their
      marginal costs and demand curve. Only works for 3 companies
      """$SEP$# Replace the diagonal of the matrix with (M_i + 2 * B)$SEP$# This creates matrix named H in the documentation above$SEP$# noinspection PyTypeChecker$SEP$# Create a matrix MC_i / 2*B$SEP$# Our solution is an array of quantities, length N.