Ask Your Question

Revision history [back]

You could try with passing a dictionary to the .subs() method:

sage: def test(f,myvar,myval):
sage:    return f.subs({myvar:myval})

sage: print(test(f,x,3))
9