#NEWLINE# def stationary_values( self ) : #NEWLINE# #INDENT# "\n        Computes the matrix P and scalar d that represent the value\n        function\n\n             V(x) = x' P x + d\n\n        in the infinite horizon case.  Also computes the control matrix\n        F from u = - Fx\n\n        Returns\n        -------\n        P : array_like(float)\n            P is part of the value function representation of\n            V(x) = xPx + d\n        F : array_like(float)\n            F is the policy rule that determines the choice of control\n            in each period.\n        d : array_like(float)\n            d is part of the value function representation of\n            V(x) = xPx + d\n\n        " #NEWLINE# ( Q , R , A , B , N , C ) = ( self . Q , self . R , self . A , self . B , self . N , self . C ) #NEWLINE# ( A0 , B0 ) = ( ( np . sqrt ( self . beta ) * A ) , ( np . sqrt ( self . beta ) * B ) ) #NEWLINE# P = solve_discrete_riccati ( A0 , B0 , R , Q , N ) #NEWLINE# S1 = ( Q + ( self . beta * dot ( B . T , dot ( P , B ) ) ) ) #NEWLINE# S2 = ( ( self . beta * dot ( B . T , dot ( P , A ) ) ) + N ) #NEWLINE# F = solve ( S1 , S2 ) #NEWLINE# d = ( ( self . beta * np . trace ( dot ( P , dot ( C , C . T ) ) ) ) / ( 1 - self . beta ) ) #NEWLINE# ( self . P , self . F , self . d ) = ( P , F , d ) #NEWLINE# return ( P , F , d )