1
$\begingroup$

Is there any way (or a package built for it) can do simple operations with vectors and matricies of arbitrary size, but conforming extents?

For the simplest example to test, given an arbitrary vector $a,z\in R^n$ and $A \in R^{n \times n}$, $\nabla(a \cdot z) = a$ and the jabobian: $\nabla(A \cdot z) = A$, etc.

I tried the obvious (assuming that $z$ was a vector) Grad[a . z, {z}] etc, but it didn't work. I noticed Differentiating with respect to vectors of unspecified length, and Generating a vector of dummy variables but they didn't appear to help - and may be suggesting that it isn't possible...

$\endgroup$
4
  • $\begingroup$ You have to use symbolic tensors. $\endgroup$ Commented Oct 8, 2013 at 23:06
  • $\begingroup$ Closely related: How to declare a 3D vector variable?. $\endgroup$
    – Artes
    Commented Oct 8, 2013 at 23:54
  • $\begingroup$ Tensors and reductions may be overkill, but they sure look like they would work. Are there easy ways to apply differential operators to an expression with tensors, tensor products, etc? (i.e. my gradient operation above). $\endgroup$
    – jlperla
    Commented Oct 9, 2013 at 2:28
  • $\begingroup$ If you perform numerical computations you can consider using built-in Experimantal`NumericalFunction for automatic gradients and Jacobians. $\endgroup$ Commented Apr 15, 2014 at 16:01

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.