Exemplo n.º 1
0
def create_training_data(nt):
    x_train = np.array(create_training_grid(nt))
    return x_train
Exemplo n.º 2
0
"""Demo to show how to solve 1st order PDE IVP with nnde."""

import numpy as np

from nnde.differentialequation.pde.pde1ivp import PDE1IVP
from nnde.math.trainingdata import create_training_grid
from nnde.neuralnetwork.nnpde1ivp import NNPDE1IVP

if __name__ == '__main__':

    # Create training data.
    nx = 5
    ny = 5
    xy_train = np.array(create_training_grid([nx, ny]))
    print('The training points are:\n', xy_train)
    N = nx * ny
    assert len(xy_train) == N
    print('A total of %d training points were created.' % N)

    # Options for training
    training_opts = {}
    training_opts['debug'] = True
    training_opts['verbose'] = True
    training_opts['eta'] = 0.01
    training_opts['maxepochs'] = 1000
    H = 5

    # Test each training algorithm on each equation.
    for eq in ('nnde.differentialequation.examples.example_pde1ivp_01', ):
        print('Examining %s.' % eq)
        pde1ivp = PDE1IVP(eq)
Exemplo n.º 3
0
import sys

import numpy as np

from nnde.differentialequation.pde.pde2diff import PDE2DIFF
from nnde.math.trainingdata import create_training_grid
from nnde.neuralnetwork.nnpde2diff import NNPDE2DIFF

if __name__ == "__main__":

    # Create training data.
    nx = 5
    ny = 5
    nz = 5
    nt = 5
    xt_train = np.array(create_training_grid([nx, nt]))
    xyt_train = np.array(create_training_grid([nx, ny, nt]))
    xyzt_train = np.array(create_training_grid([nx, ny, nz, nt]))

    # Options for training
    training_opts = {}
    training_opts["debug"] = False
    training_opts["verbose"] = True
    training_opts["eta"] = 0.1
    training_opts["maxepochs"] = 1000
    training_opts["use_jacobian"] = False
    H = 5

    # Test each training algorithm on each equation.
    for pde in ("nnde.differentialequation.examples.diff1d_halfsine", ):
        print("Examining %s." % pde)
Exemplo n.º 4
0
"""Demonstration of use of nnde to solve ODE IVP"""

import numpy as np

from nnde.differentialequation.ode.ode1ivp import ODE1IVP
from nnde.math.trainingdata import create_training_grid
from nnde.neuralnetwork.nnode1ivp import NNODE1IVP

if __name__ == '__main__':

    # Create training data.
    nx = 11
    x_train = np.array(create_training_grid(nx))
    print('The training points are:\n', x_train)

    # Options for training
    training_opts = {}
    training_opts['debug'] = True
    training_opts['verbose'] = True
    training_opts['maxepochs'] = 1000

    # Test each training algorithm on each equation.
    for eq in (
            'nnde.differentialequation.examples.lagaris_01',
            'nnde.differentialequation.examples.lagaris_02',
    ):
        print('Examining %s.' % eq)
        ode1ivp = ODE1IVP(eq)
        print(ode1ivp)

        # (Optional) analytical solution and derivative