Skip to main content

Theory of Functional Connections (TFC): A functional interpolation framework with applications in differential equations.

Project description

Theory of Functional Connections (TFC)

A functional interpolation framework with applications in solving differential equations.

Continuous integration Documentation Status PyPI version

Installation guide | Reference documentation | Mathematical documentation

Summary:

The tfc Python module is designed to help you quickly and easily apply the Theory of Functional Connections (TFC) to optimization problems. For more information on the code itself and code-based tutorials, see the Reference documentation. What follows is a brief description of TFC.

TFC is a functional interpolation framework centered around the concept of the constrained expression. A constrained expression is a mathematical functional that expresses all possible functions that satisfy a set of user-defined constraints. For example, suppose you are interested in all possible functions that satisfy the constraint y(0) = 3. The TFC constrained expression for this constraint is,

y(x,g(x)) = g(x) + 3 - g(0),

where g(x) is any function defined at the constraint point; by changing g(x) you get different outputs, but all of these outputs satisfy the constraint regardless of how you choose g(x). In this way, you maintain a completly unrestricted functiton, g(x), which we will call the free function, but always satsify the constraint. Neat, huh?

While developing the constrained expression for our example above was trivial, as you introduce more complex constraints in n-dimensions, trying to derive these constrained expression by-eye, i.e., without a step-by-step framework, becomes extremely difficult. Luckily, TFC comes equiped with a straightfowrward, step-by-step process for developing constrained expressions. For more information on this process, see the Mathematical documentation.

Since the constrained expressions effectively translate the set of all functions defined at the constraints—this set is represented by g(x), the domain of the functional—to the set of all functions that satisfy the constraints—this is the output or co-domain of the constrained exppression—the constrained expresssion can be used to transform constrained optimization problems into unconstrained optimization problems. For example, consider the following differential equation,

yx = 2y,    where    y(0) = 3.

This differential equation can be viewed as an optimization problem where we seek to minimize the residual of the differential equation, i.e., minimize J where J = yx - 2y. Classicly, we would have to minimize J using y(x) subject to the constraint y(0) = 3. However, with TFC we can minimize J using g(x) where y(x,g(x)) = g(x) + 3 - 0, and g(x) is not subject to any constraints. Thus, TFC has translated our differential equation from a constrained optimization problem to an unconstrained optimization problem! The benefits of doing so include:

  • More accurate solutions
  • Faster solutions
  • Robustness to initial guess

For more information on the appliation of TFC to differential equations and its benefits see the Mathematical documentation.

Installation:

The following instructions can be used to install a source distribution via pip or build TFC directly from source. Currently, we support building TFC navitely on Linux or macOS, but Windows users can still use TFC via the Windows Subsystem for Linux.

To install via pip run:

pip install --upgrade pip setuptools wheel numpy
pip install --upgrade tfc

The above will install a binary TFC wheel. The developers have found that installing a source distribution leads to code that is slightly faster on some machines, as the code is compiled using potentially newer versions of compilers and swig. If you would like the source distribution, then you can use the following:

pip install tfc --no-binary tfc

Note that you may need to first install the system package dependencies listed in the Building from source section if they are not already installed.

Reference Documentation:

For tutorials on how to use this package as well as information about the tfc API, see the reference documentation.

Mathematical Documentation:

Any users interested in the process for developing constrained expressions, the mathematical theory behind TFC, and the application of TFC to differential equations should start with this journal article; note that the article is open access, so you can download it for free. The curious user can continue their study of the mathematical theory by visiting the TFC article repository on ResearchGate for a complete list of TFC publications with free downloadable PDFs. Furthermore, links to free downloadable versions of Hunter's and Carl's dissertations can be found in the READMEs of their respective folders in the examples directory. Finally, the TFC textbook is available for purchase here.

Citing this repository:

The authors of this repsitory and the associated theory have gone to lengths to ensure that both are publicy available at no cost to the user. All that we ask in return is that if you use them, please add a reference to this GitHub and following journal article. Thank you.

@misc{tfc2022github,
    author = {Carl Leake and Hunter Johnston},
    title = {{TFC: A Functional Interpolation Framework}},
    url = {https://github.com/leakec/tfc},
    version = {1.0.2},
    year = {2022},
}
@article{TFC, 
    title={The Multivariate Theory of Functional Connections: Theory, Proofs, and Application in Partial Differential Equations}, 
    volume={8}, 
    ISSN={2227-7390}, 
    url={http://dx.doi.org/10.3390/math8081303}, 
    DOI={10.3390/math8081303},
    number={8}, 
    journal={Mathematics},
    publisher={MDPI AG},
    author={Leake, Carl and Johnston, Hunter and Mortari, Daniele}, 
    year={2020}, 
    month={Aug}, 
    pages={1303}
}

For developers:

Building from source:

  1. Create a dist directory in the main directory.
  2. Run python setup.py bdist_wheel from the main directory.
  3. Navigate to dist, and run pip3 install "wheel" where "wheel" is the name of the wheel created in the previous step.

Dependencies:

  • System Packages:
    • swig
    • graphviz
  • Python Packages:
    • matplotlib
    • jax
    • jaxlib
    • colorama
    • graphviz
    • yattag

Testing instructions:

  1. Navigate to the tests directory.
  2. Run py.test or python -m pytest. These serve as simple unit tests that test basic functionality of the code. These include tests for individual TFC functions, as well as full ODE and PDE tests.

Building Reference Documentation from Source:

If for some reason you want to build the reference documentation from source, you can do so using these two steps:

  1. Change into the docs directory.
  2. Run:
sphinx-build . _build/html

The code documentation will appear under _build/html and the main file is index.html. This file can also be accessed using the SphinxDocumentation.html symbolic link in the docs directory.

Dependencies:

  • System Packages:
    • graphviz
    • doxygen
    • python3-sphinx
  • Python Packages:
    • sphinx
    • sphinx_rtd_theme
    • nbsphinx
    • breathe
    • exhale

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tfc-1.0.2.tar.gz (62.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

tfc-1.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (463.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

tfc-1.0.2-cp311-cp311-macosx_10_9_x86_64.whl (156.6 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

tfc-1.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (455.8 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

tfc-1.0.2-cp310-cp310-macosx_10_9_x86_64.whl (156.6 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

tfc-1.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (455.6 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

tfc-1.0.2-cp39-cp39-macosx_10_9_x86_64.whl (156.6 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

tfc-1.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (454.8 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

tfc-1.0.2-cp38-cp38-macosx_10_9_x86_64.whl (157.0 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

File details

Details for the file tfc-1.0.2.tar.gz.

File metadata

  • Download URL: tfc-1.0.2.tar.gz
  • Upload date:
  • Size: 62.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for tfc-1.0.2.tar.gz
Algorithm Hash digest
SHA256 b8818a009ffef578d6a6cb377d9d50edc1377dac01442eaf932d192ebc10b2b8
MD5 55594f1a90b86b32bd846fd26a339ec5
BLAKE2b-256 1521b5c5fb795f3758bc7378486a6718d4cf9e8a246e9ed3aeeba50825a26af0

See more details on using hashes here.

File details

Details for the file tfc-1.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tfc-1.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 660a3b11b0175fd877bf13440b8edb9a77726213df42cbd65e376a9cc0163cf8
MD5 c84a798877652c32394e9aaf44b908a0
BLAKE2b-256 6713ed119ffab45e0b25f16e1d1c44f43ee1dac3a175dabf453c9e4aa4f560ee

See more details on using hashes here.

File details

Details for the file tfc-1.0.2-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for tfc-1.0.2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d3e15d50f39b381d3fa166cc1d428ed70d8b3b9c9ff1ceb8f3059e4303ca3537
MD5 bcb35fc9c55929910439a431a142f6ec
BLAKE2b-256 dac1c3f817eed63c68b002c786e92560a46ee9ba76460aad5f9563d79bf3aa07

See more details on using hashes here.

File details

Details for the file tfc-1.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tfc-1.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ba189a817c97ec26bcc6bb1d95819fd944b89a3df7962d20381db28ed4d1875b
MD5 436ce8f9e318c5a198b14032c0e9eeb9
BLAKE2b-256 e48ae6544cf6ea61e1c328c7963be8d2492b39b583a4f94e0d676021fd35d9ca

See more details on using hashes here.

File details

Details for the file tfc-1.0.2-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for tfc-1.0.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 317e2c814d2c31a574a364424e7edee4f4ac815982c6819214d86965f28955cf
MD5 78056113388490b8e09544b9aac7d7f1
BLAKE2b-256 ca52bc964ea33716b2de9bca7c4fcc47c0f5f8beb3b921a95095b4b1abee2518

See more details on using hashes here.

File details

Details for the file tfc-1.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tfc-1.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ed89fb4b3cb395c5bdbaf2a9c103c3d02fcffdd138bdca18652be8710c5907db
MD5 7cd8c5bd331af371bd05d5e37094418c
BLAKE2b-256 9aab70d37c2f18bbfca1c16a44850559cde776664eef38bf77b4a34470ef5d20

See more details on using hashes here.

File details

Details for the file tfc-1.0.2-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: tfc-1.0.2-cp39-cp39-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 156.6 kB
  • Tags: CPython 3.9, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for tfc-1.0.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 16b4a57430130899d2b81d6798a532846c1fb08912af723d4d97dfb352f37317
MD5 d0d57512ee8211561ffb6d52c9b44ec3
BLAKE2b-256 a9fa7bffc0a8a85c77603657002973a032dcbfe3a08f359bafc3c928f8cd4b24

See more details on using hashes here.

File details

Details for the file tfc-1.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tfc-1.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7f0cdb1927cc4f2536aed3814bfbfd277214ce42b7a3c8c162978567aec1e069
MD5 9abfe7ab7a3c166d933f185de897c512
BLAKE2b-256 a190327d3d922808745dc6873f53f82c3ebfb3b733f1ca043e34f5019441244e

See more details on using hashes here.

File details

Details for the file tfc-1.0.2-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: tfc-1.0.2-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 157.0 kB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for tfc-1.0.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2dd1732442f0e85384125d879282265961166b1b4d7507a94e02086d66464ad5
MD5 ab078eeeb3880d414b88a2df7a46a674
BLAKE2b-256 a5f9d308a366ef999a8a23360bb96f1bae2e616557b9cf5597718baca3bdf598

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page