Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

'object is not callable' error in sagetex (that doesn't occur in a worksheet)

I'm generating random numbers to be presented in scientific notation for a quiz I'm typing. In testing this code works fine in a worksheet, but gives an error in a sagesilent block of my .tex document. Here's the code:

sci = {}
for index in range(1, 14):     # Picks random coeffs for sci not.
    places = ZZ.random_element(0, 4)
    sci["co{0}".format(index)] = round(10*random(), places)
powe = {}
for index in range(1, 14):     # Picks random powers for use.
    powe["r{0}".format(index)] = ZZ.random_element(5, 10)
sci['co1']
sci['co2']
powe['r1']
powe['r2']

In the worksheet, those last four lines generate output like

3.0
5.566
7
8

But when I use that same code in the .tex document (without the last four lines), Sage returns this error before I can even call my numbers:

'module' object is not callable

My best guess is that rounding needs some package that the worksheet imports automatically but sagetex does not, but I'm afraid I don't know enough about what's really going on. Thank you for any help!