Elvet is a machine learning-based differential equation and variational problem solver.
- It can solve any system of coupled ODEs or PDEs with any boundary conditions.
- It can go beyond differential equations, and solve variational problems that consist of the minimization of a given functional, without computing the corresponding Euler-Lagrange equations.
- It can also be used for fitting any family of functions (which are viewed as a machine learning model) to a set of multi-dimensional data points.
By default, Elvet uses neural networks to solve these problems.
Quick start
Try Elvet online in Google Colaboratory through the example notebooks.
Install Elvet by running pip install elvet. Tensorflow is required.
The following code solves the logistic differential equation:
import elvet
def equation(x, f, df_dx):
return df_dx - f * (1 - f)
bc = elvet.BC(0, lambda x, f, df_dx: f - 1/2)
domain = elvet.box((-5, 5, 101))
result = elvet.solver(equation, bc, domain, epochs=5e3)
Where have defined the equation, in the form equation(x, f, df_dx) == 0, the "boundary" condition f(0) - 1/2 == 0, and the domain: the interval (or "box" in elvet's terms) [-5, 5], with 101 equally spaced points. Then we use the solver function to generate a solver, which contains a machine learning model. This model is, by default, a fully connected neural net with one hidden layer with 10 units and 1 unit in the input and output layers. The epochs argument specifies over how many epochs this model is to be trained.
The predictions of the trained model, which give the solution to the differential equations, can be obtained through result.prediction(). They can also be plotted, and compared with the analytic solution, which is just the sigmoid function
import elvet.plotting
def analytic_solution(x):
return 1 / (1 + elvet.math.exp(-x))
elvet.plotting.plot_prediction(result, true_function=analytic_solution)
This code should produce the plot
Documentation
The documentation contains a detailed specification of Elvet's API.
Citation
If you use elvet, please cite arXiv:2103.14575
Bibtex:
@misc{araz2021elvet,
title={Elvet -- a neural network-based differential equation and variational problem solver},
author={Jack Y. Araz and Juan Carlos Criado and Michael Spannwosky},
year={2021},
eprint={2103.14575},
archivePrefix={arXiv},
primaryClass={cs.LG}
}
Metadata
Release files for elvet 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| elvet-1.0.2.tar.gz | 33.5 kB | Without provenance | Details for elvet-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| elvet-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for elvet-1.0.2-py3-none-any.whl |
Total release size: 70.0 kB
Release files / elvet-1.0.2.tar.gz
| Download URL | elvet-1.0.2.tar.gz |
|---|---|
| Size | 33.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
09bc94e30906d9a34de04be3f003da30ae83d3dae16da2dc6bc4355f4e6bd163
|
|
BLAKE2b-256 checksum How to use checksums |
0e600873bc4be0233393b1d8317fb36baada419f14e1d06bcc6519f2c12e7a46
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.10
|
Release files / elvet-1.0.2-py3-none-any.whl
| Download URL | elvet-1.0.2-py3-none-any.whl |
|---|---|
| Size | 36.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
40ed77cd4924af79bffb961af775a8fa8b9f0a5934ba3db166b6ef04b2ebe45c
|
|
BLAKE2b-256 checksum How to use checksums |
410c5aff7fda55b407be88554c4bb58650fc136d4cd786c24f619dd50f8686c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.10
|
Security for elvet 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.