Skip to content

Instantly share code, notes, and snippets.

@aherve
Created November 23, 2016 15:08
Show Gist options
  • Select an option

  • Save aherve/2a2a879d1b7645dc779a567936940433 to your computer and use it in GitHub Desktop.

Select an option

Save aherve/2a2a879d1b7645dc779a567936940433 to your computer and use it in GitHub Desktop.
minus = -> f,g { -> x { f.(x) - g.(x) } } # f - g
div = -> f,g { -> x { f.(x) / g.(x) } } # f / g
mult = -> f,g { -> x { f.(x) * g.(x) } } # f * g
norm = -> f { -> x { f.(x).abs}} # absolute value
const = -> const { -> x { const} } # That's right, the constant function !
# You should recognize these:
plus_eps = -> eps { -> f { -> x { f.(x+eps) } } }
min_eps = -> eps { -> f { -> x { f.(x-eps) } } }
# is f < g ?
inf = -> f,g { -> x { f.(x) < g.(x) } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment