Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Including derivatives of non-linear terms in PDELibrary #170

Closed
BMP-TUD opened this issue Apr 22, 2022 · 3 comments
Closed

Including derivatives of non-linear terms in PDELibrary #170

BMP-TUD opened this issue Apr 22, 2022 · 3 comments

Comments

@BMP-TUD
Copy link

BMP-TUD commented Apr 22, 2022

Hi all,

I would like to include a non-linear term in the PDELibrary that means I want to use e.g. u³ in the form of (u³)_1111. There was already a feature request from November last year by @znicolaou for this and an other feature ([https:/github.com//issues/134]) . It seemed like you have fixed that so it can be included, but I am bit stuck and do not know how exactly it can be done. Would you mind giving a brief example on that?

Thank you in advance for your help,
Best wishes,
Bartosz

@akaptano
Copy link
Collaborator

akaptano commented Apr 22, 2022

Hey there, @znicolaou can show you how this can be done if you want to keep it as you wrote. Note however that (u^3){1111} is just 3u^2 u{1111}, which can already be generated with the PDE or WeakPDE libraries in the code. Simply use "derivative_order = 4" and include candidate library terms up to quadratic polynomials. By default, the library will take all combinations of the derivative terms and the polynomial terms, generating a term like u^2 u_{1111}

@BMP-TUD
Copy link
Author

BMP-TUD commented Apr 22, 2022

Hey thanks for the quick response, you are absolutely right. Here, I am not sure if this actually holds for u(x,y) and if I want to include the squared laplace operator on the u³ : Laplace-Operator^2 (u^3). Thank you for your help,
Best,
Bartosz.

@znicolaou
Copy link
Collaborator

Sure thing! I will share a little example some time in the next week I think, but the gist is its a little complicated and experimental still. You will need to calculate the derivatives of your input data "by hand" with pysindy's FiniteDifference class, then apply whatever nonlinear transformation you want to it and reshape it correctly. You can then create a CustomLibrary with that feature and add it to a GeneralizedLibrary along with a PDELibrary.

One kind of nonlinearities that has to be handled this way is something like (u_x)^n*(u_xx)^m, except in special cases (for example, in the Kuramoto-Sivashinki equation, a clever change of variables converts (u_x)^2 to a term u*u_x). Anyway, would be good to add an example to a notebook. I also need to finish cleaning up the new WeakPDELibrary to merge with master, and include it in that push (incidentally, note that including general nonlinear derivative terms in the weak form is an open problem still...)

@akaptano akaptano closed this as completed Jun 5, 2022
jpcurbelo pushed a commit to jpcurbelo/pysindy_fork that referenced this issue May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants