Month: January 2019

Vector Calculus in Bash Scripts

When performing preparatory operations for e.g. CFD or FEM analyses, it is often necessary to specify vector parameters. Vector constants are easy to handle:

However, it quickly becomes complicated if the vectors have to be manipulated, e.g. multiplied by scalars or rotated.

A powerful solution is to use the Matlab Octave clone to perform the operations. Two features of octave are useful in this context:

  • the command line option “–eval” to specify the expression to handle
  • the function “disp” to output the results in plain format in a single line

An example:

More complicated operation are possible. Though one needs to take care to produce line vectors as results. Rotation as an example: