:py:mod:`symfem.basis_functions` ================================ .. py:module:: symfem.basis_functions .. autoapi-nested-parse:: Abstract basis function classes and functions. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: symfem.basis_functions.BasisFunction symfem.basis_functions.SubbedBasisFunction .. py:class:: BasisFunction(scalar=False, vector=False, matrix=False) Bases: :py:obj:`symfem.functions.AnyFunction` A basis function of a finite element. This basis function can be used before the element's basis functions have been computed. When the explicit basis function is needed, only then will it be computed. .. py:method:: get_function() -> symfem.functions.AnyFunction :abstractmethod: Get the actual basis function. :returns: The basis function .. py:method:: __add__(other: Any) -> symfem.functions.AnyFunction Add. :param other: A function to add to this function. :returns: The sum of two functions .. py:method:: __radd__(other: Any) -> symfem.functions.AnyFunction Add. :param other: A function to add to this function. :returns: The sum of two functions .. py:method:: __sub__(other: Any) -> symfem.functions.AnyFunction Subtract. :param other: A function to subtract this function. :returns: The difference of two functions .. py:method:: __rsub__(other: Any) -> symfem.functions.AnyFunction Subtract. :param other: A function to subtract this function from. :returns: The difference of two functions .. py:method:: __neg__() -> symfem.functions.AnyFunction Negate. :returns: Negated function .. py:method:: __truediv__(other: Any) -> symfem.functions.AnyFunction Divide. :param other: A function to divide this function by. :returns: The ratio of two functions .. py:method:: __rtruediv__(other: Any) -> symfem.functions.AnyFunction Divide. :param other: A function to divide by this function. :returns: The ratio of two functions .. py:method:: __mul__(other: Any) -> symfem.functions.AnyFunction Multiply. :param other: A function to multiply by this function. :returns: The product of two functions .. py:method:: __rmul__(other: Any) -> symfem.functions.AnyFunction Multiply. :param other: A function to multiply by this function. :returns: The product of two functions .. py:method:: __matmul__(other: Any) -> symfem.functions.AnyFunction Multiply. :param other: A function to matrix multiply by this function. :returns: The product of two matrix functions .. py:method:: __rmatmul__(other: Any) -> symfem.functions.AnyFunction Multiply. :param other: A function to matrix multiply by this function. :returns: The product of two matrix functions .. py:method:: __pow__(other: Any) -> symfem.functions.AnyFunction Raise to a power. :param other: A power to raise this function to. :returns: This function to the power of other .. py:method:: as_sympy() -> symfem.functions.SympyFormat Convert to a sympy expression. :returns: This function as a Sympy expression .. py:method:: as_tex() -> str Convert to a TeX expression. :returns: A TeX representation of this function .. py:method:: diff(variable: sympy.core.symbol.Symbol) -> symfem.functions.AnyFunction Differentiate the function. :param variable: The variable to differentiate with respect to :returns: The derivative .. py:method:: directional_derivative(direction: symfem.geometry.PointType) -> symfem.functions.AnyFunction Compute a directional derivative. :param direction: The direction of the derivative :returns: The derivative .. py:method:: jacobian_component(component: Tuple[int, int]) -> symfem.functions.AnyFunction Compute a component of the jacobian. :param component: The component to compute :returns: Component of the Jacobian .. py:method:: jacobian(dim: int) -> symfem.functions.AnyFunction Compute the jacobian. :param dim: The dimension of the Jacobian :returns: The Jabobian .. py:method:: dot(other_in: symfem.functions.FunctionInput) -> symfem.functions.AnyFunction Compute the dot product with another function. :param other_in: The function to dot with :returns: The dot product .. py:method:: cross(other_in: symfem.functions.FunctionInput) -> symfem.functions.AnyFunction Compute the cross product with another function. :param other_in: The function to cross with :returns: The cross product .. py:method:: div() -> symfem.functions.AnyFunction Compute the divergence of the function. :returns: The divergence .. py:method:: grad(dim: int) -> symfem.functions.AnyFunction Compute the gradient of the function. :returns: The gradient .. py:method:: curl() -> symfem.functions.AnyFunction Compute the curl of the function. :returns: The curl .. py:method:: norm() -> symfem.functions.ScalarFunction Compute the norm of the function. :returns: The norm .. py:method:: integral(domain: symfem.references.Reference, vars: symfem.symbols.AxisVariablesNotSingle = x, dummy_vars: symfem.symbols.AxisVariablesNotSingle = t) -> symfem.functions.ScalarFunction Compute the integral of the function. :param domain: The domain of the integral :param vars: The variables to integrate with respect to :param dummy_vars: The dummy variables to use inside the integral :returns: The integral .. py:method:: subs(vars: symfem.symbols.AxisVariables, values: symfem.functions.ValuesToSubstitute) -> BasisFunction Substitute values into the function. :param vars: The variable(s) to substitute :param values: The value(s) to substitute :returns: Substituted function .. py:method:: __getitem__(key) -> symfem.functions.AnyFunction Forward all other function calls to symbolic function. .. py:method:: __len__() -> int Get length. :returns: The length .. py:method:: det() -> symfem.functions.ScalarFunction Compute the determinant. :returns: The determinant .. py:method:: transpose() -> symfem.functions.ScalarFunction Compute the transpose. :returns: The transpose .. py:method:: with_floats() -> symfem.functions.AnyFunction Return a version the function with floats as coefficients. :returns: The function with floats as coefficients .. py:method:: __iter__() -> Iterator[symfem.functions.AnyFunction] Iterate through components of vector function. .. py:method:: maximum_degree(cell: symfem.references.Reference) -> int Return the maximum degree of the function on a reference cell. This function returns the order of the lowerst order Lagrange space on the input cell that includes this function. :param cell: The cell :returns: A version the function with floats as coefficients .. py:class:: SubbedBasisFunction(f: BasisFunction, vars: symfem.symbols.AxisVariables, values: symfem.functions.ValuesToSubstitute) Bases: :py:obj:`BasisFunction` A basis function following a substitution. .. py:property:: shape :type: Tuple[int, Ellipsis] Get the value shape of the function. :returns: shape .. py:method:: get_function() -> symfem.functions.AnyFunction Return the symbolic function. :returns: Symbolic function .. py:method:: plot_values(reference: symfem.references.Reference, img: Any, value_scale: sympy.core.expr.Expr = sympy.Integer(1), n: int = 6) Plot the function's values. :param reference: The domain to plot the function on :param img: The image to plot the values on :param value_scale: The factor to scale values by :param n: The number of plotting points .. py:method:: maximum_degree(cell: symfem.references.Reference) -> int Return the maximum degree of the function on a reference cell. This function returns the order of the lowerst order Lagrange space on the input cell that includes this function. :param cell: The cell :returns: A version the function with floats as coefficients