Ask Your Question

Revision history [back]

The input f(x) = cos(x) is preparsed by Sage as follows.

sage: preparse('f(x) = cos(x)')
'__tmp__=var("x"); f = symbolic_expression(cos(x)).function(x)'

The following definition

sage: f = lambda x: 1

is synonymous with

sage: def f(x): return 1

If you want a symbolic function returning 1, see the discussion at

https://groups.google.com/d/topic/sage-devel/thSpls984Ik/discussion