#NEWLINE# def anim( ) : #NEWLINE# #INDENT# dist = ( dwarf . pos - giant . pos ) #NEWLINE# force = ( ( ( ( 6.7e-11 * giant . mass ) * dwarf . mass ) * dist ) / ( sqrt ( ( ( ( dist [ 0 ] ** 2 ) + ( dist [ 1 ] ** 2 ) ) + ( dist [ 2 ] ** 2 ) ) ) ** 3 ) ) #NEWLINE# giant . p = ( giant . p + ( force * dt ) ) #NEWLINE# dwarf . p = ( dwarf . p - ( force * dt ) ) #NEWLINE# for a in [ giant , dwarf ] : #NEWLINE# #INDENT# a . pos = ( a . pos + ( ( a . p / a . mass ) * dt ) ) #NEWLINE# a . orbit . append ( a . pos ) #NEWLINE# p = a . orbit . points #NEWLINE# if ( len ( p ) > 1000 ) : #NEWLINE# #INDENT# a . orbit . points = p [ 200 : ]