NeuroDiffGym / neurodiffeq

A library for solving differential equations using neural networks based on PyTorch, used by multiple research groups around the world, including at Harvard IACS.
http://pypi.org/project/neurodiffeq/
MIT License
687 stars 90 forks source link

Parametric system of ODEs #201

Open FacuRoffet99 opened 1 year ago

FacuRoffet99 commented 1 year ago

I have a system with one input (t), two outputs (x and y) and two parameters (a and w):

def ode_system(x, y, t): 
    return [diff(x,t)-(a*x - w*y - x*(x**2 + y**2)), diff(y,t)-(a*y + w*x - y*(x**2 + y**2))]

Currently, I have to train a network every time I want to change the value of the parameters. Is there a way to parameterize the NN in such a way that it can predict the solution for multiple values of the parameters at the same time?

Thank you!

shuheng-liu commented 1 year ago

Hi @FacuRoffet99 , here's an example of how to solve what we call a bundle of solutions. Make sure you have the latest version of the library (v0.6.2 or higher)

https://colab.research.google.com/drive/1L9NGeLoDONWmCr_tZkjIJziF3yo1OJHE?usp=sharing