API documentation

NeuralFieldEq.probNFEFunction
probNFE(input)

Set the NFE problem by discretising the domain, initialising sv and k_delay and building the delay rings structure.

Receive as input the parameters and functions wrapped in structures Input1D and Input2D. According to the space dimension the inputs are wrapped in the corresponding structure. The arguments of Input1D and Input2D are:

Arguments

  • α :: AbstractFloat
  • v :: AbstractFloat
  • V0 :: fV0: Can be a number or a function
  • L :: Number
  • N :: Integer
  • T :: AbstractFloat
  • n :: Integer
  • I :: fI: External input function
  • K :: fK: Connectivity function
  • S :: fS: Firing rate function

Return a structure to be used in solveNFE and prints useful information about the problem.

Examples

julia> # 2D example
julia> I(x,y,t) = 0                      # External inut
julia> # In 2D even if I doesn't depend on x,y and t, these three arguments are mandatory
julia> K(x,y)   = exp(-x^2+y^2)          # Connectivity function
julia> S(V)     = convert(Float64,V>0.0) # Firing rate. Heavyside function H(V)

julia> α  = 1.0   # Constant decay      (must be float)
julia> v  = 20.0  # Finite axonal speed (must be float)
julia> V0 = 0.0   # Initial condition (can be a constant or a function)
julia> L  = 100   # Domain length     (can be a integer or float)
julia> N  = 512   # Number of nodes to discretise space (must be integer)
julia> T  = 20.0  # Time span (must be float)
julia> n  = 200   # Number of nodes to discretise time  (must be integer)

julia> input = Input2D(α,v,V0,L,N,T,n,I,K,S);
julia> prob  = probNFE(input)
├─ Domain:       Ω × [0,T] = [-50.0,49.8046875]^2 × [0,20.0]
├─ Spatial step: dx   = 0.1953125
├─ Time step:    dt   = 0.1
├─ Velocity:     v    = 20.0
├─ Delay rings:  umax = 36

For the 1D scenario the procedure is the same, with exception that the functions I and K must be declared as I(x,t) and K(x) using Input1D.

NeuralFieldEq.solveNFEFunction
solveNFE(problem,saveat)

Arguments:

  • problem :: ProbOutput1D: Output of probNFE with Input1D
  • problem :: ProbOutput2D: Output of probNFE with Input2D
  • saveat :: AbstractVector: Vector containing the instants where the solution is saved at

Return a structure containing the solution to the NFE problem saved at saveat instants. Also return x,y,t and saveat to help plotting solutions.

The output structure is defined with methods that return the solution at saveat instant j.

Examples

julia> sol = solveNFE(prob1D,[5.0,20.0]) # Deterministic solution saved at t=5 and t=20
julia> sol(2)    # Solution at time instant t=20
julia> sol(20.0) # Same result from above
julia> using Plots
julia> plot(sol.x,sol(20.0),title="Solution at t=20")

If the problem is in 1D the solution will be a vector, if it is in 2D will be a matrix.


solveNFE(problem,saveat,ϵ,np,ξ=0.1)

Solve stochastic version of an NFE for np trajectories, noise level ϵ and correlation ξ.

Arguments:

  • problem :: ProbOutput1D: Output of probNFE with Input1D
  • problem :: ProbOutput2D: Output of probNFE with Input2D
  • saveat :: AbstractVector: Vector containing the instants where the solution is saved at
  • ϵ :: Number: Level of additive noise
  • np :: Integer: Number of simulations
  • ξ :: AbstractFloat=0.1: Spatial correlation parameter

Return a structure containing the mean solution and the trajectories to the NFE problem saved at saveat instants. Also return x,y,t and saveat to help plotting solutions.

The output structure is defined with methods that return the path at saveat instant j at trajectory p and the mean solution at instant j.

Examples

julia> sol_sto = solveNFE(prob,[5.0,20.0],0.01,100)
julia> # Stochastic solution saved at t=5,20, with noise level 0.01 simulated 100 times.
julia> sol_sto(2,4)    # Fourth path at time instant t=20
julia> sol_sto(20.0,4) # Same result from above
julia> sol_sto(1)   # Mean solution at time instant t=20
julia> sol_sto(5.0) # Same result from above

If the problem is in 1D the solution will be a vector, if it is in 2D will be a matrix.