IC#

class pinnx.icbc.IC(func, on_initial=<function IC.<lambda>>)[source]#

Initial conditions: y([x, t0]) = func([x, t0]).

Parameters:
  • func (Union[Callable[[Dict, ...], Dict], Callable[[Dict], Dict]]) –

    Function that returns the initial conditions. This function should take a dictionary of collocation points and return a dictionary of initial conditions. For example:

    import brainunit as u
    def func(x):
        return {'y': -u.math.sin(np.pi * x['x'] / u.meter) * u.meter / u.second}
    

  • on_initial (Callable[[Dict, array], array]) –

    Filter function for initial conditions. This function should take a dictionary of collocation points and return a boolean array indicating whether the points are initial conditions. For example:

    def on_initial(x, on):
        return on
    

collocation_points(X)[source]#

Return the collocation points for initial conditions.

Parameters:

X – Collocation points.

Returns:

Collocation points for initial conditions.

error(inputs, outputs, **kwargs)[source]#

Error for initial conditions.

Compare the initial conditions with the outputs.

Parameters:
  • inputs – Collocation points.

  • outputs – Collocation values.

Return type:

Dict[str, Union[Array, ndarray, bool, number, bool, int, float, complex, Quantity]]

Returns:

Error for initial conditions.

filter(X)[source]#

Filter the collocation points for initial conditions.

Parameters:

X – Collocation points.

Returns:

Filtered collocation points.