Giter Club home page Giter Club logo

Comments (8)

Isaac-Somerville avatar Isaac-Somerville commented on June 12, 2024

The solution bundle method is used in this file - https://github.com/Isaac-Somerville/Neural-Networks-for-Solving-Differential-Equations/blob/main/ThreeBodyProblem/threeBodyOriginalMethod.py ?

Yes. The other files in the ThreeBodyProblem folder use this method as well, but also include curriculum learning

from neural-networks-for-solving-differential-equations.

tanmay2798 avatar tanmay2798 commented on June 12, 2024

Okay, also can you tell me if I use spring mass system where there are double derivatives, according to your naming system, would it be like.
x = trialSolution(x0, xOut, t)
dxTrial = dTrialSolution(xOut, dxOut, t)
d2xTrial = dTrialSolution(***, d2xOut, t)
What should be in place of ***?

should it be the value I get if I pass xOut through the network?

from neural-networks-for-solving-differential-equations.

Isaac-Somerville avatar Isaac-Somerville commented on June 12, 2024

For second derivatives, you would require another function, d2TrialSolution, that uses the analytic expression for the second derivative of trialSolution. It would look something like this:

def d2TrialSolution(varOut, dVarOut, d2VarOut, t):
"""
Second derivative w.r.t. t of trial solution for a given variable varOut at times t with initial values varInitial

Arguments:
varOut (tensor of shape (batchSize,1)) -- network output for variable at times t
dVarOut (tensor of shape (batchSize,1)) -- derivative of network output for variable w.r.t. t at times t
d2VarOut (tensor of shape (batchSize,1)) -- second derivative of network output for variable w.r.t. t at times t
t (tensor of shape (batchSize,1)) -- times at which variable is evaluated

Returns:
d2trialSoln (tensor of shape (batchSize,1)) -- second derivative of trial solution for given variable at 
    times t with initial values varInitial"""
# d2TrialSoln = (torch.exp(-t)) * dVarOut  + ((1 - torch.exp(-t)) * d2VarOut) - torch.exp(-t) * varOut + torch.exp(-t) * dVarOut
d2TrialSoln = ((1 - torch.exp(-t)) * d2VarOut) + (torch.exp(-t) * (2 * d2VarOut  - varOut))
return d2TrialSoln

In the train function you would be required to evaluate d2xOut in the same was dxOut was calculated:
d2xOut = grad(dxOut,t,torch.ones_like(dxOut),retain_graph=True, create_graph=True)[0]

Problems 5, 7 and 8 have more examples of doing this for second derivatives, as well as calculating mixed partial derivatives using autograd.

Hope this helps!

from neural-networks-for-solving-differential-equations.

tanmay2798 avatar tanmay2798 commented on June 12, 2024

@Isaac-Somerville
https://github.com/Isaac-Somerville/Neural-Networks-for-Solving-Differential-Equations/blob/main/LagarisProblems/prob5.py

Is this and prob7 and prob8 in LagarisProblems folder are using solution bundle?

from neural-networks-for-solving-differential-equations.

Isaac-Somerville avatar Isaac-Somerville commented on June 12, 2024

from neural-networks-for-solving-differential-equations.

tanmay2798 avatar tanmay2798 commented on June 12, 2024

Okay, and should it be d2TrialSoln = ((1 - torch.exp(-t)) * d2VarOut) + (torch.exp(-t) * (2 * dVarOut - varOut))

from neural-networks-for-solving-differential-equations.

Isaac-Somerville avatar Isaac-Somerville commented on June 12, 2024

Yes that's right

from neural-networks-for-solving-differential-equations.

tanmay2798 avatar tanmay2798 commented on June 12, 2024

@Isaac-Somerville
adam.txt
I modified your code to work for spring mass dampener system (md2x/dt2 + bdx/dt + k(x-L)=0). But, for me it doesn't give promising results. Can you suggest what changes I need to make?

from neural-networks-for-solving-differential-equations.

Related Issues (1)

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.