Egyptian Informatics Journal (2013) 14, 205-209

Cairo University Egyptian Informatics Journal

www.elsevier.com/locate/eij www.sciencedirect.com

EGYPTIAN

Informatics

JOURNAL

ORIGINAL ARTICLE

Rational trigonometric cubic spline to conserve convexity of 2D data

Farheen Ibraheem a,% Maria Hussain b, Malik Zawwar Hussain c

a National University of Computer and Emerging Sciences, Lahore, Pakistan b Lahore College for Women University, Lahore, Pakistan c Department of Mathematics, University of the Punjab, Lahore, Pakistan

Received 25 March 2013; revised 12 June 2013; accepted 7 July 2013 Available online 5 August 2013

KEYWORDS

Rational trigonometric cubic

function;

Free parameters;

Convex data;

Data visualization

Abstract Researchers in different fields of study are always in dire need of spline interpolating function that conserve intrinsic trend of the data. In this paper, a rational trigonometric cubic spline with four free parameters has been used to retain convexity of 2D data. For this purpose, constraints on two of free parameters b and yi in the description of the rational trigonometric function are derived while the remaining two a and dt are set free. Numerical examples demonstrate that resulting curves using the technique of the underlying paper are C1.

© 2013 Production and hosting by Elsevier B.V. on behalf of Faculty of Computers and Information,

Cairo University.

1. Introduction

Representation of data in the form of congenial curves and surfaces is of great importance in many areas of scientific research such as computer graphics and data visualization. This visual display of data provides prompt cognition and insight into data. Shape preservation and smoothness are the most desirable features required by a researcher in the field of data

* Corresponding author. Tel.: +92 42 99231444. E-mail addresses: farheen.butt@gmail.com (F. Ibraheem), mariahus-sain_1@yahoo.com (M. Hussain), malikzawwar.math@pu.edu.pk (M.Z. Hussain).

Peer review under responsibility of Faculty of Computers and

visualization. Spline interpolating function demonstrates the incredible result in this regard.

Properties that quantify shape of data are positivity, mono-tonocity, and convexity. Plenty of spline functions exist which can produce a smooth curve but inept to preserve the inherent shape of the given data. The motivation of this paper is to preserve the intrinsic attribute of data that is convexity.

Convexity pervades everyday life. Whether it is manufacturing of lenses, modeling of cars, analysis of indifference curves, nonlinear programming and approximation of functions, convexity stays the part and parcel of all. Loss of convexity is irreconcilable in all such practical problems.

Over the years, many milestones have been achieved in the field of shape preservation when data under consideration exhibit convex trend. Various schemes have been developed to reach the epitome of abstraction. Brodlie and Butt [1] preserved the convex shape of data by establishing a piecewise cubic function. Their scheme suffered the detriment of insertion of the additional knots in an interval where convexity is lost.

Information, Cairo University.

Production and hosting by Elsevier

1110-8665 © 2013 Production and hosting by Elsevier B.V. on behalf of Faculty of Computers and Information, Cairo University. http://dx.doi.Org/10.1016/j.eij.2013.07.001

Convexity preserving properties of rational Bezier and non-uniform rational B-spline were studied geometrically by Carnicer [2]. Explicit representation of rational cubic function with one free parameter was developed by Delbourgo and Gregory [3] to retain convexity. Passcow and Roulier [4] formed a spline interpolant by constructing an auxiliary set of points and using convexity preserving properties of Bernstein polynomials. Schumaker [5] preserved the convexity by piecewise quadratic polynomial which was economical but again an extra knot had to be inserted. A rational cubic function with two shape parameters was introduced by Sarfraz and Hussain [6] to retain convexity. Sarfraz et al. [7] developed rational cubic functions with four parameters. In [7], the authors derived the shape preserving constraints on two parameters and two parameters are left free for the user to refine the shape of the curves.

The algorithm presented in this paper is a noteworthy addition to already existing schemes and is a leap forward in many ways. The use of trigonometric function strengthens a designer to frame conics accurately. It does not require insertion of extra knots to conserve the intrinsic trend of the data. Four free parameters have been used in the specification of the rational trigonometric cubic spline. Constraints on two of free parameters are derived to envision convex data. The remaining two free parameters give enough freedom to the user for the refinement of convex shape of data according to the requirement.

The remainder of the paper is organized as follows. Section 2 is a review of the rational trigonometric cubic function [8] to be used for convexity. Section 3 deals with the development of convexity conserving constraints. In Section 4, numerical examples have been demonstrated. Section 5 summarizes the contributions and concludes the paper.

2. Rational trigonometric cubic function

Let {(xf), i = 0,1,2,..., n) be the given set of data points defined over the interval [a, b] where a = x0 < x1 < x2 < ■■■ < xn = b. A piecewise rational trigonometric cubic function is defined over each subinterval I, = [xi, X/+1J as

S-(x) =

p,(0) = afi(1 - sin 0)3 + {bfi + 2hpidi} sin 0(1 - sin 0)2

+ S Cif+i--p-f cos 0(1 - cos h)

+ dfi+1(1 - cos h)3,

q,(h) = a,(1 - sin h)3 + bi sin h(1 - sin h)2 + y, cos h(1 - cos h)2 + di(1 - cos h)3,

h ^ p (x h x'), hi = x,+1 - x,-, i = 0,1,2,..., n - 1.

The rational trigonometric cubic function (1) satisfies the following properties:

S(x,) =fi, S(x,+1) =/i+1, S(1)(x')=d', S<1)(xw)=dm.

d, and 1 are derivatives at the end points of the interval I, = [x,, x!+1], a,, b,, y, and d, are the free parameters.

3. Convex rational trigonometric cubic spline

In this section, problem of preserving convexity of 2D is addresses. For this purpose, constraints on free parameters in the description of rational trigonometric cubic function (1) are developed. Let the convex data set defined over the interval [a,b] be {(x,,fi), i = 0,1,2,...,n). The necessary condition for the convexity of data is

d < D1 < ... Di-1 < d < Di... < Dn-1 < dn.

The rational trigonometric cubic function (1) is convex if and only if S2(x) > 0, where

S?(x) =

2hi-(q,-(h))

■{A0 sin 6(1 - sin h)8 + A1 cos2 6(1 - sin 6

+ A2 sin2 h(1 - sin h)' + A3 sin h cos2 9(1 - sin h)6 + A4 sin h cos2 h( 1 - sin h)5 (1 - cos h) + A5 sin2 h cos h( 1 - sin h)6 + A6 sin h cos2 h(1 - sin B + A7 sin2 h(1 - sin h)6(1 - cos h) + A8 cos h(1 - sin h)6 (1 - cos h)2 + A9 sin3 h cos h( 1 - sin h)5 + A10 sin2 hcos2 h(1 - sin h)4(1 - cos h) + An sin3 h(1 - sin h)5(1 - cos h) + A12 sin2 h cos h(1 - sin h)4 (1 - cos h)2 + A13 sin h cos h(1 - sin h)5 (1 - cos h)2 + A14 cos3 h(1 - sin h)4(1 - cos h)2 + Ai5 cos3 h sin h(1 - sin h)3 (1 - cos h)2 + A16 cos h sin2 h(1 - sin h)3 (1 - cos h)3

+ An cos2 h(1 -

+ A18 cos2 h sin h(1 - sin h)3 (1 - cos B + A19 sin2 h(1 - sin h)3(1 - cos h)4

+ A20 cos2 h(1

+ A21 sin h(1 - sin h)5(1 - cos h)3 + A22 sin2 h(1 - sin h)4(1 - cos h)3 + A23 cos h(1 - sin h)3 (1 - cos h)5 + A24 sin3 h(1 - sin h)6 + A25 sin2 h cos2 h(1 - sin 6 + A26 sin4 h cos h(1 - sin h)4 + A27 sin3 h( 1 - cos h)4 (1 - sin h)2 + A28 sin hcos h(1 - cos h)5(1 - sin h)2 + A29 sin3 h cos h(1 - cos h)3 (1 - sin h)2 + A30 sin3 h cos h(1 - cos h)2 (1 - sin h)3 + A3i sin4 h(1 - cos h)(1 - sin h)4 + A32 sin3 hcos2 h(1 - cos h)(1 - sin h)3 + A33 sin h cos2 h(1 - cos h)4 (1 - sin h)2 + A34 sin2 h cos3 h(1 - cos h)2 (1 - sin h)2 + A35 sin3 h(1 - cos h)3(1 + A36 sin2 h cos2 h(1 - co + A37 sin2 h cos h(1 + A39 sin2 h cos2 h( + A40 cos3 h(1 - cos h)3 (1 - sin + A41 sin2 h cos2 h(1 - cos h)2 (1 - sin h)3 + A42 sin h cos3 h(1 - cos h)3 (1 - sin h)2 + A43 sin3 h cos2 h(1 - cos h)2 (1 - sin h)2 + A44 cos3 h(1 - cos h)6 + A45 cos4 h(1 - cos h)4 (1 - sin h) + A46 cos3 h(1 - cos h)5 (1 - sin h)

+ A47 cos4 h sin h(1 - cos h)4 + A48 sin2 h cos h(1 - cos h)5 (1 - sin h) + A49 sin h cos3 h(1 - cos h)5 + A50 sin2 h(1 - cos h)3 (1 - sin h)4 + A51 cos h(1 - cos h)8 + A52 sin2 h(1 - cos h)7 + A53 sin h(1 - cos h)3(1 - sin h)5 + A54 sin h(1 - cos h)6(1 - sin h)2 + A55 sin h cos2 h(1 - cos h)3 (1 - sin h)3 + A56 cos2 h(1 - cos h)6 (1 - sin B + A57 sin2 h(1 - cos h)6(1 - sin h) + A58 sin hcos2 h(1 - cos h)6 + A59 sin2 h cos2 h(1 - sin h)5 + A60 sin2 h cos2 h(1 - cos h)3 (1 - sin h)2 + A61 sin3 hcos2 h(1 - cos h)(1 - sin h)3 + A62 sin2 hcos3 h(1 - cos h)3(1 -+ A63 sin2 h cos2 h(1 - cos h)4 (1 - sin h)}

- sin h)

- cos h)3(1 - sin h)2

cos h)6 + A38 cos2 h(1 - cos 6

- cos h 4

(1 - sin B

A0 = —a,d, A1 = a,d + a,a — 2ß,d, A2 = — a,a — ß,d, A3

--A6, A7 = 2a,g — a,k, A8

A9 = a,/ + ß,k , A10

= a,(4h — 2e + 3f + 6a) + ß,(3c — 2b + g) — 6b,a + y,a , A13 = a,(2h + 3g — 2b + 3c) — ß,g — 6b,d + y,d, A14 = a,(4b + e) — 2ß,b + y, (a — 5d) , A15 = 5a,e + ß,(2b — e)+4y = 4a,, + y, (k — 2g) — 5b,k , A17 = a,i + y,g + b,k , A18 = 5af + ß,(2c — f), A19 = 0,(5/ — ,) —b,(k + 4g) + 2y,g, A20 = a,(4c + f) — 2ß,c + b,(a — 5d) , A21 = —a,c , A22 = —af — ß = a,/ + b,g , A24 = —ß,a , A25 = —4ß,a , A26 = ß,/, A27 = ß,(—, + 5/) —b,(4h + l)+2y,h, A28 = 6a j — ßj + b,(2h — 3g — 2b — 3c) + y,c , A29 = 4ß,i + y, (/ — 2h) —5b,/, A30 = ß,(2h — 2e + 3f), A31 = ß,(2 = 2ß,(e — /) , A33 = 6a,, — ß,i + y,(2h — 3g — c)+b,(2/ — 4b — 3k) , A = 3ß,e , A35 = — ßf, A36 = — ßf, A37 = y,(3, + j) — 2b,, , A38 = yj + b,, , A 39 = 4ß,i + y, (j — 2h) + 2b, (e — /) , A40 = y,k, A41 = —3y,k, A42 = y,(6b + 2/ — 3k) , A43 = —3y,/, A44 = y,i, A45 = y,(e — 2b), A46 = y,(f — 2c) + b, (e — 2b) , A47 = —y,e , A48 = 4ßj — yf — b, (2e + 3f + 2h), A49 = — yf — b,e, A50 = — b,a, An = —bj, A52 = 2yj — b,(, + j) , A53 = — b,d, A54 = — b,c, A55 = —4b,a, A56 = b,(f — 2c) , A57 = —bf = A58, A59 = 4ß,a, A60 = 4ß,f A61 = 4ß,/ A62 = 4c,e A63 = 3b,e

a = —ßF + aF, b = y,- (F1 — 3F0) + F2(3a,- — ß,), c = b, (F1 — 3F0)+ F3(3a, — ß,), d = —ß-F + a,^ , e = 2ß,F2 — 2y ,-F1, f = 2ß,F3 — 2b,F1, g = a, (3F3 — F2)—F0(3b, — y,) , h = ß, (3F3 — F2)— F1 (3b, — y) , , = y F — b,F2 , j = y,F3 — b,F2, k = 2a,-F2 — 2y,-F0 , / = 2ß,-F2 — 2y, where

2a,h,d,-

2hibidi+1

Fo = a/ ,

F = b/ +

F = /+1 F3 = di/î+i •

Now, S2(x) > 0 if A^

i = 0,1,2,...,63 are all positive as the denominator in (2) is strictly a positive quantity. A;, i = 0,1,2,...,63 are all positive if the free parameters satisfy the following conditions

2hidi+1bi 2d,+1 b,- 2dmb,-y,, -, y, > -A , y, >■

Pf+1 6d,+1 b, 3b,A, ,

p(A, — 3b,A,)5

„ laid, „ a, (2d, + 3pA,-) ß 2a,u,-d,-

ß, > A , ß, > A , ßi > * "t S J ,

pA,- A,p pu,A, — 2b,d,+1

6a,-M,-(b,-d,-+1 + M,-d,- + 5pb,-A,-)

PMjA;- - 2d;d;+1

where m;- = maxfO , cg , ai and d;- are positive real numbers.

Table 1 A convex data set.

a,k x y 1 1.2 1 0.36 5.3 7.36 0.035 0.018 10.5 0.008 12 0.0069

A16 Table 2 A convex data set.

A23 x y — 1.6 —1.71 0.81 0.29 -5.3 -0.30 —7.36 0.016 —7.8 0.018

/) A32 A34

Table 3 A convex data set.

x y 0.1 4 6 0.1 10 15 28 25

Figure 1 C1 rational trigonometric cubic function with a; = 0.5, P = 1.0, = 0.5, Si = 1.0.

0.9 0.8 ■ 0.7 0.6 0.5 ■ 0.4 0.3 ■ 0.2 0.1 ■ 0

-« ! 1 1 !

1 -—

x-axis

Figure 2 C1 convex rational trigonometric cubic function with a = 2.1, 5, = 0.3.

, — , — , 4

o • * -»

-0.5 -............................................................

-2 --2.5 --3 -

-8 -7 -6 -5 -4 -3 -2 -1

x-axis

Figure 3 C1 rational trigonometric cubic function with a,- = 0.5, b, = 1.0, y, = 0.5, d, = 1.0.

x-axis

Figure 6 C1 convex rational trigonometric cubic function with a, = 1.5, d' = 1.0.

Table 4 Numerical results corresponding to Fig. 2.

i 1 2 3 4 5 6

d' -3.3452 -1.6396 -0.0438 -0.0057 -0.002 0.001

b' 78.7019 30.691 8.2637 3.1249 3.816 -

Vf 10.09 1.2543 1.5234 1.3748 0.2 -

§..........

J «■ ----------

-8 -7 -6 -5 -4 -3 -2 -1

x-axis

Figure 4 C1 convex rational trigonometric cubic function with a,, = 3.5, d, = 0.3.

Table 5 Numerical results corresponding to Fig. 4.

1 2 3 4 5

d 4.8657 2.3998 0.0396 0.0011 -0.0065

b 284.9378 81.0980 17.7179 63.8082 -

Vf 21.5843 1.2445 0.5162 2.9486 -

Figure 5 C1 rational trigonometric cubic function with a; = 0.6, b = 1.5, ji = 1.0, Si = 1.5.

The above discussion can be put together as:

Theorem 1. The C1 piecewise trigonometric rational cubic function (1) preserves the convexity if in each subinterval Ii = [xi,xi+1], the parameters b and j,- satisfy the following sufficient conditions

Table 6 Numerical results corresponding to Fig. 6.

1 2 3 4 5 6

d -5.3290e9 - 1.7764e9 0 0 1.7764e9 5.3290e9

b 6.885e19 0 0 0 6.885e19 -

Vf 0.3965e20 0 0 0 1.1896e20 -

> 2h,4+id,- > 2d,+id,- > 2dmd,- > 6dm d,-C ' pf+i 'C pA, 'C ' p(A, - 3d,A,) 'C ' 3d,A, ; and

2iidin iÀ2d; + 3pA;) „ 2a;M;d;

b, > —^ , b, >^^7-- , b, > , ' ' ' , ,

pA, A,p PMiA; - 2d'dm

6a'M'(d'd'+1 + ud + 5pd'A) PMiAi - 2d'd,+i :

where m,- = max{0, y,}, a,- and d,- are positive real numbers. The above constraints can be rearranged as

y , =, + max< 0.

2h,d,+ 1 d, 2d,+ 1d; 2d,+ 1d, 6d,+ 1d;

b, = w, + max< 0.

p/m ' pA, 'p(A, - 3d, A,y 3d, A, 'J " ' 2a,d, a,(2d, + 3pA,) 2a,u,d, 6a,u,(d,d,+1 + u,d, + 5pd,A,)l ' pA, ' A,p 'pm,A, — 2d,d+1 ' pu,A, — 2d,d,+1 J'

where m, = max{0, y}, a, and d,, are positive real WMmèers.

Algorithm 1.

Step 1. Take a convex data set {(xf): i = 0,1,2,...,n}. Step 2. Estimate the derivatives dts at the knots xis (if the data are given without derivatives at the knots xis) with the Arithmetic Mean method.

Step 3. Compute the values of parameters bis and yis using Theorem 1.

Step 4. Substitute the values ¿¡s at knots xis, bis and yis, a and 5; (positive real numbers) in rational trigonometric cubic function (1) to interpolate and visualize the convex pattern of data.

4. Numerical examples and analysis

This section demonstrates the scheme for convex data developed in Section 3.

The C1 rational trigonometric cubic function (1) is first used to visualize the convex data sets taken in Tables 1-3, respectively. Arbitrary values are assigned to free parameters a-, bi, C and 5; and resulting curves are shown in Figs. 1, 3 and 5 respectively. It is evident from Figs. 1, 3 and 5 that rational trigonometric cubic function does not preserve the shape of data for arbitrary values of free parameters. The convex curves for the same data sets are produced in Figs. 2, 4, and 6 , respectively, by the convexity preserving rational trigonometric scheme developed Section 3. The corresponding outputs of the derivative and shape parameters, for the convexity conserving curves in Figs. 2, 4, and 6 are given in Tables 4-6, respectively.

5. Conclusion

The problem of retaining convex trend of 2D data is dealt in this paper. A C1 rational trigonometric cubic spline with four

free parameters has been utilized for this purpose. Constraints on two of free parameters bi and ci are derived while the remaining two ai and 5i are set free. Though literature is inundated with shape preserving schemes but use of rational trigonometric cubic functions makes the underlying algorithm distinguished and unparalleled. Due to the orthogonality of sine and cosine function, much smoother results are obtained as compared to algebraic spline. Derivative of the trigonometric spline is much lower than that of algebraic spline. Insertion of extra knots to conserve the shape of data is not required. Its applicable for both equally and unequally spaced data. No additional information about derivatives is needed as they are estimated by arithmetic mean method. The process of constructing convex surface is under process.

References

[1] Brodlie KW, Butt S. Preserving convexity using piecewise cubic interpolation. Comput Graph 1991;15(1):15-23.

[2] Carnicer JM, Garcia-Esnaola M, Pena JM. Convexity of rational curves and total positivity. J Comput Appl Math 1996;71(2):365-82.

[3] Delbourgo R, Gregory JA. Shape preserving piecewise rational interpolation. SIAM J Sci Statist Comput 1985;6(4):967-76.

[4] Passow E, Roulier JA. Monotone and convex spline interpolation. SIAM J Numer Anal 1977;14(5):904-9.

[5] Schumaker LL. On shape preserving quadratic spline interpolation. SIAM J Numer Anal 1983;20(4):854-64.

[6] Sarfraz M, Hussain MZ. Data visualization using rational spline interpolation. J Comput Appl Math 2006;189(1-2):513-25.

[7] Sarfraz M, Hussain MZ, Hussain M. Shape preserving curve interpolation. Int J Comput Math 2012;89(1):35-53.

[8] Ibraheem F, Hussain M, Hussain MZ, Bhatti AA. Positive data visualization using trigonometric function. J Appl Math 2012;2012. http://dx.doi.org/10.1155/2012/247120..