GithubHelp home page GithubHelp logo

Comments (3)

gersonjferreira avatar gersonjferreira commented on June 11, 2024 1

The initial conditions are hidden in the first loss. You can reduce the number of points there to

x_data = x[0:2]
y_data = y[0:2]

and the code still works.

I wrote (with my student) a version of this code reducing the 2nd order ODE into two 1st order ODEs, then it gets clear where the initial conditions enter. In your code the data is simply the initial position and velocity at t=0.

Regarding loos2, indeed the 1e-4 factor is weird and I was also checking that. I use:

    physics = (dx2 + mu*dx + k*yhp) / k
    loss2 = torch.mean(physics**2)

Dividing physics by k helps because the loss1 and loss2 error are now written in the same units. The 1e-4 term seems to be an implicit workaround to fix the units.

I'll put my code on gitlab soon.

from harmonic-oscillator-pinn.

Sanchez-web avatar Sanchez-web commented on June 11, 2024 1

Thanks, your explanation was great!
Looking forward to your code!

from harmonic-oscillator-pinn.

gersonjferreira avatar gersonjferreira commented on June 11, 2024

Thanks. My version is nearly identical to the one here. The only differences are: (i) this normalization of the loss to fix the units/dimensions; (ii) a second version in terms of two 1st order ODEs (reduction of order); (iii) many comments on each step to make it as pedagogical as possible (since this is a project for students entering this research field).

My version is ready, but I want my student to develop her version on her own. So, I'll only upload to gitlab once she finishes her version. It may take a while (couple of weeks maybe), she is still at the beginning of the project.

from harmonic-oscillator-pinn.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.