|
Orbital library | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object orbital.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,∞)→[0,∞); x ↦ arcosh x = (cosh|[0,∞))-1 x = ㏒(x ± √x2-1). |
static Function |
arcoth
arcoth: R\[-1,1]→R\{0}; x ↦ arcoth x = coth-1 x = ㏒((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 = ㏒(x + √x2+1). |
static Function |
artanh
artanh: (-1,1)→R; x ↦ artanh x = tanh-1 x = ㏒((1+x) / (1-x)) / 2. |
static Function |
cos
cos: C→C; x ↦ cos x = ∑n=0∞ (-1)n * x2n / (2n)!. |
static Function |
cosh
cosh: C→C; x ↦ cosh x = (ex+e-x) / 2 = ∑n=0∞ 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∞ xn / n!. |
static Functions |
functions
Class alias object. |
static Function |
id
id: R→R; x ↦ x . |
static Function |
log
㏒: C\{0}→C; x ↦ ㏒e 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,∞); 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∞ (-1)n * x2n+1 / (2n+1)!. |
static Function |
sinh
sinh: C→C; x ↦ sinh x = (ex-e-x) / 2 = ∑n=0∞ x2n+1 / (2n+1)!. |
static Function |
sqrt
sqrt √ : C→C; x ↦ √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: ∫id dx = x2/2
public static final Function reciprocal
derive: reciprocal' = -x-2
integrate: ∫x-1 dx = ㏒ x
It is generally preferred to use Operations.inverse instead!
Operations.inverse
public static final Function square
derive: square' = 2*id
integrate: ∫x2 dx = x3/3
Implementation uses faster x*x for Values.
public static final Function sqrt
derive: √x' = -1/2/√x
integrate: ∫ √xdx = 2/3*x3/2
Implementation uses faster Math.sqrt(double)
for scalars in [0,∞).
For complex numbers z=r*ei*φ≠0 this function returns
public static final Function exp
derive: (ex)' = ex
integrate: ∫ex dx = ex
For complex numbers x = a + i*b∈C; a,b∈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 ∀z∈C ez+ω = ez ⇔ eω = 1 ⇔ ω = 2kπi; k∈Z.
log
,
ValueFactory.polar(Real,Real)
public static final Function log
derive: ㏒' = 1 / x
integrate: ∫㏒ x dx = x*㏒ |x| - x
For complex numbers x=r*eiφ∈C this function returns the principal logarithm
exp
public static final Function sin
derive: sin' = cos
integrate: ∫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
,
sinh
public static final Function cos
derive: cos' = -sin
integrate: ∫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
,
cosh
public static final Function tan
derive: tan' = sec2 = 1/cos2 = 1 + tan2
integrate: ∫tan x dx = - ㏒(cos x)
For complex numbers z this function is tan z = tanh(i*z)/i.
arctan
,
cot
public static final Function cot
derive: cot' = -csc2 = -(1 + cot2).
integrate: ∫cot x dx = ㏒(sin x)For complex numbers z this function is cot z = coth(i*z)*i.
tan
public 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 / √1 - x2
integrate: ∫arcsin x dx = x * arcsin x + √1 - x2
arcsin x = ∑n=0∞ (-1)n * nCr(-1/2, n) * x2n+1 / (2n+1) on (-1,1).
sin
public static final Function arccos
derive: arccos' = - 1 / √1 - x2
integrate: ∫arccos x dx = x * arccos x - √1 - x2
arccos x = π/2 - arcsin x.
cos
public static final Function arctan
derive: arctan' = 1 / (1 + x2)
integrate: ∫arctan x dx = x * arctan x - ㏒(x2 + 1)/2
arctan x = ∑n=0∞ (-1)n * x2n+1 / (2n+1) on [-1,1].
tan
public static final Function arccot
derive: arccot' = - 1 / (1 + x2)
integrate: ∫arccot x dx = x * arccot x + ㏒(x2 + 1)/2
arccot x = π/2 - arctan x.
cot
public static final Function sinh
derive: sinh' = cosh
integrate: ∫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)
arsinh
public static final Function cosh
derive: cosh' = sinh
integrate: ∫cosh x dx = sinh x
arcosh
public static final Function tanh
derive: tanh' = sech2 = 1/cosh(x)2 = (1 + tanh x) * (1 - tanh x) = 1 - (tanh x)2
integrate: ∫tanh x dx = ㏒(cosh x)
The hyperbolic tangent is a sigmoid function.
coth
public 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: ∫coth x dx = ㏒(sinh x)
|coth 0| = ∞ is a singularity.
tanh
public static final Function arsinh
derive: arsinh' = 1 / √x2+1)
integrate: ∫arsinh x dx = x * arsinh x - √x2+1)
sinh
public static final Function arcosh
derive: arcosh' = 1 / √x2-1)
integrate: ∫arcosh x dx = x*arcosh x - √x2-1)
sinh
public static final Function artanh
derive: artanh' = 1 / (1 - x2)
integrate: ∫artanh x dx = x*artanh x + ㏒(x2-1) / 2
tanh
public static final Function arcoth
derive: arcoth' = 1 / (1 - x2)
integrate: ∫arcoth x dx = x*arcoth x + ㏒(x2-1) / 2
coth
public static final Function norm
derive: norm'|Rn\{0} = x / ||x||. which is true for the euclidian 2-norm ||x||2 =√x·x, only.
derive: abs'|(-∞,0) = -1, abs'|(0,∞) = 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: ∫logistic(x)dx =
The logistic function is a sigmoid function, and resembles the continuous logistic distribution.
sign
public static final Function sign
derive: sign' = diracDelta = 0 on R\{0}.
step(Real)
,
logistic
public static final Function diracDelta
derive: δ' = δ ??.
integrate: ∫δ(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: ∫adx = a*x
public static final Function symbolic(java.lang.String name)
derive: (f)' = f'
integrate: ∫f(x)dx = ∫f(x)dx
name
- the name of the symbolic function.
public static final Function linear(Arithmetic a)
derive: linear' = a.
integrate: ∫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: ∫xp dx = xp+1/(p+1)
public static final Function pow(double p)
public static final Function exp(Arithmetic b)
derive: (bx)' = ㏒ b * bx
integrate: ∫bx dx = bx / ㏒ 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)
,
UnivariatePolynomial
public 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] = ∞ 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)
,
UnivariatePolynomial
public static final Function step(Real t)
derive: stept' = diracDelta(t-x).
integrate: ∫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: ∫adxi = a*xi
public static final BinaryFunction binarySymbolic(java.lang.String name)
derive: (f)' = f'
integrate: ∫f(x,y)dxi = ∫f(x,y)dxi
name
- the name of the symbolic function.
public static final int delta(int i, int j)
|
Orbital library 1.3.0: 11 Apr 2009 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |