The error you encounter is not with fast_callable
, but with defining a symbolic function.
In general, it is recommended to write one instruction per line.
This would let you see that while your first example works:
sage: k = 1.8
sage: func(m) = bessel_J(m^2, k)
sage: fmax = fast_callable(func, vars=[m])
sage: print func(1.)
0.581516951731165
sage: print fmax(1.)
0.581516951731165
the second example fails at the stage of defining func(m)
:
sage: k = 1.8
sage: v = [0.0, 1.0, 4.0, 9.0]
sage: func(m) = bessel_J(v[m], k)
Traceback (most recent call last)
...
TypeError: unable to convert m to an integer
A simpler example of this failure is as follows:
sage: l = [1, 2, 3]
sage: f(m) = l[m]
Traceback (most recent call last)
...
TypeError: unable to convert m to an integer
Hi! Can you give a minimal working (or not working, I guess) code example of exactly what you are trying to do?
Hi, thanks for your comment - I should've included a working snippet example of what I am trying to do.
0.581516951731165; 0.581516951731165
Traceback (click to the left of this block for traceback) ... TypeError: unable to convert m to an integer
Even better, would you edit your question and add the example there?
To display blocks of code, either indent them with 4 spaces, or select the corresponding lines and click the "code" button (the icon with '101 010'). Can you edit your question to do that?
To display inline code, surround it within "backticks" or "backquotes" `.