newField(expression)
This function defines the particular vector field written in the given expression as elements of type DiffAlgField. If any parameters are founded in the given expression, they are automatically included in the ring of scalar coefficients.
In the following example we define two particular vector fields, X and Y, and compute the addition X+Y. Notice that in the definition of X we are introducing a scalar parameter named a, also the variable x_2 is missing from the ring of X. When computing X+Y, the rings of both vector fields are automatically merged.
|
|
|
|
|
|
In this example we show that the variables will always start from the index 0 and go up to the highest index encountered in the expression defining the vector field.
|
|