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. 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.3.2},
    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:
    • cmake
    • ninja
    • graphviz
  • Python Packages:
    • colorama
    • graphviz
    • jax
    • jaxlib
    • matplotlib
    • numpy
    • pybind11
    • setuptools
    • 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.3.2.tar.gz (64.4 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.3.2-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (256.7 kB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

tfc-1.3.2-cp314-cp314t-macosx_11_0_arm64.whl (209.3 kB view details)

Uploaded CPython 3.14tmacOS 11.0+ ARM64

tfc-1.3.2-cp314-cp314-win_amd64.whl (588.9 kB view details)

Uploaded CPython 3.14Windows x86-64

tfc-1.3.2-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (256.3 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

tfc-1.3.2-cp314-cp314-macosx_11_0_arm64.whl (201.9 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

tfc-1.3.2-cp313-cp313-win_amd64.whl (571.1 kB view details)

Uploaded CPython 3.13Windows x86-64

tfc-1.3.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (256.3 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

tfc-1.3.2-cp313-cp313-macosx_11_0_arm64.whl (201.6 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

tfc-1.3.2-cp312-cp312-win_amd64.whl (571.2 kB view details)

Uploaded CPython 3.12Windows x86-64

tfc-1.3.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (256.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

tfc-1.3.2-cp312-cp312-macosx_11_0_arm64.whl (201.5 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

tfc-1.3.2-cp311-cp311-win_amd64.whl (571.0 kB view details)

Uploaded CPython 3.11Windows x86-64

tfc-1.3.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (253.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

tfc-1.3.2-cp311-cp311-macosx_11_0_arm64.whl (200.5 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for tfc-1.3.2.tar.gz
Algorithm Hash digest
SHA256 9d15558186b657d215ae0de4f10384a0368145ec418d2f6d768a9f9959782e87
MD5 b4ce5ed6de198c82e5d5224a8b8d3d71
BLAKE2b-256 76c320f5494c87a0840a44fde9c183bba944cc07507ec3eafc2178775195f703

See more details on using hashes here.

File details

Details for the file tfc-1.3.2-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for tfc-1.3.2-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fff253554decab5bb05b8f56629fa50720e0ad159c9a9cc742b34fde3cc4f1ee
MD5 7fcdcb8118a068d6360766b672440fad
BLAKE2b-256 fd9325762a1aee4970ad2d75eb9dca9f9019a8fec1d9ed682cd86f116d80c5a7

See more details on using hashes here.

File details

Details for the file tfc-1.3.2-cp314-cp314t-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for tfc-1.3.2-cp314-cp314t-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 165d2200732803b3df8e8eaa5948133ada4a5a44e40800cdebd3726359c17f15
MD5 d778ddb173f99cfb5d7e93c751d5d36b
BLAKE2b-256 c2f2316cb15f438473de31ebad53085c30c6d72db60b92469361e9a8fa095089

See more details on using hashes here.

File details

Details for the file tfc-1.3.2-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: tfc-1.3.2-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 588.9 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tfc-1.3.2-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 a66c78e8bd791559f25378d5511585dad2b8ad090d505254bbdb78d3cb5de15d
MD5 33f5057809137eeb388a85bb0f701abc
BLAKE2b-256 209eae059bbc4ea45a6cdb6f5db2d68fba30e3c0a9d4df8e5422ee68ff098f3d

See more details on using hashes here.

File details

Details for the file tfc-1.3.2-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for tfc-1.3.2-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2c065b5d6ca71d4a2ad63edfdc7bc6445b268ec18b205b56cffda01d6bbdf2ff
MD5 246b02c5422847df6d869100f5c031af
BLAKE2b-256 0ed5af412176acdbe01c393427450138f42ed772b76e6be3debf09b85b5e4bf5

See more details on using hashes here.

File details

Details for the file tfc-1.3.2-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

  • Download URL: tfc-1.3.2-cp314-cp314-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 201.9 kB
  • Tags: CPython 3.14, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tfc-1.3.2-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 53e45187cec234ffccb00527258e567ca4ab11f3f9b63cc8ec28cb1d8534deeb
MD5 a898ddff241b5d5f6b1f6fd7da36518b
BLAKE2b-256 ae78ff1fd89b07009af9965211f08b49442f599dfa1699aa1cda37da1ee4c1c7

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for tfc-1.3.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 9fad1b6abaa8bbf1a99b78f6ce7562f149d01f4fe19e896121696f4a2d820c7d
MD5 034bb5c0cad1ebb6e40c872c74401bb7
BLAKE2b-256 22980d12ac2ff3b751db93ce7307dc622e36b838237a2790968d327a867b9673

See more details on using hashes here.

File details

Details for the file tfc-1.3.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for tfc-1.3.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9427d0c42abf8c2b544e53cf4310297a95b3d7ae13f7f76ab115db8d26a76321
MD5 073112264d8ffd97540ad4995a7ddb28
BLAKE2b-256 bafbacddf64429a42cd93760c51200b36a2c1c18ce12ef39313e238a45443528

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for tfc-1.3.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 047378c5926a5ac91563f0cbe72b6639d82016a444ceb2c2f571ac2345085ca5
MD5 5faaa43e6d9bf9e4b99c494c9e03f716
BLAKE2b-256 b49effa90483aaddb885029f39f669782b65e2627fa3ae36482f5e30f55192f5

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for tfc-1.3.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 9bb941f7d5c8e2a9b188cee7c9f1c2344f194b68bc23e055c5baefc9c10e9ae8
MD5 f7607a69571bcf4da4ceefc01a9ae6d7
BLAKE2b-256 d80cd3697c34cb4c77166680cbd2f235927df3b4ab61a77bf22dd09f4b466ca4

See more details on using hashes here.

File details

Details for the file tfc-1.3.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for tfc-1.3.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 29ad9863b7a6b100ef356b5c8975431c31d300d98417c3671d4f2ca411ab736b
MD5 7958e9a2877c9a7d7147b76517338105
BLAKE2b-256 3dabe5a1928f567e239d0de9ba1a28bef0c7b22ad690f021cdae90ce64ee7132

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for tfc-1.3.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4d36c1cc5a9fef46e7fbe679d1c4e512f19c91ad0fb49f824741d3a4bb188a97
MD5 d9394d0817878efe59365f85544b777c
BLAKE2b-256 f49a2e980d5181a7ed7e73a45cefeecfb509d58ea9a9d2608c21a71916adcc80

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for tfc-1.3.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 844d166e8a91f0844291bc92f8a1ea7c15985b3c34e02d9b5a3b30fc01964bfc
MD5 b47e883bb819c6a6260c786bc7c32beb
BLAKE2b-256 9a98296f9cad6d402966a36238c8c24061b1e0624bda97945ea1b492295ec4ea

See more details on using hashes here.

File details

Details for the file tfc-1.3.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for tfc-1.3.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 aad29b34197811583fb60fab0a1320d6773561c6030b4075832ae9ab58783992
MD5 578c4fa84105c4b340953729ffe1721c
BLAKE2b-256 9dd53358357bf9b5496080dd9defbe776f80f6c306183f9f1d4721acf07595e0

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for tfc-1.3.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8444395d428d5d58573f85917d6b4f47c2400d3721f328eae051258443d24cea
MD5 5c313389e446e657341b8c28da9c9aa4
BLAKE2b-256 aaa97f5a8040a43300d4bdfbb2fed19c19a75466daafb38446fb215a7516ae12

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