Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

A problem with fast_callable

I am having a problem with getting consistent results from fast_callable (Sagemath 9.2). Consider the following example:

import numpy as np
x = var('x')
coords(x) = [2.0 * x,  0.0]

c0 = fast_callable(coords[0], vars=[x])
c1 = fast_callable(coords[1], vars=[x])

print(c0(np.array((1.0,2.0))))
print(c1(np.array((1.0,2.0))))

The result of the first print is [2. 4.] as expected but the result of the second print is just 0.0 instead of [0.0,0.0]. In my real application coords dynamically changes, and becuase of this I have to check whether a compomnant is constant or not before applying fast_callable.

1-Is there a way to get a consistent behavior out of fast_callable?

2-Is this a feature or a bug?