arXiv:1510.05510v5 [q-fin.CP] 6 Dec 2016 Mathematical Foundations of Realtime Equity Trading. Liquidity Deficit and Market Dynamics. Automated Trading Machines. Vladislav Gennadievich Malyshkin * Ioffe Institute, Politekhnicheskaya 26, St Petersburg, 194021, Russia Ray Bakhramov † Forum Asset Management LLC, 733 Third Avenue, New York, NY 10017 (Dated: September 13, 2015) $Id: LD.tex,v 1.211 2016/12/04 09:32:16 mal Exp $ We postulates, and then show experimentally, that liquidity deficit is the driving force of the markets. In the first part of the paper a kinematic of liquidity deficit is developed. The calculus-like approach, which is based on Radon–Nikodym deriva- tives and their generalization, allows us to calculate important characteristics of observable market dynamics. In the second part of the paper this calculus is used in an attempt to build a dynamic equation in the form: future price tend to the value maximizing the number of shares traded per unit time. To build a practical automated trading machine P&L dynamics instead of price dynamics is considered. This allows a trading automate resilient to catastrophic P&L drains to be built. The results are very promising, yet when all the fees and trading commissions are taken into account, are close to breakeven. In the end of the paper important criteria for automated trading systems are presented. We list the system types that can and cannot make money on the market. These criteria can be successfully applied not only by automated trading machines, but also by a human trader. * [email protected]ffe.ru † [email protected]
42
Embed
Mathematical Foundations of Realtime Equity Trading ... · PDF filearXiv:1510.05510v5 [q-fin.CP] 6 Dec 2016 Mathematical Foundations of Realtime Equity Trading. Liquidity Deficit
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
arX
iv:1
510.
0551
0v5
[q-
fin.
CP]
6 D
ec 2
016
Mathematical Foundations of Realtime Equity Trading. Liquidity
Deficit and Market Dynamics. Automated Trading Machines.
Vladislav Gennadievich Malyshkin∗
Ioffe Institute, Politekhnicheskaya 26, St Petersburg, 194021, Russia
Ray Bakhramov†
Forum Asset Management LLC, 733 Third Avenue, New York, NY 10017
(Dated: September 13, 2015)
$Id: LD.tex,v 1.211 2016/12/04 09:32:16 mal Exp $
We postulates, and then show experimentally, that liquidity deficit is the driving
force of the markets. In the first part of the paper a kinematic of liquidity deficit is
developed. The calculus-like approach, which is based on Radon–Nikodym deriva-
tives and their generalization, allows us to calculate important characteristics of
observable market dynamics. In the second part of the paper this calculus is used
in an attempt to build a dynamic equation in the form: future price tend to the
value maximizing the number of shares traded per unit time. To build a practical
automated trading machine P&L dynamics instead of price dynamics is considered.
This allows a trading automate resilient to catastrophic P&L drains to be built. The
results are very promising, yet when all the fees and trading commissions are taken
into account, are close to breakeven. In the end of the paper important criteria for
automated trading systems are presented. We list the system types that can and
cannot make money on the market. These criteria can be successfully applied not
only by automated trading machines, but also by a human trader.
merical stability for not very large k (Here p∗ is some price close to average and σ is some
value close to standard deviation; again, the result does not depend on selection of p∗ or
σ, only numerical stability of calculations may depend on these values.) The (11) basis is
very convenient for quasi–stationary consideration of market dynamics [13]. However, for
time–dependent dynamics it requires the dp/dt moments, that carry much less information
than the v, dv/dt and d2v/dt2 moments. In the bases (3) and (7) the v and d2v/dt2 moments
can be easily calculated from the dv/dt moments using integration by parts.
Before we go further, let us show some familiar calculations using the basis we introduced.
1.Interpolate price (assume f = p) by a polynomial of n-th order using least squares
approximation.
⟨[f −
s=n∑
s=0
αsQs(x)
]2⟩
µ
→ min (14)
Gkl =< Qk(x)Ql(x) >µ (15)
f(x) =k,l=n∑
k,l=0
Qk(x)G−1kl 〈Ql(x)f〉µ (16)
Here G−1 is a matrix inverse to Gramm matrix G calculated in basis Qk using inner prod-
uct (13). The interpolation polynomial (16) is of n-th order and depend on the moments
〈Qk(x)f〉, where k = 0..n (In Ref. 12 only monomials moments⟨xkf
⟩are called “moments”
and the 〈Qk(x)f〉 are called “modified moments”, we would call all of them “moments”).
7
Note that interpolation polynomial typically give good interpolation in the middle of inter-
val, but exhibit oscillations near interval ends (Runge oscillations).
2. Given two prices p and q calculate covariance between then.
(p− p)(q − q) = (17)
=k,l=n∑
k,l=0
〈Ql(x)q〉µG−1kl 〈Ql(x)p〉µ− < Q0p >µ< Q0q >µ (18)
p =< Q0p >µ (19)
q =< Q0q >µ (20)
The measure µ (13) in general case is not necessary normalized to 1 and because of this all
averages in (18) should be divided by the normalizing factor < Q0 > equal to an integral
from a constant Q0, but all three measures we consider have < 1 >= 1, so if Q0 = 1 this
normalizing factor can be omitted, see the see Appendix E for exact formulas in general case.
Note that (18) provide very efficient(linear time) algorithm of stock prices cross-correlation
calculation. For every stock calculate [0..n] moments 〈Qk(x)p〉 forming a vector, then obtain
covariance through scalar product of these vectors with Gramm matrix inverse used as a
scalar product matrix (note here, that if original Qk basis is orthogonal then Gramm matrix
is diagonal and its inversion process is stable, while in general case the process of Gramm
matrix inversion is numerically unstable[14]).
A. Radon–Nikodym derivatives and rational approximation
Consider reproducing kernel K(x, y, µ) for a positive measure dµ
Mµ;ij [f ] = < QifQj >µ (21)
K(x, y, µ) = Qi(x) (Mµ[1])−1ij Qj(y) (22)
K(x, y, µ) = Q(x)G−1µ Q(y) (23)
(Here and below we assume a summation [0..n] over “silent” indexes i, j. Another notation
we will use from time to time is vector notation, where bold Q define the entire vector Qk
and matrix indexes are omitted. The Eq. (23) is exactly the same as (22) but written
in vector notation.) For arbitrary P (y) = αiQi(y) (22) gives P (x) = 〈K(x, y, µ)P (y)〉µ(y).The 1/K(x, x, µ) is a Christoffel function, related to the “density” of measure µ at point
8
x, for example Gaussian quadrature weights built for the measure µ are equal to exactly
1/K(x, x, µ) at x equal to quadrature nodes[15].
Consider two positive measures dµ(x) and dν(x). Their ratio dνdµ
is called Radon–Nikodym
derivative[16] and is of extreme importance in market analysis[17]. The most important for
us would be to estimate shares trading rate, or executed orders flow, I
I =dv
dt(24)
I is the number of shares traded in unit time and is always positive. The higher I is the
more active trading is.
The problem is to estimate Radon–Nikodym derivative dνdµ
at x given the only moments
of measures µ and ν. This can be estimated, for example, through Christoffel functions
ratio[18]
dν
dµ(x) =
K(x, x, µ)
K(x, x, ν)(25)
The estimation (25) is a ratio of two polynomials of order 2n. In contrasts with least squares
approximation (16) (use f = dν/dµ in (16)), the (25) preserves sign of interpolated function
dν/dµ, does not diverge when x → ∞, it tends to a constant instead, and does not exhibit
diverging oscillations near measure support edges. The estimation requires 0..2n moments
to be known (instead of just 0..n moments for least squares approximation). As we stated
in the beginning of the Chapter II numerical estimation for large n is unfeasible (because
of numerical instabilities) unless a basis Qs orthogonal with respect to some measure (not
necessary the µ, but µ is often good enough) is chosen. This approach allows us to calculate
Radon–Nikodym derivative to very high n (up to 15-20 in Shifted Legendre basis and up to
12-15 in Lagurre basis, Chebyshev basis sometimes allows to use n up to 30).
The approximation (25) requires both measures to be positively defined. There is exist
a different numerical estimation of Radon–Nikodym derivative, requiring only one measure
dµ to be positive:
dν
dµ(x) =
Qi(x) (Mπ[1])−1ij Mν;jk[1] (Mπ[1])
−1kl Ql(x)
Qi(x) (Mπ[1])−1ij Mµ;jk[1] (Mπ[1])
−1kl Ql(x)
(26)
where π is some positive measure, e.g µ. If we formally replace Hermitian matrix (Mπ[1])−1
by non-Hermitian matrix (Mµ[1])−1/2 (Mν [1])
−1/2 and its transpose then we receive original
expression (25). The (26) Radon–Nikodym derivative estimator can be used for interpolation
9
of arbitrary function f . Just put π = µ and dν = fdµ. See Appendix D as an example of
Runge oscillations suppression. The expression (26) in this special case π = µ and dν = fdµ
is plain Nevai operator[19]
Gf =
∫K2(x, t)f(t)dµ(t)
K(x, x)(27)
That can be easily estimated numerically (see the code from com.polytechnik.utils. Nevai-
Operator. getNevaiOperator) as a ratio or two polynomials of order 2n:
(Gf)(x) =Qi(x) (Mµ[1])
−1ij Mµ;jk[f ] (Mµ[1])
−1kl Ql(x)
Qi(x) (Mµ[1])−1ij Qj(x)
(28)
This Nevai operator matches exactly the simplistic form (π = µ) of Radon–Nikodym deriva-
tive in function approximation like in (D4). The Radon–Nikodym derivatives approach is
based on matrices, not vectors as least square approximation is. This matrix approach can
be also effectively applied to average calculation, see Appendix E for an example of two
stocks price covariance calculation.
B. Example of executed orders flow I
In subsection IIA we provided a theory allowing to numerically calculate the executed
orders flow. To show this theory practical value let us apply it to calculation of executed
order flow I for stock AAPL on September, 20, 2012. All the charts we present will be for
this specific day. In our analysis we actually analyzed about 4 years period. Optimized
ITCH parser along with recurrent calculation of the moments (given the moments on inter-
val [−∞,−τ ] (old moments) the new moments on interval [−∞, 0] (t=0 is “now”) can be
calculated using old moments and performing timeserie scanning only on [−τ, 0] interval).Such optimization allows to run entire trading day analysis for hundred of stocks in less
than 15 minutes. But this massive data analysis is not the point of the paper. This would
be important were we building some statistical arbitrage model. But for dynamic model -
single day is enough to demonstrate the key elements of the theory. The September, 20,
2012 was chosen for simple reason that it had bear market before 10:00 and bull market
with high volatility after 10:00. Such market behavior almost always lead to severe losses
by automated trading machines, so this day is a good one for testing.
On Fig. 1 we present execution flow I0 (I at t = 0) calculated in Shifted Legendre basis
as x = exp(t/τ), dµ = exp(t/τ)dt and dν = exp(t/τ)dv, then I from (24) can be estimated
FIG. 1. The AAPL stock price on September, 20, 2012 round 10am. The time on x axis is in
decimal fraction of an hour, e.g. 9.75 mean 9:45am. Red line AAPL stock price. Black line -
execution order flow I0 (in arbitrary units shifted to fit the chart) at interval edge(time=“now”)
calculated in Shifted Legendre basis with n = 6 and τ=128sec.
as Radon–Nikodym derivative dν/dµ calculated at t = 0. On Fig. 1 the I0 (scaled to fit
the chart) show large fluctuations, with alternating periods of low and high trading activity.
High trading activity events exhibit singular type of behavior in I, that manifest itself in
price as a peculiarity, not as singularity. This allows us to suggest that in market dynamics
executed trades flow is primary and price changes are secondary.
The minimal calculable time scale of I spikes can be estimated as τ/(n + 1) for Shifted
Legendre basis and as τ for Laguerre basis. If we accept the hypothesis that fluctuations
in I cause market dynamics then we can estimate time scale on which automated trading
machine can potentially work. The idea is to have large fluctuations △v/△t (fluctuationscan be many orders of magnitude, but for our way to calculate Radon–Nikodym derivatives
they are limited to minimal time scale). If minimal time scale is set large enough (about
an hour) volume fluctuations on this scale become small and such small fluctuations of
orders flow cannot be the source of predictable price movement. In the same time too small
time scale provide little liquidity and only companies with very advanced infrastructure can
11
potentially take advantage of such small time scales. This make us to conclude that workable
time scales are bounded at low values - by insufficient liquidity available and at high values
- by low I fluctuations.
One can extract some additional important facts from this chart, but the main question
with I0 is: What is the scale the I should be compared to to tell that we have liquidity
excess (I > IIH) or liquidity deficit (I < IIL). Any values calculated from fixed time scale
(e.g. < I >, which used τ as time scale) cannot provide workable values for IIH and IIL.
The next section is dedicated to this problem.
C. Generalized Radon–Nikodym derivatives and Generalized Eigenvectors problem
The Eq. (26) can be rewritten in the form
ψ(x) = Q(x) (Mπ[1])−1
Q(x0) (29)
dν
dµ(x0) =
< ψ|ψ >ν
< ψ|ψ >µ
(30)
and for simplest case π = µ
ψ0(x) =Q(x) (Mµ[1])
−1Q(x0)√
Q(x0) (Mµ[1])−1
Q(x0)(31)
dν
dµ(x0) =
< ψ0|ψ0 >ν
< ψ0|ψ0 >µ
(32)
where the (29) is a “wavefunction” localized at x = x0 and (30) is the value of Radon–
Nikodym derivative at x = x0. Let us remove the localization restriction (29), then the
< ψ|ψ >ν
< ψ|ψ >µ
= λ (33)
Mν [1]|ψ(j) > = λ(j)Mµ[1]|ψ(j) > (34)
< ψ(j)|ψ(j) >µ = < ψ(j)|Mµ[1]|ψ(j) >= 1 (35)
can be considered as generalized eigenvalues problem with scalar product < a|b >=<
a|Mµ[1]|b >. The upper index (j) numerate eigenvalues and eigenvectors. If matrix Mµ[1]
is positive, (e.g. dµ = ω(t)dt with ω(t) > 0) then (34) has exactly dimM = n + 1 real
eigenvalues λ(j) and corresponding to them eigenvectors |ψ(j) >. This problem is invariant
to basis transform. A good basis selection (e.g. (3) or (7) ) make matrix Mµ[1] diagonal and
the problem (34) is trivially reduced to a regular eigenvalues problem. In general case gen-
eralized eigenvector problem is not any more problematic, than regular eigenvalues problem
12
and can be solved numerically using standard, e.g. LAPACK[20] routines dsygv, dsygvd
and similar.
The problem (34) is much more generic than its “localized” Radon–Nikodym version
(26). Trivial usage of (34) is to find minimal/maximal value of Radon–Nikodym derivative
(or a function, for this just put dν = f(x)dµ), this will be the minimal/maximal eigenvalue
λ. (Note, that the eigenfunction, corresponding to minimal/maximal eigenvalue has very
noticeable topological properties, such as: 1. If highest order polynomial coefficient of
eigenfunction ψ(x) is non zero (if it is zero, then it can be varied to some infinitesimal value)
then the ψ(x) (a polynomial of n-th order) has exactly n simple real distinct roots (but not
necessary on the support of dµ or dν). This property does not hold for ψ(x) corresponding
to other than minimal/maximal eigenvalue. 2. The measure dθ = dν − λmindµ (or similarly
for maximal eigenvalue take dθ = λmaxdµ− dν) generate n+ 1 orthogonal polynomials, the
last one the n-th order polynomial equal (within a constant) exactly to ψ(x), corresponding
to λmin, and has the norm with measure dθ exactly equal to zero < ψ|ψ >θ= 0 A Gaussian
quadrature can be build on this measure dθ, all nodes are located at ψ(x) roots and all
weights are positive. We expect to put more study of this interesting topic separately.)
But before we go this direction, let us show some simple illustrative example, when
dν = P (t)dµ, where P is asset price. Then all eigenvalues are just the prices near which the
asset was traded the most. In Price basis (10) the eigenvalues are the nodes of Gaussian
quadrature built on measure (11). In Laguerre and Shifted Legendre basis the result is
very similar, but does not have a meaning of quadrature nodes (it is now related to Mµ[P ]
matrix spectrum). In case n = 0 there is a single eigenvalue, which is equal exactly to
moving average with the measure dµ. So this technique can be considered as moving average
generalization. Putting price into (34) does not provide one with any information about the
future. The Fig. 2 serve just as an illustration of generalized eigenvalues technique.
D. Example of thresholds calculation
The ψ from Eq. (31) is a state localized at x0. Consider x0 to be interval end (x0 = 0
for Laguerre basis (4) and x0 = 1 for shifted Legendre basis (8)). All functions ψ(x)
orthogonal to (31) with respect to measure dµ have ψ(x0) = 0. Then we can write generalized
FIG. 6. A chart similar to the Fig. 1, but comparing real execution flow I = dv/dt (black line)
and artificial one J (green line) calculated from |dp|/dt.
During our attempt to build dynamic equation we spent substantial effort in an attempt
to define Lagrange functional L and then build action S like in other dynamic theories:
L =m
2Volatility − I (62)
S =∫Ldt (63)
S → min (64)
δS → 0 (65)
This approach is very attractive: it requires to minimize price volatility (like in “reverse-to-
mean” type of theories) and to maximize execution flow I (like in supply-demand theories),
but possibly fruitless. We spent substantial time pursuing this route using various volatility
models and constrains on action variation with no improvement compared to using just
I and only supply-demand functional (57). This means that the “effective mass” m in
23
(62) is close to 0, at least for equity trading. At this point we do not have an answer
to the fundamental question about price volatility role, and whether other therms, similar
in their nature to volatility, should be put to Lagrange functional (62) along with supply-
demand term I = dv/dt. In all the calculations below we would assume m = 0. Note
that in stationary case on Fig. 5 these volatility–like terms play no effect, they play role
only in dynamic situation, when price change, so our approach can be considered as a
“quasistationary approximation”. We can give another reason why price volatility (but not
the terms like (dψ/dt)2, that lead to Schrodinger — like equation, which was also tried
without much success) should not enter the dynamic equation: as we discussed earlier,
price fluctuations are secondary to liquidity fluctuations, and position enter/exit conditions
should be calculated without price used. Then, only on the last step, when P&L need to be
calculated the price should be used to calculate the direction.
C. Price corresponding to maximal I on past sample
The PAV ER introduced in Subsection IIIB is calculated as average over some time (or
volume) interval (60). This price(calculated on past sample) has no any degree of freedom
available and correspond to a strategy buy below PAV ER, sell above PAV ER thus maximize
trading volume (to have the condition (47) satisfied one have to use median, not average
price, but for practical calculations median and average are close enough). Now, instead of
trading to maximize volume consider trading to maximize I, Eq. (57). What is different,
we now have dimM degrees of freedom (ψ components) available, that are selected to have
I maximized. Calculations still uses only “charted” past prices (because both measures Idµ
and dµ are positive), but the time scale is now selected automatically. This is the most
critical improvement when doing a transition from maximizing volume to maximizing I.
The corresponding price PIH (two versions calculated with different boundary conditions
were already presented on the Fig. 4), but now we are going to perform an analysis it in
terms of P&L dynamics.
The problem can be formulated as to find a strategy, maximizing the P&L. Let us present
a simple, but nevertheless practical, trading strategy, which exhibit all the important ele-
ments of the theory.
Input: at time ti execution with price p(ti) and trading volume dv(ti).
24
Continuously calculate I0, IIL, IIH , and PIH as we did in the previous section. There
is one more variable dir , which determine the direction of position opening, and threshold
constant th , that is typically selected about 0.8-0.9. Then apply the following heuristics:
1. If I0 < IIL enter long position if dir > th , enter short position if dir < −th , otherwise
hold no position.
2. If I0 > IIH :
• Recalculate dir . First calculate PIH (see Section IID) with boundary condition
ψ(x0) = 0, then build matrix Mµ[(p − PIH)I] from Mµ[p] and Mµ[pI] matrices
calculated directly from the moments of observable samples. The matrixMµ[(p−PIH)I] corresponds to P&L matrix in scenario “enter position at ψIH”. Note that
if entering position take unit time, then the IIH is the maximal volume which
can be accumulated in unit time on past sample.
• Determine how “exit now” scenario is good for P&L operator. Solve generalized
eigenvalues problem (without boundary condition ψ(x0) = 0) <ψ|Mµ[(p−PIH)I]|ψ><ψ|Mµ[1]|ψ>
=
λP&L, find ψP&L;min and ψP&L;max, corresponding to min and max values of λP&L,
then
dir = < ψ0|ψP&L;max >2 − < ψ0|ψP&L;min >
2 (66)
where ψ0 is from Eq.(31).
• Remember dir for later use on stage 1.
• If dir > th close long position, if dir < −th close short position.
Conceptually the described heuristics is similar to plast−PIH directional trading (all supply-
demand type of theories are directional theories), but generalized eigenvalues techniques is
used to estimate the thresholds and time scale. Note that if one need just a prediction of
I - the result is very accurate: If current I0 is large (I0 > IIH) then future I0 will be low
(I0 < IIL), similar if current I0 is low (I0 < IIL), then future I0 will be high (I0 > IIH).
This may look trivial (alternating periods of low and high liquidity availability) but this
mean that liquidity(not price!) undergo large oscillations, and price changes are just the
consequences of large changes in liquidity.
25
The key element of the strategy is that it actually trades liquidity, providing liquidity
during deficit and taking it during excess. Our HFT experiments to be discussed in details
in a separate publication, here we just put briefly only the most important qualitative
observations.
Among a number of different strategies tested — only this one provided no eventual
catastrophic P&L drain (“Black Swan”[23] –like events). The reason is simple: the strategy
of holding zero position during liquidity excess make the system resilient to the situation
when market moves against position held, but in the same time entering the position during
liquidity deficit (when the volatility is small) make the system collecting most of the market
movement juice.
Our experiments (especially for other than equity markets) show that in a situation
when market direction is known by a human trader the value of dir can be set manually
according to trader’s view and the system would effectively collect the P&L on small market
movements, in the same time avoiding catastrophic P&L drains on the events when market
moves against position held. On Fig. 7 we present calculated dir for I0 > IIH . The
calculated during liquidity excess the value of dir should be saved for liquidity deficit (I0 <
IIL) time moments for determination of position opening direction. The chart shows time
scale auto adjustment, what is drastically different from PAV ER on Fig. (4), where time
scale is exactly τ . The result is stable in a sense the time scale of dir sign change is greater
than minimal time scale available in Mµ[I] matrix.
Testing the strategy on real data (even paper trading, not to mention real trading) is a
complex task, because all the fees, commissions, delays should be taken into account. In
this paper we will give qualitative description of results obtained as a “paper trading” on
four year period, the detailed results to be published elsewhere.
Any attempt to use PAV ER (corresponding to maximizing trading volume on past trades)
give losses. When used in trade following strategy because of τ delay in trend switch
identification. There are relatively small losses on almost all days. When using “reverse to
PAV ER” type of strategy most of days are profitable, but because of catastrophic P&L drain
on relatively seldom trending days (like the one we used in this presentation) overall P&L is
negative. Use of PIH (corresponding to maximizing I = dv/dt on past trades) to determine
market direction dir and then using this direction to enter position during liquidity deficit
and closing position during liquidity excess typically give profit on both volatility days and
For Chebyshev Basis: Ref. 27, formulae 22.7.24, p. 872. For Hermite Basis: Ref. 28
or 29 formulae 4.5.1.11 page 569.
2. Multiplication by ax+ b. Use 3 term recurrence relation.
3. Given a set of observations xj and wj calculate the moments as∑j Qn(xj)wj . Use 3
term recurrence relation (see the method calculateMomentsFromSample).
4. Expand ax+ b argument Qn(ax+ b) =∑j=nj=0 d
(n)j Qj(x). Use 3 term recurrence relation
to find d(n)j .
5. Synthetic division. For a given polynomial P =∑k=np
k=0 pkQk and D =∑k=nd
k=0 dkQk find
polynomials R and Q such as P = Q ∗ D + R. For nd = 1 result can be calculated
directly from three term recurrence (A1), for nd > 1 use the (A14) coefficients and
solve linear system with respect to R and Q coefficients.
6. Calculation of∑k=nk=0 fkQk(x) at x. Use Clenshaw recurrence formula see Ref. 30, page
56.
32
7. Integration and differentiation of a function∑k=nk=0 fkQk(x) at x. Use Qk(x) integration
and differentiation formulas from Refs. 26, 27, and 29, then apply Clenshaw recurrence
formula.
8. Given F (x) =∑k=nk=0 fkQk(x) find the roots(possibly complex) of F (x) = 0. Build
confederate matrix[31, 32] the eigenvalues of which give the polynomial F (x) roots.
See getConfederateMatrix(final double [] coefs) method and com. polytechnik. utils.
PolynomialRootsConfederateMatrixABasis class.
We have a numerical library implementing these (and also some other) polynomial oper-
ations for the four bases in question (see mentioned above four classes extending the com.
polytechnik. utils. BasisPolynomials). The code is availble from authors[33]. To show
simple application of these bases let us apply them to quadratures calculations. This will
be demonstrated in Appendix B
Appendix B: Quadratures calculation
In this section given the moments < Qk >µ we apply the operations from Appendix A
to calculate Gauss, Radau, Kronrod and Multiple Orthogonality quadratures.
Gaussian quadratures. Using multiplication coefficients (A14) obtain matricesMµ[x] and
Mµ[1]. The first one is obtained initially by multiplication by x, then using (A14), the second
one is obtained by direct application of (A14). Solve generalized eigenvalues problem
Mµ[x]|ψ > = λMµ[1]|ψ > (B1)
The eigenvalues are the quadrature nodes xk, k = [0..n] and the weights wk = 1/(ψ(k)(xk)
)2,
where ψ(k)(xk) is the value of k-th eigenfunction at xk, which is∑j=nj=0 ψ
(k)j Qj(xk). Because
< ψ(j)|Mµ[1]|ψ(k) >= δjk the K(x, y, µ) from (23) and corresponding Christoffel function
has a very simple form in |ψ(k) > basis:
K(x, y, µ) =k=n∑
k=0
ψ(k)(x)ψ(k)(y) (B2)
The ψ(k)(x) are equal(within a constant) to the Lagrange interpolating polynomial built on
xj , j = [0..n] nodes (ψ(k)(xj) = 0 for j 6= k).
Radau quadratures. Using multiplication coefficients (A14) obtain matricesMµ[(x0−x)x]and Mµ[(x0 − x)], then use Gaussian quadratures for nodes and weights calculation.