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.4.0},
    year = {2026},
}
@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.4.0.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.4.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (263.2 kB view details)

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

tfc-1.4.0-cp314-cp314t-macosx_11_0_arm64.whl (216.0 kB view details)

Uploaded CPython 3.14tmacOS 11.0+ ARM64

tfc-1.4.0-cp314-cp314-win_amd64.whl (598.5 kB view details)

Uploaded CPython 3.14Windows x86-64

tfc-1.4.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (262.0 kB view details)

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

tfc-1.4.0-cp314-cp314-macosx_11_0_arm64.whl (208.2 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

tfc-1.4.0-cp313-cp313-win_amd64.whl (580.2 kB view details)

Uploaded CPython 3.13Windows x86-64

tfc-1.4.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (261.7 kB view details)

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

tfc-1.4.0-cp313-cp313-macosx_11_0_arm64.whl (207.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

tfc-1.4.0-cp312-cp312-win_amd64.whl (580.1 kB view details)

Uploaded CPython 3.12Windows x86-64

tfc-1.4.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (261.8 kB view details)

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

tfc-1.4.0-cp312-cp312-macosx_11_0_arm64.whl (207.6 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

tfc-1.4.0-cp311-cp311-win_amd64.whl (575.3 kB view details)

Uploaded CPython 3.11Windows x86-64

tfc-1.4.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (260.2 kB view details)

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

tfc-1.4.0-cp311-cp311-macosx_11_0_arm64.whl (206.5 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for tfc-1.4.0.tar.gz
Algorithm Hash digest
SHA256 7089eefd966ef869d04e3970da4d39d65991ac082b95020b48b2df622d48f5ca
MD5 2e269cde60164b1fb1c8513eddba68ee
BLAKE2b-256 ca0763db95a907e9c6662c65af00cb0a85fdc075f39560e516215c286f1ad507

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tfc-1.4.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f5c034da334f1973d09e330ea61b274712657ba900ca30aca18cef5731386929
MD5 d1defa76b8d97c5571c7a943f4d639da
BLAKE2b-256 7033209101cccf082ccd0148240b7e7cba952574e99d02b3436667c510f4528f

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for tfc-1.4.0-cp314-cp314t-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 60645daef9ec4614f3af38e37da6f0995c27cddeb0488deb85b0bcce945ddfe7
MD5 d961a47ecce670eeefe84ea8016c093d
BLAKE2b-256 34faee09905c0861eb64759eadcf189ae9320bd0f42b2a84a5abd667bdd2cf20

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for tfc-1.4.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 60a9ac083295ccadd09d44591d8d9205fbe3ddb14e99dce55fa2425d70d658fb
MD5 b3ab46375e137adbaadbb7668e23bf84
BLAKE2b-256 b7e6a1548a4395c94365b71ec91a787ff44024a66d4a9ed60d2f03399cccb76e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tfc-1.4.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9d00f53f14d5250decee42e4b2ddfcbdbb2f6736c809f3da70d2c176ae254a89
MD5 65c372347d339f09a8682208d8b9c2e5
BLAKE2b-256 d0a96af8f7cdcd92f6f503aee38c0b88bbde7cc25b25e3d7ed79c888082d8a21

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for tfc-1.4.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3a622d3ca31e5a82ae8dc3ed9f0856b2ad68038f819ae0c65ca5e7e4fa1b7109
MD5 7c7bd1600521e162196b7d872db2d03a
BLAKE2b-256 0f2204b6435600c007599171a13ea42d04a4b4ccf23087acb39725a277111521

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for tfc-1.4.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 932d0848c63b71c19b6a6cba02312db015f60bd94a04e1f0067a88eea90840e0
MD5 af70ccb05f80db0ff2de260e91de4fcc
BLAKE2b-256 cb3261f0fd44e3ecc8fce85df95edd48995752b41d555afcc7e8ba45b33eac81

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tfc-1.4.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f3f640dd8f0ef1611535fe7f8c44ddb84776ef24e6d1f7b004b1d6ad8f28d6aa
MD5 23ee3e2a6df64dcb6ad6831493b2cf73
BLAKE2b-256 9b2c028be0e9495c42c1a793348cc07fb289a4e572ad677aa6eab667cfd30c4c

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for tfc-1.4.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fd96859fa0c858d70aa0529260054c4aebeed8ab0b897855e080db4522990c15
MD5 72393233ce44a1fc2014b2761385806e
BLAKE2b-256 7864fbd537c539c017d090e795584cf7e6f8a7a12b78eebd9f5795f441b8e7ad

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for tfc-1.4.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 99d697088fd2ee698718c44bd45dca10098877c2b55e06cadf0b0f3a375c9e91
MD5 cfacdf633e23503dfb43536444f938a9
BLAKE2b-256 f400481deb6f166b60a44b26647b04472370914d41546c15f5f6e852da0d8040

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tfc-1.4.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 18e09dc604a4cafab87a3f65d89d0b6ad027a32bb978ab281dc6910e4e844734
MD5 29122475e3063816c2de17537c2a9d90
BLAKE2b-256 916f3dd7cf127a410aeac3ab59de4e2144c7990657a74128837712c33930c6dd

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for tfc-1.4.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f7ca44feb46d0411b47982d539b73db3b9cb2f5b3a980138b279e3a910841af0
MD5 f29852b24aac571266b83f83eafed7d4
BLAKE2b-256 2f1c6c2ddc8b9df9fb058c7aca55558e1d03ded6bf4d9c1248834d7ea01274b7

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for tfc-1.4.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 270a0fcdf310fb69386c44dfd42ffc7a729d42055e47d47508abbb3a6493fe15
MD5 59124d718da35f7326ff959d68a1fb77
BLAKE2b-256 96acd4a2b03481bab7188dd5b81b7d99084b68c12788ec3fcf82194ea918c021

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tfc-1.4.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e9c862aad921d260dd9c3e85840cffdf9fc8d97941691f26a83d230b9eca7bbf
MD5 d939415569d346fab53f34953a1fa9a8
BLAKE2b-256 0ec73681cf4ab4bd1cbce5053bdf0ed948e8316d2d6bd83975da1adba305c444

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for tfc-1.4.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9c5823c2aaacc2c69033f58d76135b743c77202fdaa43b384b9934c9d485f397
MD5 7941a6409b2fd65723f8375c6820a387
BLAKE2b-256 bb5b2d77c3c2ccc88d185d61050da8af6250b2dc032f0e83517321273fbfac5d

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