# Revision history [back]

If you ask for the type of $f$, you get <𝚝𝚢𝚙𝚎'𝚜𝚊𝚐𝚎.𝚜𝚢𝚖𝚋𝚘𝚕𝚒𝚌.𝚎𝚡𝚙𝚛𝚎𝚜𝚜𝚒𝚘𝚗.𝙴𝚡𝚙𝚛𝚎𝚜𝚜𝚒𝚘𝚗'>: apparently the substitution into symbolic expressions is not overloaded to matrix-valued functions. However, with

var('x y')
f = matrix(SR, [[sin(x)],[cos(x)]])
type(f)


you get <𝚝𝚢𝚙𝚎'𝚜𝚊𝚐𝚎.𝚖𝚊𝚝𝚛𝚒𝚡.𝚖𝚊𝚝𝚛𝚒𝚡⎯𝚜𝚢𝚖𝚋𝚘𝚕𝚒𝚌⎯𝚍𝚎𝚗𝚜𝚎.𝙼𝚊𝚝𝚛𝚒𝚡⎯𝚜𝚢𝚖𝚋𝚘𝚕𝚒𝚌⎯𝚍𝚎𝚗𝚜𝚎'>, and

f(x=x+y)


gives the expected result.

If you ask for the type of $f$, you get <𝚝𝚢𝚙𝚎'𝚜𝚊𝚐𝚎.𝚜𝚢𝚖𝚋𝚘𝚕𝚒𝚌.𝚎𝚡𝚙𝚛𝚎𝚜𝚜𝚒𝚘𝚗.𝙴𝚡𝚙𝚛𝚎𝚜𝚜𝚒𝚘𝚗'>: apparently the substitution into symbolic expressions is not overloaded to matrix-valued functions. However, with

var('x y')
f = matrix(SR, [[sin(x)],[cos(x)]])
type(f)


you get <𝚝𝚢𝚙𝚎'𝚜𝚊𝚐𝚎.𝚖𝚊𝚝𝚛𝚒𝚡.𝚖𝚊𝚝𝚛𝚒𝚡⎯𝚜𝚢𝚖𝚋𝚘𝚕𝚒𝚌⎯𝚍𝚎𝚗𝚜𝚎.𝙼𝚊𝚝𝚛𝚒𝚡⎯𝚜𝚢𝚖𝚋𝚘𝚕𝚒𝚌⎯𝚍𝚎𝚗𝚜𝚎'>, and

f(x=x+y)


gives the expected result.

Alternatively, try with:

def f(x): return matrix(SR, [[sin(x)],[cos(x)]])


to obtain an object $f$ of type 'function'.