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.
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.
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.
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{tfc2023github,
author = {Carl Leake and Hunter Johnston},
title = {{TFC: A Functional Interpolation Framework}},
url = {https://github.com/leakec/tfc},
version = {1.0.15},
year = {2024},
}
@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:
- Create a dist directory in the main directory.
- Run python setup.py bdist_wheel from the main directory.
- 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:
- Navigate to the tests directory.
- 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:
- Change into the docs directory.
- 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: see requirements.txt file in the docs directory.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for tfc-1.0.15-cp313-cp313-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8554204bf0d051e74e288994b4773159e5f450631493326eb4a731ad58fd2643 |
|
MD5 | 3e79f76d327abc733fb443c34e067ef4 |
|
BLAKE2b-256 | 75ec0b7d12a2ee4d330715178d8cc7c30d2fa0f053c897f39aeb68b6e901bde3 |
Hashes for tfc-1.0.15-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9332f96aa063268ced3c9913da1e1f6d2b6f1f7ce3c0690b54972e0a15c731d3 |
|
MD5 | 0b4a8a57fd6fb9556f78523ad268859e |
|
BLAKE2b-256 | ce21c81f0c781e10e3d2c471f0965df6d7255f3840d5619c644c092c2fa42c31 |
Hashes for tfc-1.0.15-cp313-cp313-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c093c41dcd463f62785bc598f2fd14eeae884f1c0a2c55d9704ec7c590ed4990 |
|
MD5 | 08600bd98db2591eb2cb22370f9c87fb |
|
BLAKE2b-256 | 9e8196c73650abc386b36c0596bf1713c9467388c8d8cda5c3e56df4d4b9d122 |
Hashes for tfc-1.0.15-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f8932fb8c4bf46fdebaec9ca1f64326218a3c3d7b312103bba924482e731b1f |
|
MD5 | 65472b56dc0587d438d9d57561cdedf7 |
|
BLAKE2b-256 | 0f797d9969e1718518a3b1c08017b55d93310d7a950b87574d38f04735719d6d |
Hashes for tfc-1.0.15-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6fdd511515c83d2dfb6135fa00b9d4b4d517dbe8c13b4f7e4c0a673f85ae5db3 |
|
MD5 | 771bfc0cdcabf5a78218a5f22dd6863d |
|
BLAKE2b-256 | 778329696a83e00b8940b8c26e001a3cc926d38b5542642604416705a7b465d9 |
Hashes for tfc-1.0.15-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b86b237d6cf1ab484e9f3050274d67977bc87839b0d6c7ca93c53d065539e46 |
|
MD5 | cd5df7819154dc40e9fd1e2ad9915c44 |
|
BLAKE2b-256 | d3fed90df7772ee4ae6d30d6e8a614e5fe69b876f07f74ab453275892eb1978b |
Hashes for tfc-1.0.15-cp312-cp312-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d09fa0e8c543a07ecd4cc6366d2bfac854a4b88dcf168883f3062e15b9635f73 |
|
MD5 | 2c88532985bc178a0ee8d0cff7c3564b |
|
BLAKE2b-256 | cb089a74d0f5773b2a73b701bb1daf612203e6a4e5a1c553dc811c9f1ab0f4ca |
Hashes for tfc-1.0.15-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b15a35709443f609447903018d814934fdb3e89534b147fa50294f66cb5e1bf |
|
MD5 | 70b194bbc8d459f07e6d71acf6a75b17 |
|
BLAKE2b-256 | 37f4d3fba8e163a28391fbde23f336e8f8f488147047aa0389df1bb1a1db6838 |
Hashes for tfc-1.0.15-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b899eca764f95e7b943c9090b117f18581ed5bb82225f461a99b8f3b12d1435 |
|
MD5 | 769e6b11d95ef5b19b02714d841a30a2 |
|
BLAKE2b-256 | 4b34b0218081dfaa759b6c801c2f6566757b16a9d11c18476fc4a2e930ba085e |
Hashes for tfc-1.0.15-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aee90af80210d34745b31aacf12457d549f3d6429f334a3cf516c36dd0d4c913 |
|
MD5 | 68e1a9dc4acd9f578e0a3207d3b144c5 |
|
BLAKE2b-256 | 798f069004a4c56c83f4b807497c3e39831d57ab3fe7acd48f1dbff34cf17ec7 |
Hashes for tfc-1.0.15-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4e9ad3a8737a8359d2261bce8d1fb6aef8f885e8f919dbe984a8e1654ee935e |
|
MD5 | 7b359de0dbd520c417f4537216be3c44 |
|
BLAKE2b-256 | c9c96a17f166e7c5b009fb07a9d1e619bf2c59a992e5e329daabfc1d91dd8ec7 |
Hashes for tfc-1.0.15-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 013d19fc1ee847bdcb9935d70eaf23c660c29bfbf4fe9ce32628052f2caf4c87 |
|
MD5 | 9d6f0ee0453671b6c554a9f37c1bca28 |
|
BLAKE2b-256 | 503a9705381a5e2c77d6385daeaa96ad686aa57dcf9334c559a5e5d5025f07fe |
Hashes for tfc-1.0.15-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03d5a80798787342997915e711f9a1e66ba9569b07b1b919889196bb022d88dd |
|
MD5 | 70166a93c604fcce83de1eccf981090e |
|
BLAKE2b-256 | 2f1eee1d6bdad4906ca07d6996fd8a1adf2671142eec4d8d4816b5215ae2f0b3 |
Hashes for tfc-1.0.15-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a30ca4e664c944310447eda51e39c811d5ac13cf6050fc8c47435bb69093c2e |
|
MD5 | e7b743964fb419ac7a2f3db6ebc64f79 |
|
BLAKE2b-256 | 19a8427d4bc99e7cfbfec3d7cdedfdd27214f002a52e89101b1013b81ad1b3cc |
Hashes for tfc-1.0.15-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6094baa52a9f9cc22de521213f4a36a620bf0cf4cdfeb9d0cc8d5271e6d3b028 |
|
MD5 | 18caad090e358811a0cc237aa8da14de |
|
BLAKE2b-256 | 2b57191e5193737061e3e2535d3f44b38b56b4e3af88d75a9590c3bdf7d322ce |
Hashes for tfc-1.0.15-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5c3e106348d68247a2d5699b7f1b6f8fd3a8ed2762e877aba9b8bba56278e61 |
|
MD5 | de95ec7c6d5faa51c76f5d2f1ef31521 |
|
BLAKE2b-256 | 7aaf87519d0880e056e18d6432266f47dd8663eb2ca2f1661502e834c592823f |