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.

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.2.0},
    year = {2025},
}
@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: see requirements.txt file in the docs directory.

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.2.0.tar.gz (71.2 kB view details)

Uploaded Source

Built Distributions

tfc-1.2.0-cp313-cp313-win_amd64.whl (142.7 kB view details)

Uploaded CPython 3.13Windows x86-64

tfc-1.2.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (472.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

tfc-1.2.0-cp313-cp313-macosx_11_0_arm64.whl (147.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

tfc-1.2.0-cp312-cp312-win_amd64.whl (142.7 kB view details)

Uploaded CPython 3.12Windows x86-64

tfc-1.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (471.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

tfc-1.2.0-cp312-cp312-macosx_11_0_arm64.whl (147.7 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

tfc-1.2.0-cp311-cp311-win_amd64.whl (142.0 kB view details)

Uploaded CPython 3.11Windows x86-64

tfc-1.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (463.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

tfc-1.2.0-cp311-cp311-macosx_11_0_arm64.whl (147.7 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

tfc-1.2.0-cp310-cp310-win_amd64.whl (142.0 kB view details)

Uploaded CPython 3.10Windows x86-64

tfc-1.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (458.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

tfc-1.2.0-cp310-cp310-macosx_11_0_arm64.whl (147.7 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: tfc-1.2.0.tar.gz
  • Upload date:
  • Size: 71.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for tfc-1.2.0.tar.gz
Algorithm Hash digest
SHA256 7cb01aa2e3ccd54414cdcedd26494a4f78781bb42abf455f16e0e396b0113c75
MD5 c7131c3915068757b5571413c105a2fd
BLAKE2b-256 904542b9ffbcdccc09ec061a56e802e134c2375ebdfeb97691eb0d31f49e909e

See more details on using hashes here.

File details

Details for the file tfc-1.2.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: tfc-1.2.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 142.7 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for tfc-1.2.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 aa1f29be52d8ae12f96577b2dfb6aab3147bc9b628453ad60e2c58fc371c62a2
MD5 9e315a00e1908795077a2fe125b88a8c
BLAKE2b-256 13a4ec50d277b74e7de5ae64369f9854d6071d282e9b8948c6552d76e9db3e79

See more details on using hashes here.

File details

Details for the file tfc-1.2.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tfc-1.2.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c6d558c85be6815fdccb0e782f05afde70ec1d2171e519a28e9e4d6d4c0319e2
MD5 33775bd73ea5b12c4cc25363c33ce674
BLAKE2b-256 3aa2c2ef4d846d5d8311c05aa8c5068a6effe53b6f78e80eed712cd562cf8b77

See more details on using hashes here.

File details

Details for the file tfc-1.2.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

  • Download URL: tfc-1.2.0-cp313-cp313-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 147.7 kB
  • Tags: CPython 3.13, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for tfc-1.2.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1a5a1d12202cf3e1c34f04e035c731de97aad37afd0fdaf11ef6528889c6af94
MD5 7f7ab0b47a627baae662119f9061cff9
BLAKE2b-256 fdeebefe8c114e308ae3eeefe3834c231aab46ebdbca7b29f84af56653a9cdcf

See more details on using hashes here.

File details

Details for the file tfc-1.2.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: tfc-1.2.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 142.7 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for tfc-1.2.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8cfc9fca16e23d91d93cc1d0cf9d549a9bcebb1c12e5bafa0a1d2048dfc0391c
MD5 4256b8103be78ac0e4b26deeff2861f0
BLAKE2b-256 ed0f509d0ad10a37dcd2224989361775d474ca4dc2bb0a09192c2ebcbfa39db9

See more details on using hashes here.

File details

Details for the file tfc-1.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tfc-1.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bd5e0a63e34bbb7a294e37c9e6ea3f96acd9014f8d30ba202ad8de3b3e7009ef
MD5 5234d183dd85ae6361dd5153ae06e136
BLAKE2b-256 9ec1aa6898a9eba2d944bf509e96271dbb2f3c2c27dd2f56c863c295c360321d

See more details on using hashes here.

File details

Details for the file tfc-1.2.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

  • Download URL: tfc-1.2.0-cp312-cp312-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 147.7 kB
  • Tags: CPython 3.12, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for tfc-1.2.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 83d96ce3a443de0a3ecbebe824ec17d6823cfbbdfba776ecf8f27993037d8384
MD5 bf63beea5cbaf07b6bae8476caece62d
BLAKE2b-256 6a2b4a6ed69093655e83cd95a9effe6dbfc5d4dcde73d6498fdb632e24ad95aa

See more details on using hashes here.

File details

Details for the file tfc-1.2.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: tfc-1.2.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 142.0 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for tfc-1.2.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 432a4495b5ee3b907cc5f09f8c25629dd86b30f39309655f60127a30d1925c8b
MD5 c8982ca388917695965200a518d62ed1
BLAKE2b-256 0f540e541f576d2ea3e0238234d6cd5e663b53826d16d9ff517160652925f33d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tfc-1.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d164a5e9e637ec1333935bf5dc2d93c1f26ace1d9847e6d4e53767a6fa7fdff8
MD5 d6d239253432deef12b64486a14ce4bd
BLAKE2b-256 b45b4ce337345bcb188b8727b52d21ba7768526a21be10bfb41d7e9f4b31d82c

See more details on using hashes here.

File details

Details for the file tfc-1.2.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

  • Download URL: tfc-1.2.0-cp311-cp311-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 147.7 kB
  • Tags: CPython 3.11, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for tfc-1.2.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 25092c4085653c70755809365bd3748a7c6c698fda6da9c4b27e62b550f79d98
MD5 694208f027b48e6fc446e76c3c4e4a6e
BLAKE2b-256 3d8171cd2ba19eabd71f672c82893b8f3bf7497111dd9b053352d752546ef7fa

See more details on using hashes here.

File details

Details for the file tfc-1.2.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: tfc-1.2.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 142.0 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for tfc-1.2.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 a3d9db3d3d024ed727a0002103ee855d874466e7734b0d91a6b4d18b4922697e
MD5 1bdc0eb9248b338dc18f78e5113c5e9c
BLAKE2b-256 24a725935f06ca955ab8a8bd9ddeda9a27b1a26b01fc1874abe702169ea7cf5b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tfc-1.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b58a38fc6b1d174ca3862af7bcdbe162ac61d80cf220087806c964b6e0d53cd7
MD5 91566b7256cd04bbb61fc5d9efa0c5fc
BLAKE2b-256 d16e30a0ec2a4ae1f8dd7f0451f5ad6a5d439f6dd23b8cdb0c3cb3df4c95c1e8

See more details on using hashes here.

File details

Details for the file tfc-1.2.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

  • Download URL: tfc-1.2.0-cp310-cp310-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 147.7 kB
  • Tags: CPython 3.10, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for tfc-1.2.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ca668374973c50080bb189745e81bcadb9591da8da074ef996e827eb7e5f5220
MD5 b5de9d88deefc459cead960e727621f5
BLAKE2b-256 af4ae0906c2e505b9fe01cac3a070f21589fe520bc3f9b24fac281d2acedc1cd

See more details on using hashes here.

Supported by

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