|
Orbital library | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorbital.math.functional.Functions
public final class Functions
Common function implementations.
| Field Summary | |
|---|---|
static Function |
arccos
arccos: [-1,1]->[0,π]; x |-> arccos x = cos-1 x. |
static Function |
arccot
arccot: R->(0,π); x |-> arccot x = cot-1 x. |
static Function |
arcosh
arcosh: [1, inf )->[0, inf ); x |-> arcosh x = (cosh|[0, inf ))-1 x = log(x ± sqrt x2-1). |
static Function |
arcoth
arcoth: R\[-1,1]->R\{0}; x |-> arcoth x = coth-1 x = log((x+1) / (x-1)) / 2. |
static Function |
arcsin
arcsin: [-1,1]->[-π/2,π/2]; x |-> arcsin x = sin-1 x. |
static Function |
arctan
arctan: R->(-π/2,π/2); x |-> arctan x = tan-1 x. |
static Function |
arsinh
arsinh: R->R; x |-> arsinh x = sinh-1 x = log(x + sqrt x2+1). |
static Function |
artanh
artanh: (-1,1)->R; x |-> artanh x = tanh-1 x = log((1+x) / (1-x)) / 2. |
static Function |
cos
cos: C->C; x |-> cos x = Σn=0 inf (-1)n * x2n / (2n)!. |
static Function |
cosh
cosh: C->C; x |-> cosh x = (ex+e-x) / 2 = Σn=0 inf x2n / (2n)!. |
static Function |
cot
cot: C\πZ->C; x |-> cot x = cos x / sin x = 1 / tan x. |
static Function |
coth
coth: R\{0}->R; x |-> coth x = cosh x / sinh x = 1 / tanh x. |
static Function |
csc
csc: R\{0}->R; x |-> csc x = 1 / sin(x). |
static Function |
csch
csch: R\{0}->R; x |-> csch x = 1 / sinh(x). |
static BinaryFunction |
delta
delta: R×R->R; (x,x) |-> 1, (x,y) |-> 0 for x!=y. |
static Function |
diracDelta
diracDelta δ: M\{0}->{0}; x |-> 0 if x!=0. |
static Function |
exp
exp: C->C\{0}; x |-> ex = Σn=0 inf xn / n!. |
static Functions |
functions
Class alias object. |
static Function |
id
id: R->R; x |-> x . |
static Function |
log
log: C\{0}->C; x |-> loge x. |
static Function |
logistic
logistic: A->(0,1); x |-> 1 / (1 + e-x). |
static Function |
nondet
Represents a nondeterministic function. |
static Function |
norm
norm: A->[0, inf ); x |-> ||x||. |
static Function |
one
one: R->R; x |-> 1 . |
static BinaryFunction |
projectFirst
Projects to the first argument, ignoring the second. |
static BinaryFunction |
projectSecond
Projects to the second argument, ignoring the first. |
static Function |
reciprocal
reciprocal: C\{0}->C; x |-> x-1 = 1 / x. |
static Function |
sec
sec: R->R; x |-> sec x = 1 / cos(x). |
static Function |
sech
sech: R->R; x |-> sech x = 1/cosh(x). |
static Function |
sign
sign: A->{-1,0,1}; x |-> -1 if x<0, x |-> 0 if x=0, x |-> 1 if x>0. |
static Function |
sin
sin: C->C; x |-> sin x = Σn=0 inf (-1)n * x2n+1 / (2n+1)!. |
static Function |
sinh
sinh: C->C; x |-> sinh x = (ex-e-x) / 2 = Σn=0 inf x2n+1 / (2n+1)!. |
static Function |
sqrt
sqrt sqrt : C->C; x |-> sqrt x = x1/2. |
static Function |
square
square: R->R; x |-> x2 . |
static Function |
tan
tan: C\(π/2+πZ)->C; x |-> tan x = sin x / cos x. |
static Function |
tanh
tanh: C\(πi/2*Z)->C; x |-> tanh x = sinh x / cosh x. |
static Function |
zero
zero: R->R; x |-> 0 . |
| Method Summary | |
|---|---|
static BinaryFunction |
binaryConstant(Arithmetic a)
constant â: R×R->R; (x,y) |-> a. |
static BinaryFunction |
binarySymbolic(java.lang.String name)
symbolic f:R×R->R; (x,y) |-> f(x, y). |
static Function |
constant(java.lang.Object a)
constant â: R->R; x |-> a . |
static int |
delta(int i,
int j)
|
static Function |
exp(Arithmetic b)
expb: C->C\{0}; x |-> bx . |
static Function |
linear(Arithmetic a)
linear: A->B; x |-> a*x. |
static Function |
piecewise(Predicate[] cond,
Function[] value)
Get a function defined piecewise. |
static UnivariatePolynomial |
polynom(int degree)
polynom: R'->R'; X|->Σi=0d Xi. |
static UnivariatePolynomial |
polynom(Vector coeff)
polynom: R'->R'; X|->Σi=0d aiXi. |
static Function |
pow(Arithmetic p)
powp: R->R; x |-> xp . |
static Function |
pow(double p)
|
static Function |
projection(int component)
projection πc: An->A; (x1,...xn)T |-> xc. |
static Function |
projection(int i,
int j)
projection πi,j: An×m->A; (xi,j) |-> xi,j. |
static Function |
step(Real t)
step ht: A->{0,1}; x |-> 1 if x>=t, x |-> 0 if x<t. |
static Function |
symbolic(java.lang.String name)
symbolic f:R->R; x |-> f(x). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Functions functions
To alias the methods in this class, use an idiom like
// alias object Functions F = Functions.functions; Operations op = Operations.operations; // use alias Function f = (Function) op.times.apply(F.sin, op.plus.apply(F.square, F.cos)); // instead of the long form Function f = (Function) Operations.times.apply(Functions.sin, Operations.plus.apply(Functions.square, Functions.cos));
public static final Function zero
public static final Function one
public static final Function id
derive: id' = 1
integrate: integral id dx = x2/2
public static final Function reciprocal
derive: reciprocal' = -x-2
integrate: integral x-1 dx = log x
It is generally preferred to use Operations.inverse instead!
Operations.inversepublic static final Function square
derive: square' = 2*id
integrate: integral x2 dx = x3/3
Implementation uses faster x*x for Values.
public static final Function sqrt
derive: sqrt x' = -1/2/ sqrt x
integrate: integral sqrt xdx = 2/3*x3/2
Implementation uses faster Math.sqrt(double) for scalars in [0, inf ).
For complex numbers z=r*ei*φ!=0 this function returns
public static final Function exp
derive: (ex)' = ex
integrate: integral ex dx = ex
For complex numbers x = a + i*b in C; a,b in R this function returns ea + i*b = eaei*b = ea * (cos(b) + i*sin(b)).
exp-function is exactly 2kπi-periodic. This is due to the relation for all z in C ez+ω = ez <=> eω = 1 <=> ω = 2kπi; k in Z.
log,
ValueFactory.polar(Real,Real)public static final Function log
derive: log' = 1 / x
integrate: integral log x dx = x*log |x| - x
For complex numbers x=r*eiφ in C this function returns the principal logarithm
exppublic static final Function sin
derive: sin' = cos
integrate: integral sin x dx = -cos x
For complex numbers z this function returns sin z = sinh(i*z)/i = (ei*z-e-i*z) / (2i).
functional equations:
sin(x+y) = sin x * cos y + cos x * sin y,
cos(x+y) = cos x * cos y - sin x * sin y.
sin(x)2 + cos(x)2 = 1
This sinus looks like ∿.
arcsin,
sinhpublic static final Function cos
derive: cos' = -sin
integrate: integral cos x dx = sin x
For complex numbers z this function returns cos z = cosh(i*z) = (ei*z+e-i*z) / 2.
reductions: cos x = sin(π/2+x)
arccos,
coshpublic static final Function tan
derive: tan' = sec2 = 1/cos2 = 1 + tan2
integrate: integral tan x dx = - log(cos x)
For complex numbers z this function is tan z = tanh(i*z)/i.
arctan,
cotpublic static final Function cot
derive: cot' = -csc2 = -(1 + cot2).
integrate: integral cot x dx = log(sin x)For complex numbers z this function is cot z = coth(i*z)*i.
tanpublic static final Function csc
derive: csc' = -cot*csc
public static final Function sec
derive: sec' = sec*tan.
public static final Function arcsin
derive: arcsin' = 1 / sqrt 1 - x2
integrate: integral arcsin x dx = x * arcsin x + sqrt 1 - x2
arcsin x = Σn=0 inf (-1)n * nCr(-1/2, n) * x2n+1 / (2n+1) on (-1,1).
sinpublic static final Function arccos
derive: arccos' = - 1 / sqrt 1 - x2
integrate: integral arccos x dx = x * arccos x - sqrt 1 - x2
arccos x = π/2 - arcsin x.
cospublic static final Function arctan
derive: arctan' = 1 / (1 + x2)
integrate: integral arctan x dx = x * arctan x - log(x2 + 1)/2
arctan x = Σn=0 inf (-1)n * x2n+1 / (2n+1) on [-1,1].
tanpublic static final Function arccot
derive: arccot' = - 1 / (1 + x2)
integrate: integral arccot x dx = x * arccot x + log(x2 + 1)/2
arccot x = π/2 - arctan x.
cotpublic static final Function sinh
derive: sinh' = cosh
integrate: integral sinh x dx = cosh x
functional equations:
sinh(x+y) = sinh x * cosh y + cosh x * sinh y,
cosh(x+y) = cosh x * cosh y + sinh x * sinh y.
cosh(x)2 - sinh(x)2 = 1
(cosh x+ sinh x)n = cosh(n*x) + sinh(n*x)
arsinhpublic static final Function cosh
derive: cosh' = sinh
integrate: integral cosh x dx = sinh x
arcoshpublic static final Function tanh
derive: tanh' = sech2 = 1/cosh(x)2 = (1 + tanh x) * (1 - tanh x) = 1 - (tanh x)2
integrate: integral tanh x dx = log(cosh x)
The hyperbolic tangent is a sigmoid function.
cothpublic static final Function csch
derive: csch' = -coth*csch.
public static final Function sech
derive: sech' = -sech*tanh.
public static final Function coth
derive: coth' = -csch2.
integrate: integral coth x dx = log(sinh x)
|coth 0| = inf is a singularity.
tanhpublic static final Function arsinh
derive: arsinh' = 1 / sqrt x2+1)
integrate: integral arsinh x dx = x * arsinh x - sqrt x2+1)
sinhpublic static final Function arcosh
derive: arcosh' = 1 / sqrt x2-1)
integrate: integral arcosh x dx = x*arcosh x - sqrt x2-1)
sinhpublic static final Function artanh
derive: artanh' = 1 / (1 - x2)
integrate: integral artanh x dx = x*artanh x + log(x2-1) / 2
tanhpublic static final Function arcoth
derive: arcoth' = 1 / (1 - x2)
integrate: integral arcoth x dx = x*arcoth x + log(x2-1) / 2
cothpublic static final Function norm
derive: norm'|Rn\{0} = x / ||x||. which is true for the euclidian 2-norm ||x||2 = sqrt x.x, only.
derive: abs'|(- inf ,0) = -1, abs'|(0, inf ) = 1.
Vector.multiply(orbital.math.Vector)public static final Function nondet
This nondeterministic function returns results randomly. It is provided for theoretical reasons and cannot be used as a random generator.
public static final Function logistic
derive: logistic' = e-x / (1 + e-x)2 = logistic(x) * (1 - logistic(x)).
integrate: integral logistic(x)dx =
The logistic function is a sigmoid function, and resembles the continuous logistic distribution.
signpublic static final Function sign
derive: sign' = diracDelta = 0 on R\{0}.
step(Real),
logisticpublic static final Function diracDelta
derive: δ' = δ ??.
integrate: integral δ(x)dx = step0(x)
delta,
step(Real),
piecewise(Predicate[], Function[])public static final BinaryFunction projectFirst
projectFirst: (x,y) |-> x.
Equals Functionals.onFirst(id)
Evolves: might be renamed.
public static BinaryFunction projectSecond
projectSecond: (x,y) |-> y.
Equals Functionals.onSecond(id)
Evolves: might be renamed.
public static final BinaryFunction delta
diracDelta| Method Detail |
|---|
public static final Function constant(java.lang.Object a)
derive: â' = 0
integrate: integral adx = a*x
public static final Function symbolic(java.lang.String name)
derive: (f)' = f'
integrate: integral f(x)dx = integral f(x)dx
name - the name of the symbolic function.
public static final Function linear(Arithmetic a)
derive: linear' = a.
integrate: integral a*x dx = a*x2/2
linear functions are Lipschitz-continuous.
The concrete sets A and B depend on the exact type of a. For instance if a is a Matrix in Km×n this function is the linear homomorphism Kn->Km; x |-> a*x.
public static final Function pow(Arithmetic p)
derive: (xp)' = p*xp-1
integrate: integral xp dx = xp+1/(p+1)
public static final Function pow(double p)
public static final Function exp(Arithmetic b)
derive: (bx)' = log b * bx
integrate: integral bx dx = bx / log b
public static final Function projection(int component)
public static final Function projection(int i,
int j)
public static final UnivariatePolynomial polynom(int degree)
This method will return the polynom in R[X]d of the given degree that corresponds to the Vandermonde Matrix so all coefficients are 1. dim R[X]d = d+1. The ring R' is "compatible" with R.
polynom(Vector),
UnivariatePolynomialpublic static final UnivariatePolynomial polynom(Vector coeff)
This method will return the polynom in R[X] with the specified coefficients vector in Rd. Although dim R[X] = inf this method will return a polynomial in R[X]d of degree =<d:=coeff.dimension(). The ring R' is "compatible" with R.
polynom(int),
ValueFactory.asPolynomial(Vector),
UnivariatePolynomialpublic static final Function step(Real t)
derive: stept' = diracDelta(t-x).
integrate: integral stept(x)dx = stept(x) * (x - t)
sign,
diracDelta
public static final Function piecewise(Predicate[] cond,
Function[] value)
deriving this function requires it to be in C1(A, B). Similarly, integrating requires it to be integrable, at all. Unless you make sure that these requirements are met, the implementation will return values that are completely meaningless.
Note that piecewise functions can be defined in terms of appropriate compositions with heaviside functions which in turn can be defined as translations of the unit step function.
cond - the condition predicates ci.value - the functions of whom the first one is applied whose associated predicate
yields true.
java.lang.IllegalArgumentException - if no condition predicate matches for an argument x.step(orbital.math.Real)public static final BinaryFunction binaryConstant(Arithmetic a)
derive: â' = 0.
integrate: integral adxi = a*xi
public static final BinaryFunction binarySymbolic(java.lang.String name)
derive: (f)' = f'
integrate: integral f(x,y)dxi = integral f(x,y)dxi
name - the name of the symbolic function.
public static final int delta(int i,
int j)
|
Orbital library 1.2.0: 23 Apr 2008 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||