Skip to main content

A neural network-based differential equation and variational problem solver

Project description

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}
}

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

elvet-1.0.2.tar.gz (33.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

elvet-1.0.2-py3-none-any.whl (36.6 kB view details)

Uploaded Python 3

File details

Details for the file elvet-1.0.2.tar.gz.

File metadata

  • Download URL: elvet-1.0.2.tar.gz
  • Upload date:
  • Size: 33.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.10

File hashes

Hashes for elvet-1.0.2.tar.gz
Algorithm Hash digest
SHA256 09bc94e30906d9a34de04be3f003da30ae83d3dae16da2dc6bc4355f4e6bd163
MD5 dba34f60a10b109c35f69527283e39d9
BLAKE2b-256 0e600873bc4be0233393b1d8317fb36baada419f14e1d06bcc6519f2c12e7a46

See more details on using hashes here.

File details

Details for the file elvet-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: elvet-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 36.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.10

File hashes

Hashes for elvet-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 40ed77cd4924af79bffb961af775a8fa8b9f0a5934ba3db166b6ef04b2ebe45c
MD5 23c5562285606a065af24dcdf3abaccc
BLAKE2b-256 410c5aff7fda55b407be88554c4bb58650fc136d4cd786c24f619dd50f8686c8

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