I would like to define symbolic functions that are functions of vector-valued quantities, like
where A and x are understood to be a matrix and compatibly-sized vector. I would like to be able to do matrix-vector calculus which gives the result in matrix vector form, such as
>> G = gradient(f)
G = 2*A*x
I would also like to define functions involving indexing expressions, like
h(x) = x(1) + x(2) + x(3)
Are these things possible? The closest thing I can find is the syntax
but this doesn't seem to behave as I've described. For one thing, manipulations with x do not get simplified to matrix-vector forms.