public abstract static class Function.Cts2Cts extends Function.Native
apply_x(.)
and all else follows.
A Cts2Cts has a Derivative
and
an Integral
.Function.Cts2Cts, Function.Derivative, Function.Integral, Function.Native, Function.Native2, Function.Native3
Value.Atomic, Value.Bool, Value.Char, Value.Chars, Value.Cts, Value.Defer, Value.Discrete, Value.Enum, Value.Inc_Or, Value.Int, Value.Lambda, Value.List, Value.Maybe, Value.Option, Value.Real, Value.Scannable, Value.Structured, Value.Triv, Value.Tuple
Constructor and Description |
---|
Cts2Cts() |
Modifier and Type | Method and Description |
---|---|
abstract double |
apply_x(double x)
apply_x(x) is used by
apply(c) . |
Value.Cts |
apply(Value c)
Calls
apply_x(c.x()) . |
Function.Cts2Cts |
d_dx()
Return the derivative of 'this' function, d/dx this.
|
Function.Cts2Cts |
d2_dx2()
The second derivative, d2/dx2 this,
that is
d_dx() twice. |
static Function.Cts2Cts |
fromFunction(Function f)
(Static) fromFunction(f) creates a Cts2Cts from a Function,
'f', where f is not an instance of Cts2Cts but f does have
the type Cts → Cts.
|
Function.Integral |
integral()
Return the indefinite integral of 'this' function,
∫ this(x) dx.
|
protected Function.Cts2Cts |
make_d_dx()
Slave worker for
d_dx() . |
protected Function.Integral |
make_integral()
Slave worker for
integral() . |
double |
NewtonRaphson(double x0)
Use Newton-Raphson to solve f(x) = 0, where
'f' is 'this' Cts2Cts, given an initial guess, x0.
|
double |
root(double x0)
Solve f(x) = 0, where 'f' is 'this' Cts2Cts, given
an initial guess, x0.
|
double |
turning(double x0)
Find a turning point of 'this' Cts2Cts, 'f', that is find x such
that
f'(x) =0, given an initial guess, x0. |
Function.Cts2Cts |
uOp(int op)
For example, sin.uOp(minus) satisfies
(sin.uOp(minus))(x) = -sin(x).
|
public abstract double apply_x(double x)
apply(c)
.public Value.Cts apply(Value c)
apply_x(c.x())
. If c.AoM() >zero, it
also calls the Derivative
to get an
AoM()
for the result.apply
in class Function.Native
public static Function.Cts2Cts fromFunction(Function f)
public Function.Cts2Cts uOp(int op)
public double turning(double x0)
public double root(double x0)
NewtonRaphson(x0)
.public double NewtonRaphson(double x0)
d_dx
.
(If Newton-Raphson fails, plan B is binary search.)public final Function.Cts2Cts d_dx()
make_d_dx()
.public final Function.Cts2Cts d2_dx2()
d_dx()
twice.protected Function.Cts2Cts make_d_dx()
d_dx()
. This default
returns new Derivative(this)
;
consider overriding it is there is a closed form.public final Function.Integral integral()
make_integral()
.protected Function.Integral make_integral()
integral()
. This default
returns new Integral(this)
;
consider overriding it if there is a closed form,
as in Derivative
.