## Documentation Center |

On this page… |
---|

c as Tensor, Matrix, and Vector |

This section describes how to write the coefficient `c` in
the equation

or in similar equations. The coefficient `c` is
an *N*-by-*N*-by-2-by-2 tensor with
components **c**(*i*,*j*,*k*,*l*). *N* is
the number of equations, see Systems of PDEs.

The notation
means the *N*-by-1
matrix with (*i*,1)-component.

There are many ways to represent the coefficient *c*.
All representations begin with a "flattening" of the *N*-by-*N*-by-2-by-2
tensor to a 2*N*-by-2*N* matrix,
where the matrix is logically an *N*-by-*N* matrix
of 2-by-2 blocks.

The matrix further gets flattened to a vector, where the *N*-by-*N* matrix
of 2-by-2 blocks is first transformed to a "vector"
of 2-by-2 blocks, and then the 2-by-2 blocks are turned into vectors
in the usual column-wise way.

The coefficient vector `c` relates to the tensor **c** as follows:

Coefficient *c*(*i*,*j*,*k*,*l*)
is in row (4*N*(*j*–1)+4*i*+2*l*+*k*–6)
of the vector `c`.

Express `c` as numbers, text expressions, or
functions, as in f for Systems.

Often, your tensor **c** has structure,
such as symmetric or block diagonal. In many cases, you can represent **c** using a smaller vector than one with 4*N*^{2} components.

The number of rows in the matrix can differ from 4*N*^{2},
as described in the next few sections.

In function form, the number of columns is `Nt`,
which is the number of triangles in the mesh. The function should
evaluate `c` at the triangle centroids, as in Scalar PDE Coefficients in Function Form. Give
solvers the function name as a string `'filename'`,
or as a function handle @

The software interprets a scalar *c* as a diagonal
matrix, with *c*(*i*,*i*,1,1)
and *c*(*i*,*i*,2,2)
equal to the scalar, and all other entries 0.

The software interprets a two-element column vector *c* as
a diagonal matrix, with *c*(*i*,*i*,1,1)
and *c*(*i*,*i*,2,2)
as the two entries, and all other entries 0.

The software interprets a three-element column vector *c* as
a symmetric block diagonal matrix, with *c*(*i*,*i*,1,1) = *c*(1), *c*(*i*,*i*,2,2) = *c*(3), and *c*(*i*,*i*,1,2) = *c*(*i*,*i*,2,1) = *c*(2).

The software interprets a four-element column vector *c* as
a block diagonal matrix.

The software interprets an *N*-element column
vector *c* as a diagonal matrix.

you cannot use the
Instead, use the 2 |

The software interprets a 2*N*-element column
vector *c* as a diagonal matrix.

you cannot give
Instead, use the 3 |

The software interprets a 3*N*-element column
vector *c* as a symmetric block diagonal matrix.

Coefficient *c*(*i*,*j*,*k*,*l*)
is in row (3*i*+*k*+*l*–4)
of the vector `c`.

The software interprets a 4*N*-element column
vector *c* as a block diagonal matrix.

Coefficient *c*(*i*,*j*,*k*,*l*)
is in row (4*i*+2*l*+*k*–6)
of the vector `c`.

The software interprets a 2*N*(2*N*+1)/2-element
column vector *c* as a symmetric matrix. In the following
diagram, • means the entry is symmetric.

Coefficient *c*(*i*,*j*,*k*,*l*),
for *i* < *j*,
is in row (2*j*^{2}–3*j*+4*i*+2*l*+*k*–5)
of the vector `c`. For *i* = *j*, coefficient *c*(*i*,*j*,*k*,*l*)
is in row (2*i*^{2}+*i*+*l*+*k*–4)
of the vector `c`.

The software interprets a 4*N*^{2}-element
column vector *c* as a matrix.

Coefficient *c*(*i*,*j*,*k*,*l*)
is in row (4*N*(*j*–1)+4*i*+2*l*+*k*–6)
of the vector `c`.

Was this topic helpful?