PINN Loss Function Generation with Symbolic Math

Version 1.0.0 (1.58 MB) by Mae
Generate Deep Learning Toolbox code for use in a physics-informed neural network (PINN) directly from a symbolically defined PDE or ODE.
226 Downloads
Updated 29 Aug 2024

View License

PINN Loss Function Generation with Symbolic Math
Physics-Informed Neural Networks (PINNs) can approximate solutions to ordinary differential equations (ODEs) and partial differential equations (PDEs) by embedding the differential equations into the loss function of the network to guide the learning process. In this way, PINNs can provide more physically consistent predictions than purely data-driven methods. Further, they provide meshfree alternatives to traditional numerical methods.
Central to the PINN loss function is the physics-informed loss term, which evaluates the residual of the differential equation at interior collocation points in the domain. The derivatives are usually computed via automatic differentiation (AD).
This repository provides helper functions which automatically generate the physics-informed loss term from symbollically defined ODEs and PDEs. This physics-informed term can then be used to train PINNs to approximate solutions to PDEs and ODEs.
Setup
Ensure that the files pde2PINNLossFunction.m and ode2PINNLossFunction.m are on your path.
MathWorks Products (https://www.mathworks.com)
Requires MATLAB® R2024a or newer
Getting Started
  • Check out the examples in Start_here.mlx to learn how to define differential equations symbolically and how to use the repository functions to generate the physics-informed loss functions from these symbolic equations.
  • For examples which walk through the entire PINN workflow, see Burgers_PDE.mlx, Poisson_PDE.mlx, and RLC_ODE.mlx.
  • For an advanced workflow which may offer improved performance through less network forward passes, see NoForward_example.m.
Workflow Examples
License
The license is available in the License.txt file in this repository.
Community Support
Copyright 2024 The MathWorks, Inc.

Cite As

Mae (2025). PINN Loss Function Generation with Symbolic Math (https://www.mathworks.com/matlabcentral/fileexchange/172049-pinn-loss-function-generation-with-symbolic-math), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2024a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

pinn-loss-generation-with-symbolic-math-main

pinn-loss-generation-with-symbolic-math-main

Version Published Release Notes
1.0.0