funcurve

funcurve(f::Function, lims, n=100)::Tuple{Vector{Float64}, Vector{Float64}}

Evaluate a function over a range and return the computed points.

Arguments

  • f::Function: The one dimensional function to be evaluated. This can be the named of a built-in function (e.g., exp), a custom or an anonymous function.
  • lims: The limits defining the range over which to evaluate the function. That is, the limits of x in y = f(x). This can be a tuple or a vector with two elements.
  • n::Int: Number of points to evaluate (default: 100)

Returns

  • Tuple{Vector{Float64}, Vector{Float64}}: A tuple containing two vectors of Float64 values representing the x-coordinates and corresponding function values

Example

x, y = funcurve(exp, [0, 10])

Another example with a custom function (an anonymous function in this case):

x, y = funcurve(x->x^2, (0, 10))

Visualize the result with:

viz(x,y)

Source Code

This function has multiple methods:

See Also