Function

References
public abstract class Function : IStorable

Base level class for mathematical functions in the form y = f(x), representing a mapping from individual 64-bit double precision values onto individual 64-bit double precision values.

Do not inherit from this class if you wish to create a new function unless you need an absolutely minimal implementation to start with. Consider instead deriving from FunctionWithCaching.

Constructors

Function

#
Protected constructor.
protected Function()

Function

#
protected Function(
reader
)

Fields

Dot

#
The multiplication central dot operator.
protected const string Dot = "·"

Prime

#
The derivative prime symbol.
protected const string Prime = "ʹ"

Square

#
The square (power of two) symbol.
protected const string Square = "²"

X

#
The standard variable name.
protected const string X = "x"

Properties

Derivative

#
Gets a function which is the derivative of this function. The returned function may be either analytic or approximate.
public abstract Function Derivative { get; }

Integral

#
Gets a function which is the indefinite integral of this function. The returned function may be analytic or approximate. Note that numeric approximation of indefinite integrals is a slow and not particularly high quality process.
public abstract Function Integral { get; }

Nomen

#
Gets a description of this function.
public abstract Nomen Nomen { get; }

Notation

#
Gets the notation for this function. Notation is aimed at humans and does not need to return a parseable string.
public abstract string Notation { get; }

Ui

#
Gets a UI object for modifying this function. This property may return null, not all functions must be editable.
public virtual FunctionUi Ui { get; }

Methods

Asymptotes

#
Returns an array of *all* the non-vertical asymptotes for this function. This property may return both null and empty arrays, implying no asymptotes. Due to the nature of non-vertical asymptotes, there can only be a finite amount of them.
public virtual Line[] Asymptotes()

AutoCoDomain

#
Compute the automatic codomain for a given domain.
protected void AutoCoDomain(
x0,
Domain start.
x1,
Domain end.
out double
y0,
Lowest value in codomain.
out double
y1,
Highest value in codomain.
samples = 100
Samples.
)

AutoMaxDomain

#
Compute the automatic maximum domain based on a set of limits.
public static double AutoMaxDomain(
params double[]
upperLimits
)

AutoMinDomain

#
Compute the automatic minimum domain based on a set of limits.
public static double AutoMinDomain(
params double[]
lowerLimits
)

DomainEstimate

#
Return an estimate of the interesting part of a function. Each function may choose how to answer this question individually.
public virtual void DomainEstimate(
out double
x0,
Lowest x coordinate of interest.
out double
x1,
Highest x coordinate of interest.
out double
y0,
Lowest y coordinate of interest.
out double
y1
Highest y coordinate of interest.
)

Holes

#
Returns a collection of domains for which this function is not defined. This method may return null or an empty array, implying no undefined domains. This method may also return domains outside of the specified interval.
public virtual Interval[] Holes(
x0,
Lower limit of query domain.
x1
Upper limit of query domain.
)

Integrate

#
Evaluate the definite integral between two parameters. Unless a function specifically implements an analytic integral, this value will be approximate. Note to implementer: if you provide an analytic integral via the Integral property, that function will be used to compute an analytic result. There is typically no reason to override this method.
public virtual double Integrate(
x0,
Integral start.
x1
Integral end.
)
Definite integral from x0 to x1.

Num

#
Format a numeric constant for use in a function notation.
protected static string Num(
value,
Number to format.
omitZero = false,
If true, and the number is zero, an empty string will be returned.
prependSign = false
If true, the sign of the number will be prepended as a seperate operator.
)

Poles

#
Returns an array of all the poles (i.e. vertical asymptotes) within a domain. This method may return both null and empty arrays, implying no poles. Furthermore this method may choose to return poles which fall outside of the given domain.
public virtual Pole[] Poles(
x0,
Lower limit of query domain.
x1
Upper limit of query domain.
)

Store

#
public virtual void Store(
writer
)
Store

Y

#
Evaluate this function at a given x parameter. This method may return NaN values or even throw. The caller is responsible for handling any and all failure cases.
public abstract double Y(
x
Parameter.
)
f(x)

YYYY

#
Evaluate a large amount of values. Functions may choose to use multiple threads to perform this calculation. This method should not throw, instead every failed evaluation will be represented by a NaN value.
public double[] YYYY(
x
Value to evaluate.
)
Evaluation results. Array will contain double.NaN entries for failed evaluations.

Operators

OperationResultDescription
Function+FunctionFunctionAdd two functions together.
Function/FunctionFunctionDivide one function by another.
Function*FunctionFunctionAdd two functions together.
Function-FunctionFunctionSubtract one function from another.

Convertors

OperationResultDescription
implicitBigIntegerFunctionConvert a number into a constant function.
implicitdoubleFunctionConvert a number into a constant function.
implicitintFunctionConvert a number into a constant function.