#NEWLINE# def _set_derivatives( self , derivatives ) : #NEWLINE# #INDENT# def extract_derivative( function , derivative_arguments ) : #NEWLINE# #INDENT# return { theta . name : self . stabilize ( sym . diff ( function , theta ) ) for theta in derivative_arguments } #NEWLINE# #UNINDENT# derivative_arguments = [ ] #NEWLINE# if ( derivatives is not None ) : #NEWLINE# #INDENT# for derivative in derivatives : #NEWLINE# #INDENT# derivative_arguments += self . variables [ derivative ] #NEWLINE# #UNINDENT# for ( key , func ) in self . expressions . items ( ) : #NEWLINE# #INDENT# self . expressions [ key ] [ 'derivative' ] = extract_derivative ( func [ 'function' ] , key )