Eckmann B.: Topology, algebra, analysis- relations and missing links, Notices of AMS, ... liniowa (wypukÅa) kombinacja operatorów OHR prowadzi do obliczenia ...
Artykuł ukazał się w Polish Journal of Environmental Studies Vol. 18, No. 3B (2009), 126-130
dr Dariusz Jakóbczak Department of Computer Science and Management Faculty of Electronics and Informatics Technical University of Koszalin
Curve interpolation using Hurwitz-Radon matrices Abstract Computer science needs suitable methods of curve reconstruction. Classical methods, such as Lagrange or Newton interpolation, have many weak sides: they are useless to interpolate the function that fails to be differentiable at one point or differs from the shape of polynomials considerably. We cannot forget about the Runge’s phenomenon. To deal with curve interpolation dedicated methods should
be constructed. One of them called method of
Hurwitz-Radon Matrices (MHR) can be used in reconstruction and interpolation of curves in the plane. This paper is the effect of author studies on doctoral thesis. The method is based on a family of Hurwitz-Radon (HR) matrices. The matrices are skew-symmetric and possess columns composed of orthogonal vectors. The operator of Hurwitz-Radon (OHR), built from that matrices, is described. It is shown how to create the orthogonal and discrete OHR and how to use it in a process of curve interpolation. Created from the family of N-1 HR matrices and completed with the identical matrix, system of matrices is orthogonal only for vector spaces of dimensions N = 2, 4 or 8. Orthogonality of columns and rows is very important and significant for stability and high precision of calculations. MHR method is interpolating the curve point by point without using any formula of function. Main features of MHR method are: accuracy of curve reconstruction depending on number of nodes and method of choosing nodes, interpolation of L points of the curve is connected with the computational cost of rank O(L), MHR interpolation is not a linear interpolation. Keywords: curve interpolation, contour reconstruction, Hurwitz-Radon matrices, algorithms Introduction The following question is important in mathematics and computer sciences: is it possible to find a method of curve interpolation in the plane without building the interpolation polynomials? Our paper aims at giving the positive answer to this question. This work is the effect of author studies on doctoral thesis. Current methods of curve interpolation based on classical polynomial interpolation: Newton, Lagrange or Hermite polynomials and spline curves which are piecewise polynomials [2], [6]. Classical methods are useless to interpolate the function that fails to be differentiable at one point, for example the absolute value function
f(x)= x at x = 0. If point (0;0) is one of the interpolation nodes, then precise polynomial interpolation of the absolute value function is impossible. Also when the graph of interpolated function differs from the shape of polynomials considerably, for example
f(x)=1/x,
interpolation is very hard because of existing local extrema of polynomial. We cannot forget about the Runge’s phenomenon: when interpolation nodes are equidistance then high-order polynomial oscillates toward the end of the interval, for example close to -1 and 1 with function f(x)=1/(1+25x2) [8]. This paper deals with the problem of interpolation without computing the polynomial or any fixed function. Values of nodes are used to build the orthogonal matrix operators and a linear (convex) combination of OHR operators leads to calculation of curve points. Main idea of MHR method is that the curve is interpolated point by point by computing the unknown coordinate of the points. The only significant factors in MHR method are choosing the interpolation nodes and fixing the dimension of HR matrix (N = 2, 4 or 8). Other characteristic features of function or curve, such as shape or similarity to polynomials, derivative or Runge’s phenomenon, are not important in the process of MHR interpolation. The curve or function in MHR method is parameterized for value
[0;1] in the range of
two successive interpolation nodes. In this paper computational algorithm is considered and then we have to talk about time. Complexity of calculations for one unknown point in Lagrange or Newton interpolation based on n nodes is connected with the computational cost of rank O(n2). Complexity of calculations for L unknown points in MHR interpolation based on n nodes is connected with the computational cost of rank O(L). This is very important feature of MHR method.
The method of Hurwitz-Radon Matrices Adolf Hurwitz (1859-1919) and Johann Radon (1887-1956) published the papers about specific class of matrices in 1923. Matrices Ai, i = 1,2…m satisfying AjAk+AkAj = 0,
Aj2 = -I
for
j ≠ k;
j, k = 1,2...m
(1)
are called a family of Hurwitz-Radon matrices. A family of HR matrices (1) has important features: HR matrices are skew-symmetric (AiT= - Ai) and reverse matrix Ai-1 = - Ai. Only for dimension N = 2, 4 or 8 the family of Hurwitz-Radon matrices consists of N-1 matrices [1].
For N = 2 we have one matrix :
0
A1
.
1
1 0
For N = 4 there are three matrices with integer entries: 0 A1
1 0
0
1 0 0
0
0
0 0
0
0 1
, A2
1
0
0
1 0
0
0
0 1
0
0 0
1 0
0
, A3
1 0 0
0
0
0
0
0
1
0
1
0
0
1 0
0
0
1 0
.
For N = 8 we have seven matrices with elements 0, ±1 [9]. Let’s assume there is given a finite set of points of the curve, called further nodes (xi,yi)
R2
such as: 1. nodes (interpolation points) are settled at local extrema (maximum or minimum) of one of coordinates and at least one point between two successive local extrema; 2. each node (xi,yi) is monotonic in coordinates xi or yi (for example equidistance in one of coordinates). Assume that the nodes belong to a curve in the plane. How the whole curve could be reconstructed using this discrete set of nodes? Proposed method [4], [5] is based on local, orthogonal matrix operators. Values of nodes’ coordinates (xi,yi) are connected with HR matrices [3] build on N dimensional vector space. It is important that HR matrices are skewsymmetric and only for dimension N = 2, 4 or 8 columns and rows of HR matrices are orthogonal [7]. If one curve is described by a set of nodes {(xi,yi), i = 1,2,…,n} monotonic (for example equidistance) in coordinates xi, then HR matrices combined with identity matrix are used to build an orthogonal and discrete Hurwitz-Radon Operator (OHR). For nodes (x1,y1), (x2,y2) OHR of dimension N = 2 is constructed: x1
1
M
x1
2
x2
2
x2
x2
y1
x1
y2
y2
.
(2)
y1
For nodes (x1,y1), (x2,y2), (x3,y3), (x4,y4) monotonic in xi OHR of dimension N = 4 is constructed: u0 M
1 x1
2
x2
2
x3
2
x4
2
u1 u2 u3
where
u1
u2
u3
u0 u3
u3 u0
u2 u1
u1
u0
u2
(3)
u0 u2
x1 y1
x2 y 2
x3 y 3
x4 y 4 ,
u1
x1 y 2
x 2 y1
x1 y3
x2 y 4
x3 y1
x4 y 2 ,
u3
x1 y 4
x2 y3
x3 y 4
x3 y 2
x4 y3 ,
x 4 y1 .
For nodes (x1,y1), (x2,y2), …, (x8,y8) monotonic in xi OHR M of dimension N = 8 is built [4] similarly as (3). Note that OHR operators (2)-(3) satisfy Mx=y for x = (x1,x2…,xN)
RN, x
RN, y
0, y = (y1,y2…,yN)
0 , N = 2, 4 or 8.
If one curve is described by a set of nodes {(xi,yi), i = 1,2,…,n} monotonic (for example equidistance) in coordinates yi, then HR matrices combined with identity matrix are used to build an orthogonal and discrete reverse Hurwitz-Radon Operator (reverse OHR). For nodes (x1,y1), (x2,y2) reverse OHR of dimension N = 2 is constructed: M
x1
1
1
y1
2
y2
2
x2
x2
x1
y1
y2
y2
y1
.
(4)
For nodes (x1,y1), (x2,y2), (x3,y3), (x4,y4) monotonic in yi the reverse OHR of dimension N = 4 is constructed for ui in (3):
M
1
1
y1
2
y2
2
y3
2
y4
2
u0
u1
u1 u2
u0 u3
u3
u2
u2 u3 u0 u1
u3 u2 . u1
(5)
u0
For nodes (x1,y1), (x2,y2), …, (x8,y8) monotonic in yi the reverse OHR M-1 of dimension N = 8 is built [4] similarly as (5). Note that reverse OHR operators (4)-(5) satisfy M-1 y = x for x = (x1,x2…,xN)
RN, x
0, y = (y1,y2…,yN)
RN, y
0 , N = 2, 4 or 8.
How can we compute coordinates of points settled between interpolation nodes? On a segment of a line every number “c” situated between “a” and “b” is described by a linear (convex) combination c =
a+(1- ) b for b c b a
[0;1].
(6)
When the nodes are monotonic in coordinates xi, average OHR operator M2 of dimension N = 2, 4 or 8 is constructed as follows: M2
M0
(1
) M1
(7)
with the operator M0 built (2)-(3) by “odd” nodes (x1=a,y1), (x3,y3), …, (x2N-1,y2N-1) and M1 built (2)-(3) by “even” nodes (x2=b,y2), (x4,y4), …, (x2N,y2N). When the nodes are monotonic in coordinates yi, average reverse OHR operator M2-1 of dimension N = 2, 4 or 8 is constructed as follows: M2
with
the
reverse
operator
1
M0
M0-1
1
(1
built
) M1
(4)-(5)
1
by nodes
(8) (x1,y1=a),
(x3,y3),
…,
(x2N-1,y2N-1) and M1-1 built (4)-(5) by nodes (x2,y2=b), (x4,y4), …, (x2N,y2N). Notice that having the operator M2 for coordinates xi < xi+1 it is possible to reconstruct the second coordinates of points (x,y) in terms of the vector C defined with ci =
for i = 1,2,…,N
x2i-1+(1- ) x2i
(9)
as C = [c1, c2,…, cN]T. The required formula is Y (C )
(10)
M2 C
in which components of vector Y(C) give the second coordinate of the points (x,y) corresponding to the first coordinate, given in terms of components (9) of the vector C. On the other hand, having the operator M2-1 for coordinates yi < yi+1 it is possible to reconstruct the first coordinates of points (x,y) in terms of the corresponding second coordinates given by components of the new vector C defined, as previously, with ci =
y2i-1+(1- ) y2i
i = 1,2,…,N
for
(11)
and C = [c1, c2,…, cN]T. The final formula is X (C )
M2
1
C
(12)
in which components of the vector X(C) give the first coordinate of the points (x,y) corresponding to the second coordinate, given in terms of components (11) of the vector C. After computing (10) or (12) for any
[0;1], we have a half of reconstructed points
(j = 1 in Algorithm 1). Now it is necessary to find second half of unknown coordinates (j = 2 in Algorithm 1) for ci =
x2i+(1- ) x2i+1
ci =
y2i+(1- ) y2i+1
, i = 1,2,…,N
(13)
i = 1,2,…,N.
(14)
or ,
depending on whether xi or yi is monotonic. There is no need to build the OHR for nodes (x2=a,y2), (x4,y4), …, (x2N,y2N) or the reverse OHR for nodes (x2,y2=a), (x4,y4), …, (x2N,y2N), because we just find M1 or M1-1. This operator will play as role as M0 or M0-1 in (7) or (8). New M1 or M1-1 must be computed for nodes (x3=b,y3), …, (x2N-1,y2N-1), (x2N+1,y2N+1) or (x3,y3=b), …, (x2N-1,y2N-1), (x2N+1,y2N+1). As we see the minimum number of interpolation nodes n = 2N+1 = 5, 9 or 17 using OHR operators of dimension N = 2, 4 or 8 respectively. If there is more nodes than 2N+1, the same calculations (6)-(14) have to be done for next range(s) or last range of 2N+1 nodes. For example, if n = 9 then we can use OHR operators of dimension N = 4 or OHR operators of dimension N = 2 for two subsets of nodes: {(x1,y1), …,(x5,y5)} and {(x5,y5), …,(x9,y9)}. We summarize this section in the following algorithm of points reconstruction for 2N+1 = 5, 9 or 17 successive nodes. Algorithm 1: let j = 1. Input: Set of interpolation nodes {(xi,yi), i = 1,2,…,n; n = 5, 9 or 17} such as: a) nodes are settled at local extrema (maximum or minimum) of one of coordinates and at least one point between two successive local extrema; b) nodes (xi,yi) are monotonic in coordinates xi or yi. Step 1. Determine the dimension N of OHR operators: N = 2 if n = 5, N = 4 if n = 9, N = 8 if n = 17. Step 2. If nodes are monotonic in xi then build M0 for nodes (x1=a,y1), (x3,y3), …, (x2N-1,y2N-1) and M1 for nodes (x2=b,y2), (x4,y4), …, (x2N,y2N) from (2)-(3). If nodes are monotonic in yi then build M0-1 for nodes (x1,y1=a), (x3,y3), …, (x2N-1,y2N-1) and M1-1 for nodes (x2,y2=b), (x4,y4), …, (x2N,y2N) from (4)-(5). Step 3. Determine the number of points to be reconstructed Kj > 0 between two successive nodes, let k = 1. Step 4. Compute
[0;1] from (6) for c1 = c =
a+(1- ) b.
-1
Step 5. Build M2 from (7) or M2 from (8). Step 6. Compute vector C = [c1, c2,…, cN] T from (9) or (11). Step 7. Compute unknown coordinates Y(C) from (10) or X(C) from (12). Step 8. If k < Kj , set k = k+1 and go to Step 4. Otherwise if j = 1, set M0 = M1, a = x2, b = x3 (if nodes monotonic in xi) or M0-1 =M1-1, a = y2, b = y3 (if nodes monotonic
in
yi),
build
new
M1
or
M1-1
for
(x2N+1,y2N+1), let j = 2 and go to Step 3. Otherwise, stop.
nodes
(x3,y3),
(x5,y5),
…,
The number of reconstructed points in Algorithm 1 is K = N(K1+K2). If there is more nodes than 2N+1 = 5, 9 or 17, Algorithm 1 has to be done for next range(s) or last range of 2N+1 nodes. Reconstruction of curve points using Algorithm 1 is called by author the method of Hurwitz-Radon Matrices (MHR).
Complexity of MHR calculations and graphical example In this section we consider the number of multiplications and divisions for MHR method during reconstruction of K = L - n points having n interpolation nodes of the curve consists of L points. First we present a formula for computing one unknown coordinate of a single point. Assume there are given four nodes (x1,y1), (x2,y2), (x3,y3) (x4,y4) monotonic in xi. OHR operators of dimension N = 2 are built (2) as follows: M0
1 x1
2
x3
2
x1 y1 x1 y 3
x3 y 3 x3 y1
x3 y1 x1 y1
x1 y 3 x3 y 3
1
M1
x2
,
2
x4
2
x2 y 2
x4 y 4
x4 y 2
x2 y 4
x2 y 4
x4 y 2
x2 y 2
x4 y 4
.
Let first coordinate c1 of reconstructed point is situated between x1 and x2: c1 =
x1+ x2
for
0
=1-
1.
(15)
Compute second coordinate of reconstructed point y(c1) for Y(C) = [y(c1), y(c2)]T from (10): y (c1 ) y (c 2 )
(
M0
x1 x3
x2 . x4
x 2 x3 y 3
x 3 x 4 y1
M1)
(16)
After calculation (16): y (c1 )
2
2
y1
y2
x2
2
x1
x4
2
2
x3
2
( x1 x 2 y1
( x1 x 2 y 2
x1 x 4 y 4
x3 x 4 y 2
x1 x 4 y 3 )
(17)
x 2 x3 y 4 ).
So each point of the curve P = (c1, y(c1)) settled between nodes (x1,y1) and (x2,y2) is parameterized by P( ) for (15), (17) and
[0;1]. Similar calculations could be done for
nodes (x1,y1), (x2,y2), (x3,y3) (x4,y4) monotonic in yi to compute x(c1): M0
1
1
y1
2
y3
2
x1 y1 x3 y3 x1 y3 x3 y1
x(c1 )
x3 y1 x1 y3 x1 y1 x3 y3 2
x1
2
M1
y2
, x2
y1
x2 y 2
1
1
2
2
y3
y4
r
2 1
2
x4 y 4
x2 y 4
y2
2
y4
x4 y 2
2
r2
x4 y 2 x2 y 2
x2 y 4 x4 y 4
,
(18)
for r1 = const., r2 = const. depending on nodes’ coordinates: see (17). If nodes are monotonic in yi, there is parameterization of curve points P settled between nodes (x1,y1) and (x2,y2): P( ) = (x(c1), c1) for
[0;1].
If nodes (xi,yi) are equidistance in coordinate xi or yi, then parameterization of unknown coordinate (17)-(18) is simpler. Let four successive nodes (x1,y1), (x2,y2), (x3,y3), (x4,y4) are equidistance in coordinate xi and a = x1, h/2 = xi+1 - xi = const. Calculations (16)(17) are done for c1 (15):
y(c1 )
y1
y2
s
(19)
and s
h(
2ay1 hy1 hy3 4a 2 4ah 2h 2
2ay2 4a 2
2hy2 hy4 ). 8ah 5h 2
(20)
As we can see in (19)-(20), MHR interpolation is not a linear interpolation. It is possible to estimate the interpolation error of MHR method (Algorithm 1) for the class of linear function f:
f (c1 ) y(c1 )
y1
y2
y(c1 )
Notice that estimation (21) has the biggest value 0.25 s for
s. =
(21) = 0.5, when c1 is situated in
the middle between x1 and x2. The goal of this paper is not a reconstruction of single point, like for example (15) and (17), but interpolation of curve consists of L points. If we have n interpolation nodes, then there is K = L – n points to find using Algorithm 1 and MHR method. Now we consider the complexity of MHR calculations. Lemma 1. Let n = 5, 9 or 17 is the number of interpolation nodes, let MHR method (Algorithm 1) is done for reconstruction of the curve consists of L points. Then MHR method is connected with the computational cost of rank O(L). Proof. Using Algorithm 1 we have to reconstruct K = L – n points of unknown curve. Counting the number of multiplications and divisions D in Algorithm 1 here are the results: 1) D = 4L+7
for n = 5 and L = 2i + 5;
2) D = 6L+21 for n = 9 and L = 4i + 9; 3) D = 10L+73 for n = 17 and L = 8i + 17; i = 2,3,4...
The lowest computational cost appears in MHR method with five nodes and OHR operators of dimension N = 2. Therefore whole set of n nodes can be divided into subsets of five nodes.
Then whole curve is to be reconstructed by Algorithm 1 with all subsets of five nodes: {(x1,y1),…,(x5,y5)},{(x5,y5),…,(x9,y9)},{(x9,y9), …, (x13,y13)}… If the last node (xn,yn) is indexed n ≠ 4i +1 then we have to use last five nodes {(xn-4,yn-4), …, (xn,yn)} in Algorithm 1. Function f(x) = 1/x is an example when the graph of interpolated function differs from the shape of polynomials considerably. Then classical interpolation is very hard because of existing local extrema of polynomial. Here is the application of Algorithm 1 for this function and nine nodes equidistance in second coordinate: y = 0.2, 0.4, 0.6, 0.8, 1, 1.2, 1.4, 1.6, 1.8.
Figure 1 - Twenty two interpolated points of function f(x) = 1/x using MHR method (Algorithm 1) together with 9 nodes
Lagrange interpolation polynomial for function f(x) = 1/x and nodes (5;0.2), (5/3;0.6), (1;1), (5/7;1.4), (5/9;1.8) has one minimum and two roots.
Figure 2 – Lagrange interpolation polynomial for nodes (5;0.2), (5/3;0.6), (1;1), (5/7;1.4), (5/9;1.8) differs extremely from the shape of function f(x) = 1/x
Summary The method of Hurwitz-Radon Matrices (Algorithm 1) leads to curve interpolation depending on the number of nodes and location of nodes. No characteristic features of curve are important in MHR method: failing to be differentiable at any point, the Runge’s phenomenon or differences from the shape of polynomials. These features are very significant for classical polynomial interpolations. MHR method gives the possibility of reconstruction a curve consists of several parts, for example closed curve (contour). The only condition is to have a set of nodes for each part of a curve or contour according to assumptions in Algorithm 1.
Curve modeling by MHR method is connected with possibility of changing the nodes coordinates and reconstruction of new curve or contour for new set of nodes, no matter what shape of curve or contour is to be reconstructed. Main features of MHR method are: 1) accuracy of curve reconstruction depending on number of nodes and method of choosing nodes; 2) reconstruction of curve consists of L points is connected with the computational cost of rank O(L); 3) Algorithm 1 is dealing with local operators: average OHR operators M2 or M2-1 (7)-(8) are built by successive 4, 8 or 16 nodes, what is connected with smaller computational costs then using all nodes. Future works are connected with: geometrical transformations of curve (translations, rotations, scaling)- only nodes are transformed and new curve (for example contour of the object) for new nodes is reconstructed; estimation of curve length; possibility to apply MHR method to three-dimensional curves [4], [5].
Bibliography: 1. Citko W., Jakóbczak D., Sieńko W.: On Hurwitz-Radon Matrices Based Signal Processing, Signal Processing’2005, Poznań, 19-24, 2005. 2. Dahlquist G., Bjoerck A.: Numerical methods, Englewood Cliffs N. J., Prentice-Hall, 1974. 3. Eckmann B.: Topology, algebra, analysis- relations and missing links, Notices of AMS, vol. 46(5), 520-527, 1999. 4. Jakóbczak D.: 2D and 3D Image Modeling Using Hurwitz-Radon Matrices, Polish Journal of Environmental Studies, vol. 16(4A), 104-107, 2007. 5. Jakóbczak D., Kosiński W.: Hurwitz-Radon Operator in Monochromatic Medical Image Reconstruction, Journal of Medical Informatics & Technologies, vol.11, 69-78, 2007. 6. Jankowska J., Jankowski M.: Survey of numerical methods and algorithms (Part I), Wydawnictwa Naukowo-Techniczne, Warsaw, 1981 [in Polish]. 7. Lang S:. Algebra, Addison-Wesley Publishing Company, 1970. 8. Ralston A.: A first course in numerical analysis, McGraw-Hill Book Company, 1965. 9. Sieńko W., Citko W., Jakóbczak D.: Learning and System Modeling via Hamiltonian Neural Networks, Lecture Notes on Artificial Intelligence, Springer-Verlag: Berlin Heidelberg, vol. 3070, 266-271, 2004.
Interpolacja krzywej za pomocą macierzy Hurwitza-Radona Streszczenie Informatyka wymaga odpowiednich metod rekonstrukcji krzywych. Klasyczne metody, takie jak interpolacja Lagrange’a lub Newtona, mają wiele słabych stron: są bezużyteczne do interpolacji funkcji nie posiadającej pochodnej choćby w jednym punkcie lub różniącej się znacząco kształtem od wielomianu. Nie można zapomnieć o zjawisku Rungego. Zagadnienie interpolacji krzywej wymaga specyficznych metod. Jedna z nich, nazwana metodą Macierzy Hurwitza-Radona (MHR), może zostać użyta w rekonstrukcji i interpolacji krzywych płaskich. Praca jest efektem badań autora nad rozprawą doktorską. Omawiana metoda jest oparta na rodzinie macierzy Hurwitza-Radona (HR). Macierze HR są skośno-symetryczne i składają się z kolumn tworzących ortogonalne wektory. W pracy opisano operator HurwitzaRadona (OHR), zbudowany z macierzy HR. Pokazano jak konstruować ortogonalny i dyskretny OHR oraz jak wykorzystać go w procesie interpolacji krzywej. Zbiór macierzy, złożony z N-1 macierzy HR oraz macierzy identycznościowej, jest ortogonalny tylko w przestrzeni wektorowej wymiaru N = 2, 4 oraz 8. Ortogonalność kolumn i wierszy jest ważnym czynnikiem stabilności i dokładności obliczeń. Metoda MHR interpoluje krzywą punkt po punkcie bez użycia wzoru funkcji opisującej krzywą. Główne cechy metody MHR to: dokładność rekonstrukcji krzywej zależy od liczby węzłów i sposobu wyboru węzłów, interpolacja krzywej złożonej z L pikseli posiada złożoność obliczeniową rzędu O(L), interpolacja MHR nie jest interpolacją liniową. Słowa kluczowe: interpolacja krzywej, rekonstrukcja konturu, macierze Hurwitza-Radona, algorytmy Wstęp Następujące pytanie jest ważne w informatyce i matematyce: czy możliwe jest znalezienie metody interpolacji krzywej płaskiej bez szukania wielomianu interpolacyjnego? Celem pracy jest podanie twierdzącej odpowiedzi na to pytanie. Praca jest efektem badań autora nad rozprawą doktorską. Współczesne metody interpolacji krzywej oparte są na klasycznej interpolacji wielomianowej: wielomiany Newtona, Lagrange’a lub Hermite’a oraz krzywe sklejane, które są kawałkami wielomianami [2], [6]. Klasyczne metody są bezużyteczne do interpolacji funkcji nie posiadającej pochodnej choćby w jednym punkcie, np. funkcja wartości bezwzględnej f(x)= x w punkcie x = 0. Jeżeli punkt (0;0) jest jednym z węzłów interpolacji, wówczas dokładna interpolacja wielomianowa dla tej funkcji jest niemożliwa. Również jeżeli wykres funkcji różni się znacząco kształtem od wielomianu, np. f(x)=1/x,
interpolacja jest bardzo utrudniona z powodu istnienia lokalnych ekstremów wielomianu. Nie można zapomnieć o zjawisku Rungego: jeżeli węzły interpolacji są równoodległe, wtedy wielomian wysokiego stopnia oscyluje w okolicach końca przedziału, np. blisko -1 i 1 dla funkcji f(x)=1/(1+25x2) [8]. W pracy zajęto się problemem interpolacji bez wyznaczania wzoru wielomianu lub innej funkcji. Wartości węzłów są użyte do budowania ortogonalnego operatora macierzowego i liniowa (wypukła) kombinacja operatorów OHR prowadzi do obliczenia punktów krzywej. Główną ideą metody MHR jest fakt, iż krzywa jest interpolowana punkt po punkcie dzięki obliczaniu nieznanych współrzędnych punktów. Jedynymi istotnymi czynnikami metody MHR są: wybór węzłów i ustalenie wymiaru macierzy HR (N = 2, 4 lub 8). Inne cechy charakterystyczne funkcji czy krzywej, takie jak kształt czy podobieństwo wykresu do wielomianu, różniczkowalność lub zjawisko Rungego, nie są istotne w procesie interpolacji MHR. Krzywa czy funkcja jest w metodzie MHR parametryzowana wartością
[0;1] w
przedziale pomiędzy dwoma sąsiednimi węzłami interpolacji. W pracy opisano algorytm obliczeniowy i należy rozważyć czas jego działania. Złożoność obliczeń jednego nieznanego punktu w interpolacji Lagrange’a lub Newtona, opartej na n węzłach, jest obarczona liczbą działań O(n2). Złożoność obliczeń dla L nieznanych punktów w interpolacji MHR, opartej na n węzłach, jest obarczona liczbą działań O(L). Jest to istotna cecha metody MHR.
Metoda Macierzy Hurwitza-Radona Adolf Hurwitz (1859-1919) oraz Johann Radon (1887-1956) opublikowali prace na temat szczególnych rodzajów macierzy w roku 1923. Macierze Ai, i = 1,2…m spełniające AjAk+AkAj = 0,
Aj2 = -I
j ≠ k;
dla
j, k = 1,2...m
(1)
nazywane są rodziną macierzy Hurwitza-Radona. Rodzina macierzy HR (1) posiada następujące cechy: macierze HR są skośnosymetryczne (AiT= - Ai) i macierz odwrotna Ai-1 = - Ai. Tylko dla wymiaru N = 2, 4 lub 8 rodzina macierzy Hurwitza-Radona składa się z N-1 macierzy [1]. Dla N = 2 istnieje jedna macierz HR:
A1
0
1
.
1 0
Dla N = 4 istnieją trzy macierze HR o elementach całkowitych:
0 A1
1 0
0
1 0 0
0
0
0 0
0
0 1
, A2
1
0
0
1 0
0
0
0 1
0
0 0
1 0
0
, A3
1 0 0
0
0
0
0
0
1
0
1
0
0
1 0
0
0
1 0
.
Dla N = 8 mamy siedem macierzy HR o elementach 0, ±1 [9]. Załóżmy, iż dany jest skończony zbiór punktów krzywej, zwanych dalej węzłami (xi,yi) R2 taki, że: 1. węzły (punkty interpolacji) znajdują się w lokalnych ekstremach (maksimum lub minimum) jednej ze współrzędnych oraz w przynajmniej jednym punkcie leżącym między sąsiednimi lokalnymi ekstremami; 2. każdy węzeł (xi,yi) jest monotoniczny we współrzędnej xi lub yi (np. równoodległy względem jednej współrzędnej). Założono, iż węzły należą do krzywej na płaszczyźnie. W jaki sposób cała krzywa może zostać odtworzona z wykorzystaniem dyskretnego zbioru węzłów? Proponowana metoda [4], [5] oparta jest na lokalnych, ortogonalnych operatorach macierzowych. Wartości współrzędnych węzłów (xi,yi) są powiązane z macierzami HR [3] zbudowanymi na N wymiarowej przestrzeni wektorowej. Istotny jest fakt, że macierze HR są skośno-symetryczne i tylko dla wymiaru N = 2, 4 lub 8 kolumny i wiersze macierzy HR są ortogonalne [7]. Jeżeli krzywa opisana jest zbiorem węzłów {(xi,yi), i = 1,2,…,n} monotonicznych (np. równoodległych) we współrzędnej xi, wówczas kombinacja liniowa macierzy HR oraz macierzy identycznościowej posłuży do zbudowania ortogonalnego i dyskretnego operatora Hurwitza-Radona (OHR). Dla węzłów (x1,y1), (x2,y2) OHR wymiaru N = 2 jest następujący: x1
1
M
x1
2
x2
2
x2
x2
y1
x1
y2
y2
.
(2)
y1
Dla węzłów (x1,y1), (x2,y2), (x3,y3), (x4,y4) monotonicznych w xi OHR wymiaru N = 4 jest konstruowany: u0 M
1 x1
2
x2
2
x3
2
x4
2
u1 u2 u3
u1
u2
u3
u0 u3
u3 u0
u2 u1
u1
u0
u2
(3)
gdzie u0 u2
x1 y1
x2 y 2
x3 y 3
x4 y 4 ,
u1
x1 y 2
x 2 y1
x1 y3
x2 y 4
x3 y1
x4 y 2 ,
u3
x1 y 4
x2 y3
x3 y 4
x3 y 2
x4 y3 ,
x 4 y1 .
Dla węzłów (x1,y1), (x2,y2), …, (x8,y8) monotonicznych w xi OHR M wymiaru N = 8 budowany jest [4] analogicznie jak (3). Zauważmy, iż operatory OHR (2)-(3) spełniają Mx=y dla x = (x1,x2…,xN)
RN, x
RN, y
0, y = (y1,y2…,yN)
0 , N = 2, 4 lub 8.
Jeżeli krzywa opisana jest zbiorem węzłów {(xi,yi), i = 1,2,…,n} monotonicznych (np. równoodległych) we współrzędnej yi, wówczas kombinacja liniowa macierzy HR oraz macierzy identycznościowej posłuży do zbudowania ortogonalnego i dyskretnego odwrotnego operatora Hurwitza-Radona (odwrotny OHR). Dla węzłów (x1,y1), (x2,y2) odwrotny OHR wymiaru N = 2 jest następujący: x1
1
1
M
y1
2
y2
2
x2
x2
x1
y1
y2
y2
y1
.
(4)
Dla węzłów (x1,y1), (x2,y2), (x3,y3), (x4,y4) monotonicznych w yi odwrotny OHR wymiaru N = 4 jest zbudowany dla ui jak w (3):
M
1
1
y1
2
y2
2
y3
2
y4
2
u0
u1
u1 u2
u0 u3
u3
u2
u2 u3 u0 u1
u3 u2 . u1
(5)
u0
Dla węzłów (x1,y1), (x2,y2), …, (x8,y8) monotonicznych w yi odwrotny OHR M-1 wymiaru N = 8 budowany jest [4] analogicznie jak (5). Zauważmy, iż operatory odwrotne OHR (4)-(5) spełniają M-1 y = x dla x = (x1,x2…,xN)
RN, x
0, y = (y1,y2…,yN)
RN, y
0 , N = 2, 4 lub 8.
W jaki sposób można wyznaczyć współrzędne punktów znajdujących się między węzłami? Na odcinku prostej każda liczba “c” umiejscowiona pomiędzy “a” i “b” opisana jest liniową (wypukłą) kombinacją c =
a+(1- ) b dla b c b a
[0;1].
(6)
Jeżeli węzły są monotoniczne we współrzędnej xi, średni operator OHR M2 wymiaru N = 2, 4 lub 8 jest konstruowany następująco: M2
M0
(1
) M1
(7)
dla operatora M0 zbudowanego (2)-(3) z węzłów o indeksach nieparzystych (x1=a,y1), (x3,y3), …, (x2N-1,y2N-1) oraz M1 zbudowanego (2)-(3) z węzłów o indeksach parzystych (x2=b,y2), (x4,y4), …, (x2N,y2N). Jeżeli węzły są monotoniczne we współrzędnej yi, średni odwrotny OHR M2-1 wymiaru N = 2, 4 lub 8 jest budowany następująco: M2
1
M0
1
(1
) M1
1
(8)
dla odwrotnego operatora M0-1 wyznaczonego (4)-(5) z węzłów (x1,y1=a), (x3,y3), …, (x2N-1,y2N-1) oraz M1-1 obliczonego (4)-(5) z węzłów (x2,y2=b), (x4,y4), …, (x2N,y2N). Mając operator M2 znaleziony dla współrzędnych xi < xi+1 możliwe jest odtworzenie drugich współrzędnych punktów (x,y) z wykorzystaniem wektora C definiowanego ze składnikami ci =
dla i = 1,2,…,N
x2i-1+(1- ) x2i
(9)
jako C = [c1, c2, …,cN]T. Formuła obliczeń to Y (C )
(10)
M2 C
w której elementy wektora Y(C) oznaczają drugą współrzędną punktów (x,y) odpowiadającą pierwszej współrzędnej, danej jako składnik (9) wektora C. Z drugiej strony, mając operator M2-1 dla współrzędnych yi < yi+1 możliwe jest znalezienie pierwszych współrzędnych punktów (x,y) w terminach odpowiednich drugich współrzędnych, danych jako składniki nowego wektora C definiowanego ci =
y2i-1+(1- ) y2i
i = 1,2,…,N
dla
(11)
oraz C = [c1, c2, …,cN]T. Wzór obliczeń to X (C )
M2
1
(12)
C
w której elementy wektora X(C) oznaczają pierwszą współrzędną punktów (x,y) odpowiadającą drugiej współrzędnej, danej jako składnik (11) wektora C. [0;1] zrekonstruowano połowę punktów
Po obliczeniach (10) lub (12) dla dowolnego
(j = 1 w Algorytmie 1). Należy teraz znaleźć drugą połowę nieznanych współrzędnych (j = 2 w Algorytmie 1) dla ci =
x2i+(1- ) x2i+1
ci =
y2i+(1- ) y2i+1
, i = 1,2,…,N
(13)
i = 1,2,…,N.
(14)
lub ,
w zależności od monotoniczności xi lub yi. Nie ma potrzeby budować OHR dla węzłów (x2=a,y2), (x4,y4), …, (x2N,y2N) ani odwrotny OHR dla (x2,y2=a), (x4,y4), …, (x2N,y2N), ponieważ znaleziono już M1 czy M1-1. Ten operator pełni rolę M0 lub M0-1 w (7) albo (8). Nowy M1 or M1-1 musi zostać wyznaczony dla węzłów (x3=b,y3), …, (x2N-1,y2N-1), (x2N+1,y2N+1) lub (x3,y3=b), …, (x2N-1,y2N-1), (x2N+1,y2N+1). Jak widać najmniejsza liczba węzłów wynosi n = 2N+1 = 5, 9 lub 17 przy użyciu operatorów OHR wymiaru N = 2, 4 lub 8 odpowiednio. Jeżeli liczba węzłów przewyższa 2N+1, obliczenia (6)-(14) należy wykonać dla następnego, a w końcu ostatniego, przedziału 2N+1 węzłów. Przykład: dla n = 9 można użyć OHR wymiaru N = 4 lub operatory OHR wymiaru N = 2 w dwóch podzbiorach węzłów: {(x1,y1), …,(x5,y5)} i {(x5,y5), …,(x9,y9)}. Jako podsumowanie rozdziału przedstawiono algorytm rekonstrukcji punktów dla 2N+1 = 5, 9 lub 17 kolejnych węzłów. Algorytm 1: niech j = 1. Na wejściu: Zbiór węzłów interpolacji {(xi,yi), i = 1,2,…,n; n = 5, 9 lub 17} spełniających: a) węzły znajdują się w lokalnych ekstremach (maksimum lub minimum) jednej ze współrzędnych oraz w przynajmniej jednym punkcie leżącym między sąsiednimi lokalnymi ekstremami; b) węzły (xi,yi) są monotoniczne we współrzędnej xi lub yi. Krok 1. Określ wymiar N operatorów OHR: N = 2 dla n = 5, N = 4 dla n = 9, N = 8 dla n = 17. Krok 2. Jeżeli węzły są monotoniczne w xi, zbuduj M0 dla (x1=a,y1), (x3,y3), …, (x2N-1,y2N-1)
oraz
M1
dla
(x2=b,y2),
(x4,y4),
…,
Jeżeli węzły są monotoniczne w yi, zbuduj M0
-1
(x2N,y2N)
jak
w
(2)-(3).
dla (x1,y1=a), (x3,y3), …,
(x2N-1,y2N-1) oraz M1-1 dla (x2,y2=b), (x4,y4), …, (x2N,y2N) jak w (4)-(5). Krok 3. Podaj liczbę punktów do rekonstrukcji Kj > 0 pomiędzy dwoma kolejnymi węzłami, niech k = 1. Krok 4. Wyznacz
[0;1] z (6) dla c1 = c =
a+(1- ) b.
Krok 5. Buduj M2 jak (7) lub M2-1jak (8). Krok 6. Wyznacz wektor C = [c1, c2,…, cN] T z (9) lub (11). Krok 7. Oblicz nieznane współrzędne Y(C) jak (10) lub X(C) jak (12). Krok 8. Jeżeli k < Kj , podstaw k = k+1 i przejdź do Kroku 4. W przeciwnym wypadku: jeżeli j = 1, podstaw M0 = M1, a = x2, b = x3 (węzły monotoniczne w xi) lub M0-1 =M1-1, a = y2, b = y3 (węzły monotoniczne w yi), zbuduj nowy M1 lub M1-1 dla (x3,y3), (x5,y5), …, (x2N+1,y2N+1), podstaw j = 2 i przejdź do Kroku 3. W przeciwnym razie stop.
Liczba zrekonstruowanych punktów w Algorytmie 1 wynosi K = N(K1+K2). Jeżeli węzłów jest więcej niż 2N+1 = 5, 9 lub 17, Algorytm 1 należy wykonać dla następnego i w efekcie ostatniego przedziału 2N+1 węzłów. Rekonstrukcję punktów krzywej za pomocą Algorytmu 1 autor nazwał metodą Macierzy Hurwitza-Radona (MHR).
Złożoność obliczeń MHR i graficzny przykład Złożoność obliczeniowa zostanie rozważona jako liczba mnożeń i dzieleń w metodzie MHR podczas rekonstrukcji K = L - n punktów przy n węzłach interpolacji dla krzywej złożonej z L punktów. Najpierw przedstawiono wzór na obliczenie jednej nieznanej współrzędnej dla pojedynczego punktu. Załóżmy, iż dano cztery węzły (x1,y1), (x2,y2), (x3,y3) (x4,y4) monotoniczne w xi. Operatory OHR wymiaru N = 2 są budowane (2) następująco: M0
1 x1
2
x3
2
x1 y1 x1 y 3
x3 y 3 x3 y1
x3 y1 x1 y1
x1 y 3 x3 y 3
1
M1
x2
,
2
x4
2
x2 y 2
x4 y 4
x4 y 2
x2 y 4
x2 y 4
x4 y 2
x2 y 2
x4 y 4
.
Niech pierwsza współrzędna c1 odtwarzanego punktu znajduje się między x1 i x2: c1 =
x1+ x2
dla
0
=1-
1.
(15)
Oblicz drugą współrzędną odtwarzanego punktu y(c1) dla Y(C) = [y(c1), y(c2)]T jak (10): y (c1 ) y (c 2 )
(
M0
x1 x3
x2 . x4
x 2 x3 y 3
x 3 x 4 y1
M1)
(16)
Po obliczeniach (16): y (c1 )
2
2
y1
y2
x2
2
x1
x4
2
2
x3
2
( x1 x 2 y1
( x1 x 2 y 2
x1 x 4 y 4
x3 x 4 y 2
x1 x 4 y 3 )
(17)
x 2 x3 y 4 ).
Tak więc każdy punkt krzywej P = (c1, y(c1)), umiejscowiony między węzłami (x1,y1) i (x2,y2), [0;1]. Podobne obliczenia można
jest sparametryzowany P( ) dla (15), (17) oraz
wykonać dla węzłów (x1,y1), (x2,y2), (x3,y3) (x4,y4) monotonicznych w yi i wyznaczyć x(c1): M0
1
1
y1
2
y3
2
x1 y1 x3 y3 x1 y3 x3 y1
x(c1 )
x3 y1 x1 y3 x1 y1 x3 y3 2
x1
2
M1
y2
, x2
y1
x2 y 2
1
1
2
2
y3
y4
r
2 1
2
x4 y 4
x2 y 4
y2
2
y4
x4 y 2
2
r2
x4 y 2 x2 y 2
x2 y 4 x4 y 4
,
(18)
dla r1 = const., r2 = const. uzależnionych od współrzędnych węzłów analogicznie jak w (17). Jeżeli węzły są monotoniczne w yi, istnieje więc parametryzacja punktów krzywej P położonych między węzłami (x1,y1) i (x2,y2): P( ) = (x(c1), c1) dla
[0;1].
Jeżeli węzły (xi,yi) są równoodległe we współrzędnej xi lub yi, wówczas parametryzacja nieznanej współrzędnej (17)-(18) jest prostsza. Załóżmy, że cztery kolejne węzły (x1,y1), (x2,y2), (x3,y3), (x4,y4) są równoodległe we współrzędnej xi oraz a = x1, h/2 = xi+1 - xi = const. Obliczenia (16)-(17) wykonano dla c1 (15):
y(c1 )
y1
y2
s
(19)
oraz s
h(
2ay1 hy1 hy3 4a 2 4ah 2h 2
2ay2 4a 2
2hy2 hy4 ). 8ah 5h 2
(20)
Jak widać w (19)-(20), interpolacja MHR nie jest liniową interpolacją. Oszacowano błąd interpolacji metodą MHR (Algorytm 1) w klasie funkcji liniowych f:
f (c1 ) y(c1 )
y1
y2
s.
y(c1 )
Oszacowanie (21) ma największą wartość 0.25 s dla
=
(21)
= 0.5, a więc kiedy c1 leży w
połowie między x1 and x2. Celem pracy nie jest rekonstrukcja pojedynczego punktu, jak np. (15) czy (17), ale interpolacja krzywej złożonej z L punktów. Jeżeli dano n węzłów interpolacji, wtedy należy znaleźć K = L – n punktów za pomocą Algorytmu 1 i metody MHR. Rozważmy złożoność obliczeń MHR. Lemat 1. Niech n = 5, 9 lub 17 jest liczbą węzłów interpolacji oraz niech metoda MHR (Algorytm 1) zostanie wykorzystana do rekonstrukcji krzywej złożonej z L punktów. Wówczas metoda MHR wiąże się ze złożonością obliczeniową rzędu O(L). Dowód. Używając Algorytmu 1 należy odtworzyć K = L – n punktów nieznanej krzywej. Zliczając liczbę D mnożeń i dzieleń w Algorytmie 1 wyniki są następujące: 1) D = 4L+7
dla n = 5 oraz L = 2i + 5;
2) D = 6L+21 dla n = 9 oraz L = 4i + 9; 3) D = 10L+73 dla n = 17 oraz L = 8i + 17; i = 2,3,4... Najniższy koszt obliczeń występuje w metodzie MHR z pięcioma węzłami i operatorami OHR wymiaru N = 2. Dlatego cały zbiór n węzłów najlepiej podzielić na podzbiory liczące pięć węzłów. Wtedy cała krzywa jest rekonstruowana wg Algorytmu 1 we wszystkich
podzbiorach pięciu węzłów: {(x1,y1),…,(x5,y5)},{(x5,y5),…,(x9,y9)},{(x9,y9), …, (x13,y13)}… Jeżeli ostatni węzeł (xn,yn) ma indeks n ≠ 4i +1, wówczas należy użyć pięciu ostatnich węzłów {(xn-4,yn-4), …, (xn,yn)} w Algorytmie 1. Funkcja f(x) = 1/x jest przykładem, kiedy wykres funkcji różni się znacząco kształtem od wielomianu. Klasyczna interpolacja jest bardzo utrudniona z powodu istnienia lokalnych ekstremów wielomianu. Oto zastosowanie Algorytmu 1 dla tej funkcji i dziewięciu węzłów równoodległych w drugiej współrzędnej: y = 0.2, 0.4, 0.6, 0.8, 1, 1.2, 1.4, 1.6, 1.8.
Rysunek 1 – Dwadzieścia dwa interpolowane punkty funkcji f(x) = 1/x wg metody MHR (Algorytm 1) oraz dziewięć węzłów Dla porównania wielomian interpolacyjny Lagrange’a funkcji f(x) = 1/x o węzłach: (5;0.2), (5/3;0.6), (1;1), (5/7;1.4) i (5/9;1.8) posiada minimum oraz dwa miejsca zerowe i jest absolutnie nie do przyjęcia.
Rysunek 2 – Wielomian interpolacyjny Lagrange’a funkcji f(x) = 1/x o węzłach: (5;0.2), (5/3;0.6), (1;1), (5/7;1.4) i (5/9;1.8)
Podsumowanie Metoda Macierzy Hurwitza-Radona (Algorytm 1) prowadzi do interpolacji krzywej w zależności od liczby węzłów oraz ich położenia. Inne cechy charakterystyczne funkcji czy krzywej, takie jak kształt czy podobieństwo wykresu do wielomianu, różniczkowalność lub zjawisko Rungego, nie są istotne w procesie interpolacji MHR. Cechy te są znaczące w klasycznej interpolacji wielomianowej. Metoda MHR daje możliwość rekonstrukcji krzywej złożonej z kilku części, np. krzywej zamkniętej (konturu). Jedynym warunkiem jest
posiadanie zbioru węzłów dla każdej części krzywej czy konturu zgodnie z założeniami Algorytmu 1. Modelowanie krzywej wg metody MHR jest związane z możliwością zmiany współrzędnych węzłów i odtworzeniem nowej krzywej czy konturu dla nowego zbioru węzłów, bez względu na kształt rekonstruowanej krzywej. Główne cechy metody MHR to: 1) dokładność rekonstrukcji krzywej zależy od liczby węzłów oraz sposobu wyboru węzłów; 2) interpolacja krzywej złożonej z L pikseli posiada złożoność obliczeniową rzędu O(L); 3) Algorytm 1 korzysta z lokalnych operatorów: średnie operatory OHR M2 lub M2-1 (7)-(8) są budowane z kolejnych 4, 8 lub 16 węzłów, co wiąże się z mniejszą złożonością obliczeniową niż użycie wszystkich węzłów interpolacji danej krzywej. Kierunki przyszłych prac to: przekształcenia geometryczne krzywej (przesunięcia, obroty, skalowanie)- tylko węzły są poddane przekształceniu i nowa krzywa (np. kontur obiektu) dla nowych
węzłów
jest
rekonstruowana;
przybliżenie
długości
krzywej;
możliwość
zastosowania metody MHR do krzywych trójwymiarowych [4], [5].
Bibliografia: 1. Citko W., Jakóbczak D., Sieńko W.: On Hurwitz-Radon Matrices Based Signal Processing, Signal Processing’2005, Poznań, 19-24, 2005. 2. Dahlquist G., Bjoerck A.: Numerical methods, Englewood Cliffs N. J., Prentice-Hall, 1974. 3. Eckmann B.: Topology, algebra, analysis- relations and missing links, Notices of AMS, vol. 46(5), 520-527, 1999. 4. Jakóbczak D.: 2D and 3D Image Modeling Using Hurwitz-Radon Matrices, Polish Journal of Environmental Studies, vol. 16(4A), 104-107, 2007. 5. Jakóbczak D., Kosiński W.: Hurwitz-Radon Operator in Monochromatic Medical Image Reconstruction, Journal of Medical Informatics & Technologies, vol.11, 69-78, 2007. 6. Jankowska J., Jankowski M.: Survey of numerical methods and algorithms (Part I), Wydawnictwa Naukowo-Techniczne, Warsaw, 1981 [in Polish]. 7. Lang S:. Algebra, Addison-Wesley Publishing Company, 1970. 8. Ralston A.: A first course in numerical analysis, McGraw-Hill Book Company, 1965. 9. Sieńko W., Citko W., Jakóbczak D.: Learning and System Modeling via Hamiltonian Neural Networks, Lecture Notes on Artificial Intelligence, Springer-Verlag: Berlin Heidelberg, vol. 3070, 266-271, 2004.