|   | 1 |  initial version  | 
Try
for k in srange(3):
    for j in srange(3):
        print (j,k),f(j,k)
instead. Standard pitfall unfortunately: in python 2, "integer" division is truncating. Normally sage will provide you with "sage" integers for which division produces rational numbers, but if you use "range" then sage doesn't get the chance.
 Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.
 
                
                Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.