Given that $x$ and $y$ are column vectors and $A$ is a matrix, I figured out the result $y^{T}y-2y^{T}Ax +x^{T}A^{T}A\,x$
I want to use Mathematica to make such calculations. how do I enter them into a notebook?
Below is my attempt
Given that $x$ and $y$ are column vectors and $A$ is a matrix, I figured out the result $y^{T}y-2y^{T}Ax +x^{T}A^{T}A\,x$
I want to use Mathematica to make such calculations. how do I enter them into a notebook?
Below is my attempt
Without the addition of third-party symbolic algebra packages, Mathematica does symbolic algebra best with definite dimensions. You can do things like
With[{m = 3, n = 4},
Module[{A, xx, yy},
A = Array[a, {m, n}];
xx = Array[x, n];
yy = Array[y, m];
(yy - A.xx).(yy - A.xx)]]
(-a[1, 1] x[1] - a[1, 2] x[2] - a[1, 3] x[3] - a[1, 4] x[4] + y[1])^2 + (-a[2, 1] x[1] - a[2, 2] x[2] - a[2, 3] x[3] - a[2, 4] x[4] + y[2])^2 + (-a[3, 1] x[1] - a[3, 2] x[2] - a[3, 3] x[3] - a[3, 4] x[4] + y[3])^2
Note that Mathematica does not distinguish between row and column vectors and will not transpose vectors.