Class | Dobjects::Function |
In: |
ext/Dobjects/Dvector/dvector.c
lib/Dobjects/Function_extras.rb |
Parent: | Object |
Function is a class that embeds two Dvectors, one for X data and one for Y data. It provides
And getting bigger (almost) everyday…
Computes spline data and caches it inside the object. Both X and Y vectors are cleared (see Dvector#clear) to make sure the cache is kept up-to-date. If the function is not sorted, sorts it.
Computes the derivative of the Function and returns it as a new Function. The newly created function shares the X vector with the previous one.
WARNING: this is a very naive 3-points algorithm; you should consider using diff_5p
Computes a 4th order accurate second derivative of the Function.
This function requires that there are at the very least 5 data points!
Computes a 4th order accurate derivative of the Function.
This function requires that there are at the very least 5 data points !
Fuzzy substraction of two curves. Substracts the Y values of op to the current Function, by making sure that the Y value substracted to a given point corresponds to the closest X_ value of the point in op. This function somehow assumes that the data is reasonably organised, and will never go backwards to find a matching X value in op.
In any case, you really should consider using split_monotonic on it first.
: Returns the value of the integral of the function between the two indexes given, or over the whole function if no indexes are specified.
Computes interpolated values of the data contained in f and returns a Function object holding both x_values and the computed Y values. x_values will be sorted if necessary.
With the second form, specify only the number of points, and the function will construct the appropriate vector with equally spaced points within the function range.
Returns an interpolant that can be fed to Special_Paths#append_interpolant_to_path to make nice splines.
Can be used this way:
f = Function.new(x,y) t.append_interpolant_to_path(f.make_interpolant) t.stroke
Reverses the function. Equivalent to doing x.reverse! y.reverse!
excepted that it is faster (though not much faster).
Attempts to pick a smooth value for a point, according to the algorithm implented for "smooth" markers in Soas. See DOI: 10.1016/j.bioelechem.2009.02.010
Warning: be wary of this function as it will return a correct value only for rather noisy data !
Filters the Function through interpolation. params holds a hash with the following values:
??
It returns a hash.
Splits the function into strictly monotonic sub-functions. Returns the array of the subfunctions. The returned values are necessarily new values.