# Function¶

class dolfin.functions.function.Function(*args, **kwargs)

Bases: ufl.coefficient.Coefficient, dolfin.cpp.function.Function

This class represents a function $$u_h$$ in a finite element function space $$V_h$$, given by

$u_h = \sum_{i=1}^n U_i \phi_i,$

where $$\{\phi_i\}_{i=1}^n$$ is a basis for $$V_h$$, and $$U$$ is a vector of expansion coefficients for $$u_h$$.

Arguments

There is a maximum of three arguments. The first argument must be a Function or a FunctionSpace.

If instantiated from another Function, the (optional) second argument must be an integer denoting the number of sub functions to extract.

In addition can a name argument be passed overruling the default name

Examples

Create a Function:

• from a FunctionSpace V

f = Function(V)

• from another Function f

g = Function(f)

• from a FunctionSpace V and a GenericVector v

g = Function(V, v)

• from a FunctionSpace and a filename containg a GenericVector

g = Function(V, 'MyVectorValues.xml')


Initialize Function.

assign(rhs)

Assign either a Function or linear combination of Functions.

Arguments
rhs (_Function_)
A Function or a linear combination of Functions. If a linear combination is passed all Functions need to be in the same FunctionSpaces.
split(deepcopy=False)

Extract any sub functions.

A sub function can be extracted from a discrete function that is in a MixedFunctionSpace or in a VectorFunctionSpace. The sub function resides in the subspace of the mixed space.

Arguments
deepcopy
Copy sub function vector instead of sharing
str(verbose=False)

Return an informative str representation of itself

sub(i, deepcopy=False)

Return a sub function.

The sub functions are numbered from i = 0..N-1, where N is the total number of sub spaces.

Arguments
i
: int
The number of the sub function
ufl_element()

Return ufl element

ufl_evaluate(x, component, derivatives)

Function used by ufl to evaluate the Function