.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/basis/plot_basis_2d.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_basis_plot_basis_2d.py: Two-dimensional Basis ===================== .. GENERATED FROM PYTHON SOURCE LINES 6-17 .. code-block:: Python # Author: Steven Golovkine # License: MIT # Load packages import numpy as np from FDApy.representation import Basis from FDApy.representation import DenseArgvals from FDApy.visualization import plot .. GENERATED FROM PYTHON SOURCE LINES 18-19 It is possible to define multi-dimensional basis functions using the :class:`~FDApy.representation.Basis` object. Multidimensional basis functions are defined as a tensor product of unidimensional basis. To create a multidimensional basis functions, we need a tuple of names and a tuple of number of functions. The sampling points are defined as a :class:`~FDApy.representation.DenseArgvals` object where each entry corresponds to the sampling points of one input dimension. .. GENERATED FROM PYTHON SOURCE LINES 19-27 .. code-block:: Python # Parameters name = ("fourier", "fourier") n_functions = (5, 5) argvals = DenseArgvals( {"input_dim_0": np.linspace(0, 1, 101), "input_dim_1": np.linspace(0, 1, 51)} ) .. GENERATED FROM PYTHON SOURCE LINES 28-29 Here, we show the basis functions for the tensor product of two Fourier basis. The basis functions consist of the tensor product of sine and cosine functions with a frequency that increases with the number of the function. .. GENERATED FROM PYTHON SOURCE LINES 29-32 .. code-block:: Python basis = Basis(name=name, n_functions=n_functions, argvals=argvals) _ = plot(basis) .. image-sg:: /auto_examples/basis/images/sphx_glr_plot_basis_2d_001.png :alt: plot basis 2d :srcset: /auto_examples/basis/images/sphx_glr_plot_basis_2d_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 2.155 seconds) .. _sphx_glr_download_auto_examples_basis_plot_basis_2d.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_basis_2d.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_basis_2d.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_basis_2d.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_