phys_581.assignment_4

phys_581.assignment_4#

Assignment 4: Chaos

Functions#

compute_lyapunov(compute_dy_dt, y0[, dy0, t0, dt, ...])

Return a list of uncorrelated values lams estimating the maximal Lyapunov

Module Contents#

compute_lyapunov(compute_dy_dt, y0, dy0=None, t0=0, dt=None, min_norm=None, Nsamples=None, norm=np.linalg.norm, rng=_DEFAULT_RNG, debug=False, solve_ivp_args=None)#

Return a list of uncorrelated values lams estimating the maximal Lyapunov exponent for the ODE.

The arguments here follow the conventions required by solve_ivp, but the actual solver used is up to implementer.

Parameters:
  • compute_dy_dt (function) – Return dy_dt = compute_dy_dt(t, y).

  • y0 (array-like) – Initial state.

  • dy0 (array-like, None) – Initial direction to store. If None, then this is chosen randomly.

  • t0 (float) – Initial time.

  • dt (float, None) – Evolve for this length of time when computing the exponent. If None, then a reasonable value should be estimated by the code. (The code may adaptively update dt.)

  • min_norm (float, None) – Minimum norm. Start with states separated by min_norm, then evolve by dt, extract the exponent, add this to the samples, then pull the state back along the same direction to have length min_norm and repeat. If None, then reasonable values should be estimated by the code.

  • Nsamples (int) – Number of samples to use when estimating the Lyapunov exponent. The estimate should be the mean of this many samples with an error as the standard deviation.

  • norm (function) – Use this function to compute the norm of the difference between states. (Default is np.linalg.norm.)

  • rng (random number generator) – Random number generator such as returned by np.random.default_rng(), which is used by default if one is not provided.

  • debug (bool) – If True, then return (lams, ts, ys, dys) with the sample evolution.

  • solve_ivp_args (dict, None) – Additional arguments for solve_ivp.

Returns:

  • lams (array of floats) – Array of maximal Lyapunov exponents such that the mean and standard deviations give a good estimate. These should be uncorrelated.

  • ts, ys, dys (array) – Only provided if debug is True. Times, states, and separations used in sampling.