Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The problem is that the value of arr[0] is y0(x), which is an expression consisting of a function evaluated at x. That's not the kind of functions that substitute_function deals with. You can use subs for that:

sage: square(arr[0]).subs(arr[0]==temp(x))
sin(x)^2

You are not the first person who get tripped up by the confusing fact that function('f',x) doesn't return a function but a function evaluated at (something). To get something that actually is a function, use function('f'). You can still evaluate that at x by writing function('f')(x). See http://trac.sagemath.org/ticket/17447 .