Applied Mathematics and Computation 216 (2010) 2036–2049
Contents lists available at ScienceDirect
Applied Mathematics and Computation journal homepage: www.elsevier.com/locate/amc
Positive data modeling using spline function Muhammad Sarfraz a,*, Malik Zawwar Hussain b, Asfar Nisar b a b
Department of Information Science, Adailiya Campus, Kuwait University, Kuwait Department of Mathematics, University of the Punjab, Lahore, Pakistan
a r t i c l e Keywords: Spline Shape preservation Interpolation Positivity Data
i n f o
a b s t r a c t A rational cubic function with two parameters has been constructed to visualize the positive data. The main focus of the work is the representation of the data in such a way that its view looks smooth and attractive. In the first step simple data dependent constraints are derived on the parameters in the description of the rational cubic function to visualize the shape of positive data then, it is extended to a rational bi-cubic partially blended functions (Coons-patches) and derived constraints on parameters to visualize the shape of positive surface data. The developed scheme is locally positive and economical. The 3 approximation order of rational cubic spline function is O hi . Ó 2010 Elsevier Inc. All rights reserved.
1. Introduction One of the significant features of interpolatory methods that make sense to study is its positivity. The goal of the paper is to preserve the inherited feature called, positivity of data. More specifically, it has useful discussion on the problem of visualizing data where underlying constrained must be established. To clarify the idea e.g. for a data which is naturally positive, it shows how the spline which interpolates the data can be constrained to preserve the positivity. Paper presents a new model of spline curve and surface. A rational cubic spline with quadratic denominator has been constructed. Here it is important to mention that spline interpolation is a powerful tool in curve and surface designing. In recent years, the rational spline, particularly the rational cubic spline and its application to shape control, design and preservation has received attention in literature [1–14,16,17]. Shape control [22], shape design [21] and shape preservation [16–19] are important areas for graphical presentation of data. The problem of shape preservation has been discussed by a number of authors. Brodlie and Butt [3] preserved the shape of convex data by piecewise cubic interpolation. In any interval where convexity was lost, the authors divided the interval into two subintervals by inserting extra knot in that interval. The presented method was C1. The authors used the same technique in [4] to preserve the shape of positive data. Fuhr and Kallay [7] used a C1 monotone rational B-spline of degree one to preserve the shape of monotone data. Goodman, Ong and Unsworth [8] presented two interpolating schemes to preserve the shape of data lying on one side of the straight line using rational cubic function. The first scheme preserved the shape of data lying above the straight line by scaling the weights by some scale factor. The second scheme preserves the shape of data by the insertion of a new interpolation point. Goodman [10] surveyed the shape preserving interpolating algorithms for 2D data. Gregory and Sarfraz [11] introduced a rational cubic spline with one tension parameter in each subinterval, both interpolatory and rational B-spline forms. The authors also analyzed the effect of variation of tension parameter on the shape of the curve. Hussain and Sarfraz [13] used rational cubic function in its most generalized form to preserve the shape of positive planar data. The authors used same rational cubic function in [14] to preserve the shape of monotone data. In [13,14], the * Corresponding author. E-mail addresses:
[email protected],
[email protected] (M. Sarfraz),
[email protected] (M.Z. Hussain). 0096-3003/$ - see front matter Ó 2010 Elsevier Inc. All rights reserved. doi:10.1016/j.amc.2010.03.034
2037
M. Sarfraz et al. / Applied Mathematics and Computation 216 (2010) 2036–2049 Table 1 A positive data set. x
0
2
4
10
28
30
32
y
20.8
8.8
4.2
0.5
3.9
6.2
9.6
Fig. 1. Cubic Hermite spline.
authors developed data dependent sufficient conditions on free parameters to preserve the shape of planar data. Lamberti and Manni [16] used cubic Hermite in parametric form to preserve the shape of data. The step length was used as tension parameters to preserve the shape of planar functional data. The first order derivatives at the knots were estimated by a tridiagonal system of equations which assured C2 continuity at the knots. Schmidt and Heb [20] developed sufficient conditions on derivatives at the end points of interval to assure positivity of cubic polynomial over the whole interval. The theory, in this paper, has a number of advantageous features. It produces C1 interpolant. No additional points are inserted. Generic interpolatory schemes, although smoother but violates natural characteristics of data. For example, for data in Table 1, the corresponding Fig. 1 may not be wanted by user for the positive data, the user would be ambitious to view it as in Fig. 2. Thus undesirable wiggles which completely deviate the data from its natural features are required to be eliminated. This paper scrutinizes the problem of positive data. Various authors have worked in area of shape preservation. In past few years; several researchers have started using curves and surface of high degree as geometric models or shape descriptors in different model-based-computer vision tasks. Typically speaking, in everyday life many physical situations exist where entities only have sense if their values are positive e.g. in probability distribution, area in the observation of gas discharge etc. It has special usage in image processing, high performance computing, meteorological monitoring, maps, data plots, drawing and many other areas. The paper has been arranged in a manner so that Section 2 describes the construction of the spline. Section 3 discusses the error of approximation. Constraints for positive curve model have been described in Section 4. The bi-cubic partially blended surfaces have been suggested in Section 5 which is followed by Section 6 devoted to the constraints on the parameters for positive surfaces. The last Section 7 concludes the paper. 2. Rational cubic function Let fðxi ; fi Þ; i ¼ 0; 1; 2; . . . ; ng be the given set of data points defined over the interval [a, b], where a ¼ x0 < x1 < x2 < < xn ¼ b. The piecewise rational cubic function with two free parameters is defined over each subinterval Ii ¼ ½xi ; xiþ1 ; i ¼ 0; 1; 2; . . . ; n 1 as
Si ðxÞ ¼
A0 ð1 hÞ3 þ A1 ð1 hÞ2 h þ A2 ð1 hÞh2 þ A3 h3 ui ð1 hÞ2 þ 2ð1 hÞh þ v i h2
;
ð1Þ
i where h ¼ xx ; hi ¼ xiþ1 xi . The piecewise rational cubic function (1) will be C1 if it satisfies the following interpolatory hi conditions:
Si ðxi Þ ¼ fi ;
Si ðxiþ1 Þ ¼ fiþ1 ;
ð1Þ
Si ðxi Þ ¼ di ;
ð1Þ
Si ðxiþ1 Þ ¼ diþ1 ;
ð2Þ
2038
M. Sarfraz et al. / Applied Mathematics and Computation 216 (2010) 2036–2049
Fig. 2. Rational cubic spline. ð1Þ
Si ðxÞ denotes the derivative with respect to x and di denotes the derivative values estimated or given. The C1 continuity conditions defined in (2) asserts the following values of unknowns Ai ; i ¼ 0; 1; 2; 3
A0 ¼ u i f i ; A1 ¼ ui fi þ hi ui di þ 2f i ; A2 ¼ v i fiþ1 hi v i diþ1 þ 2f iþ1 ; A3 ¼ v i fiþ1 : These values of Ai ; i ¼ 0; 1; 2; 3 reformulates the rational cubic function (1) to the following C1 piecewise cubic spline
Si ðxÞ ¼
pi ðhÞ ; qi ðhÞ
ð3Þ
where
pi ðhÞ ¼ ui fi ð1 hÞ3 þ fui fi þ hi ui di þ 2f i gð1 hÞ2 h þ fv i fiþ1 hi v i diþ1 þ 2f iþ1 gð1 hÞh2 þ v i fiþ1 h3 ; 2
2
qi ðhÞ ¼ ui ð1 hÞ þ 2ð1 hÞh þ v i h :
ð4Þ ð5Þ
It is interesting to note that in each interval Ii ¼ ½xi ; xiþ1 ; ui ¼ v i ¼ 1, the piecewise rational cubic function reduces to standard cubic Hermite spline. 3. Error estimation of interpolation In this Section the error of interpolation is estimated when the function being interpolated is f ðxÞ 2 C 3 ½x0 ; xn , using the rational cubic function (1). Keeping in view the locality of interpolation scheme developed in Section 2, the error is investigated in an arbitrary subinterval Ii ¼ ½xi ; xiþ1 . The Peano Kernel Theorem [15] is used to estimate the error adopting the approach of [5]. The error in each subinterval Ii ¼ ½xi ; xiþ1 is defined as:
R½f ¼ f ðxÞ Si ðxÞ ¼
1 2
Z
xiþ1
xi
h i f ð3Þ ðsÞRx ðx sÞ2þ ds:
ð6Þ
The absolute value of the error in each subinterval is:
jf ðxÞ Si ðxÞj 6 where
1 ð3Þ kf ðsÞk 2
Z
xiþ1
xi
h i 2 Rx ðx sÞþ ds;
h i rðs; xÞ; x < s < x; i Rx ðx sÞ2þ ¼ sðs; xÞ; x < s < xiþ1 :
Rx ½ðx sÞ2þ is the Peano Kernel. Using (15),
Z
xi
xiþ1
Z h i 2 Rx ðx sÞþ ds ¼
xi
ð7Þ
ð8Þ
i R xiþ1 h 2 Rx ðx sÞþ ds can be expressed as: xi
x
jrðs; xÞjds þ
Z
x
xiþ1
jsðs; xÞjds:
ð9Þ
2039
M. Sarfraz et al. / Applied Mathematics and Computation 216 (2010) 2036–2049
For the rational cubic function (3), rðs; xÞ and sðs; xÞ have the value 2
rðs; xÞ ¼ ðx sÞ
sðs; xÞ ¼
h i 2 v i ðxiþ1 sÞ2 þ 2ðxiþ1v isÞ 2hi ðxiþ1 sÞ2 h2 ð1 hÞ þ v i ðxiþ1 sÞ2 h3
qi ðhÞ h i 2ðxiþ1 sÞ2 2 2 v i ðxiþ1 sÞ þ v 2hi ðxiþ1 sÞ h2 ð1 hÞ þ v i ðxiþ1 sÞ2 h3 i
qi ðhÞ
ð11Þ
:
The roots of rðx; xÞ in ½0; 1 are: h ¼ 0; h ¼ 1 and h ¼ 22v i . The roots of rðs; xÞ ¼ 0 are:
H¼
ð10Þ
;
1þj
sj ¼ x hi hð2hþð1Þ ui þ2h
HÞ
; j ¼ 1; 2, where
qffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi 4h2 ðv i þ 2hÞðv i 2ð1 hÞÞ:
The root of sðs; xÞ ¼ 0 are:
v i hi ð1hÞ s3 ¼ xiþ1 22ð1hÞþ v i ; s4 ¼ xiþ1 . We have the following possible cases:
Case 1. For 0 < h < h , 0 6 v i 6 2 (7) takes the form
Z x Z xiþ1 1 ð3Þ jrðs; xÞjds þ jsðs; xÞjds kf ðsÞkx1 ðai ; bi ; hÞ; x1 ðv i ; ui ; hÞ ¼ 2 xi x Z s2 Z x Z s3 Z xiþ1 ¼ rðs; xÞds rðs; xÞds sðs; xÞds þ sðs; xÞds
jf ðxÞ Si ðxÞj 6
s2
xi
¼
s3
x
! 3 hÞ 1 hi hð2h þ HÞ 2v i h2 4h2 ð1 hÞ þ hi ð1 hÞ þ þ qi ðhÞ ðui þ 2hÞ 3 3qi ðhÞ 3
2 3 3 3 3 3 3 2 2hi v i h ð1 hÞ hi hðH þ 2hÞ h h 2h h ðH þ 2hÞ3 v i h3 hi 2h2 ð1 hÞhi þ i i hi ð1 hÞ þ 3 qi ðhÞ ðui þ 2hÞ 3 3qi ðhÞ 3qi ðhÞ 3qi ðhÞðui þ 2hÞ 3 3 2 3 3 3 2 8hi v i h ð1 hÞ 2v i 4ð1 hÞ 2v i hi h ð1 hÞ þ 1 : 3qi ðhÞ qi ðhÞðv i þ 2ð1 hÞÞ2 3ðv i þ 2ð1 hÞÞ 3ðv i þ 2ð1 hÞÞ
2v
2 3 i h hi ð1
2
Case 2. For h < h < 1; 0 6 v i 6 2 (14) takes the form
1 jf ðxÞ Si ðxÞj 6 kf ð3Þ ðsÞkx2 ðui ; v i ; hÞ; Z2 x Z xiþ1 x2 ðui ; v i ; hÞ ¼ jrðs; xÞjds þ jsðs; xÞjds xi
x 3
3
3
3
2v i hi h2 ð1 hÞ2 ð3h 1Þ 2h2 ð1 hÞhi ð1 2h3 6h þ 6h2 Þ hi h3 hi h3 v i ¼ þ þ : 3qi ðhÞ 3qi ðhÞ 3 3qi ðhÞ Case 3. For 0 < h < 1;
jf ðxÞ Si ðxÞj 6
vi > 2
1 ð3Þ kf ðsÞkx3 ðui ; v i ; hÞ; where x3 ðui ; v i ; hÞ ¼ 2 3
¼
3
Z xi
x
jrðs; xÞjds þ
Z
xiþ1
jsðs; xÞjds
x 3
3
2v i hi h2 ð1 hÞ2 ð3h 1Þ 2h2 ð1 hÞhi ð1 2h3 6h þ 6h2 Þ hi h3 hi h3 v i þ þ : 3qi ðhÞ 3qi ðhÞ 3 3qi ðhÞ
The above can be summarized as: Theorem 3.1. The error of rational cubic function (3), forf ðxÞ 2 C 3 ½x0 ; xn , in each subinterval ½xi ; xiþ1 is
jf ðxÞ Si ðxÞj 6
1 ð3Þ kf ðsÞkci ; 2
ci ¼ max xðai ; bi ; hÞ; 06h61
8 max x1 ðui ; v i ; hÞ; 0 6 h 6 h ; > > > < max x2 ðui ; v i ; hÞ; h 6 h 6 1; xðai ; bi ; hÞ ¼ > > max x3 ðui ; v i ; hÞ; 0 6 h 6 1: > :
4. Positive curve data model The problem of positive curve data interpolation is stated as follows: For given set data points fðxi ; fi Þ; i ¼ 0; 1; 2; . . . ; ng satisfying the condition
2040
M. Sarfraz et al. / Applied Mathematics and Computation 216 (2010) 2036–2049
fi > 0;
i ¼ 0; 1; 2; . . . ; n:
ð12Þ
The piecewise rational cubic function defined in (3) model the positive data as positive curve if in each subinterval Ii ¼ ½xi ; xiþ1 the following relation is true
Si ðxÞ > 0;
i ¼ 0; 1; 2; . . . ; n 1:
ð13Þ
The basic idea is to impose conditions on free parameters to assure positivity. It can be observed that ui > 0; v i > 0 guarðhÞ depends on the positivity of the cubic polynomial antee strictly positive denominator qi ðhÞ. Thus the positivity of Si ðxÞ ¼ pqi ðhÞ i
pi ðhÞ, and the difficulty level only reduces to the determination of suitable values of ui andv i ; for which the polynomial pi ðhÞ > 0. According to the result developed by Schmidt and Heb½20;pi ðhÞ >0 if
ðp0i ð0Þ; p0i ð1ÞÞ 2 R1 [ R2 ;
ð14Þ
where
3pi ð0Þ 3p ð1Þ ða; bÞ : a > ; b < iþ1 ; hi hi 9 8 2 2 2 > > > ða; bÞ : 36f i fiþ1 a þ b þ ab 3Di ða þ bÞ þ 3Di þ 3ðfiþ1 a fi bÞð2hi ab 3f iþ1 a þ 3f i bÞ > = < ; R2 ¼ 3 2 2 2 3 þ4hi fiþ1 a fi b hi a b > 0; > > > > ; : R1 ¼
where Di ¼
fiþ1 fi hi
ð15Þ
ð16Þ
; hi ¼ xiþ1 xi . Now we consider
pi ðhÞ ¼ ui fi ð1 hÞ3 þ fui fi þ ui hi di þ 2f i gð1 hÞ2 h þ fv i fiþ1 v i hi diþ1 þ 2f iþ1 gð1 hÞh2 þ v i fiþ1 h3 : We can easily show that
2f i ui þ ui di hi þ 2f i ; hi 2v i fiþ1 þ v i diþ1 hi 2f iþ1 p0i ð1Þ ¼ ; hi 3pi ð0Þ ; ðp0i ð0Þ; p0i ð1ÞÞ 2 R1 if p0i ð0Þ > hi p0i ð0Þ ¼
p0i ð1Þ <
3pi ð1Þ : hi
This leads to, pi ðhÞ > 0; if
2f i ; fi þ hi di 2f iþ1 > : fiþ1 hi diþ1
ui >
ð17Þ
vi
ð18Þ
Further, ðp0i ð0Þ; p0i ð1ÞÞ 2 R2 if
2 3 2 2 36f i fiþ1 a2 þ b þ ab 3Di ða þ bÞ þ 3D2i þ 3ðfiþ1 a fi bÞð2hi ab 3f iþ1 a þ 3f i bÞ þ 4hi fiþ1 a3 fi b hi a2 b > 0;
ð19Þ
where
a ¼ p0i ð0Þ;
b ¼ p0i ð1Þ:
Also constraints on ui and v i can be determined from (19), but it requires a lot of computation. So an efficient and reasonably acceptable choice is to use the conditions given in (17)–(18). Theorem 4.1. The piecewise rational cubic interpolant Si ðxÞ, defined over the interval [a, b], in (3), is positive if in each sub interval Ii ¼ ½xi ; xiþ1 the following sufficient conditions are satisfied
2f i ui > Max 0; ; fi þ hi di 2f iþ1 v i > Max 0; : fiþ1 hi diþ1
The above constraints can be rearranged as:
2f i ui ¼ wi þ Max 0; ; wi > 0; fi þ hi di 2f iþ1 v i ¼ ri þ Max 0; ; r i > 0: fiþ1 hi diþ1
2041
M. Sarfraz et al. / Applied Mathematics and Computation 216 (2010) 2036–2049 Table 2 A positive data set. x
2
3
7
8
9
13
14
y
10
2
3
7
2
4
10
Fig. 3. Cubic Hermite spline.
Fig. 4. Rational cubic spline.
4.1. Arithmetic mean method For most of the times, the derivatives di ’s are not known so must be calculated either from the given data or by some other sources. An evident choice is the Arithmetic mean method which is the three-point difference approximation based on arithmetic calculation. This method is defined as follows:
2042
M. Sarfraz et al. / Applied Mathematics and Computation 216 (2010) 2036–2049
d0 ¼ D0 þ ðD0 D1 Þ
h0 ; h0 h1
d1 ¼ Dn1 þ ðDn1 Dn2 Þ di ¼
Di þ Di1 ; 2
hn1 ; hn1 hn2
i ¼ 1; 2; 3; . . . ; n 1:
4.2. Demonstration This section is devoted to examples for demonstration to the devised curve scheme for positive data. Example 4.1. A positive data set is taken in Table 1. The Fig. 1 is produced from data set in Table 1 using cubic Hermite spline which fails to preserve the shape of data. Positive curve in Fig. 2 is produced by the same data set using the positive curve data modeling scheme build up in Section 4. Example 4.2. Another positive data set is taken in Table 2. The Fig. 3 is produced from data set in Table 2 using cubic Hermite spline which fails to preserve the shape of data. Positive curve in Fig. 4 is produced by the same data set using the positive curve data modeling scheme build up in Section 4. 5. Bi-cubic partially blended rational function The rational cubic function (3) is extended to the rational bi-cubic function defined over a 3D data set ðxi ; yj ; F i;j Þ with the ^ :c¼ rectangular mesh D ¼ ½x0 ; xm ½y0 ; yn . Let p : a ¼ x0 < x1 < x2 < < xm ¼ b be the partition of [a, b] and p y0 < y1 < < yn be the partition of [c, d]. Rational bi-cubic partially blended function is defined over each rectangular patch Ii;j ¼ ½xi ; xiþ1 ½yj ; yjþ1 , as follows:
Sðx; yÞ ¼ AFBT ; where
0
ð20Þ
0
Sðx; yjþ1 Þ
Sðx; yj Þ
1
B Sðxi ; yj Þ Sðxi ; yjþ1 Þ C F ¼ @ Sðxi ; yÞ A; Sðxiþ1 ; yÞ Sðxiþ1 ; yj Þ Sðxiþ1 ; yjþ1 Þ A ¼ ½ 1 a0 ðhÞ a1 ðhÞ ; B ¼ ½ 1 b0 ð/Þ b1 ð/Þ ; a0 ¼ ð1 hÞ2 ð1 þ 2hÞ;
a1 ¼ h2 ð3 2hÞ;
b0 ¼ ð1 uÞ2 ð1 þ 2uÞ;
b1 ¼ u2 ð3 2uÞ;
h¼
x xi ; hi
u¼
y yj : b h j
Sðx; yj Þ; Sðx; yjþ1 Þ; Sðxi ; yÞ and Sðxiþ1 ; yÞ are rational cubic functions (3) defined on the boundary of rectangular patch ½xi ; xiþ1 ½yj ; yjþ1 as
P3
Sðx; yj Þ ¼
hÞ3i hi Ai ; q1 ðhÞ
i¼0 ð1
ð21Þ
A0 ¼ ui;j F i;j ; A1 ¼ ui;j F i;j þ hi ui;j F xi;j þ 2F i;j ; A2 ¼ v i;j F iþ1;j hi v i;j F xiþ1 þ 2F iþ1;j ; A3 ¼ v i;j F iþ1;j ; q1 ðhÞ ¼ ui;j ð1 hÞ2 þ 2hð1 hÞ þ v i;j h2 : 3 P
Sðx; yjþ1 Þ ¼
ð1 hÞ3i hi Bi
i¼0
q2 ðhÞ
;
B0 ¼ ui;jþ1 F i;jþ1 ; B1 ¼ ui;jþ1 F iþ1;jþ1 þ hi ui;jþ1 F xi;jþ1 þ 2F i;jþ1 ; B3 ¼ v i;jþ1 F iþ1;jþ1 hi v i;jþ1 F xiþ1;jþ1 þ 2F iþ1;jþ1 ; B4 ¼ F iþ1;jþ1 v i;jþ1 ; q2 ðhÞ ¼ ui;jþ1 ð1 hÞ2 þ 2hð1 hÞ þ v i;jþ1 h2 :
ð22Þ
M. Sarfraz et al. / Applied Mathematics and Computation 216 (2010) 2036–2049 3 P
Sðxi ; yÞ ¼
2043
ð1 uÞ3i ui C i
i¼0
ð23Þ
:
q3 ðuÞ
^ i;j F i;j ; C0 ¼ u y ^u ^ i;j F i;j þ h C1 ¼ u j ^ i;j F i;j þ 2F i;j ;
^j v^ i;j F y þ 2F i;jþ1 ; C 2 ¼ v^ i;j F i;jþ1 h i;jþ1 C 3 ¼ v^ i;j F i;jþ1 ; ^ i;j ð1 uÞ2 þ 2uð1 uÞ þ v^ i;j u2 : q3 ðuÞ ¼ u 3 P
Sðxiþ1 ; yÞ ¼
ð1 uÞ3 ui Di
i¼0
ð24Þ
;
q4 ðuÞ
^ iþ1;j F iþ1;j ; D0 ¼ u y ^u ^ iþ1;j F iþ1;j þ h D1 ¼ u j ^ iþ1;j F iþ1;j þ 2F iþ1;j ; y ^ v^ D2 ¼ v^ iþ1;j F iþ1;jþ1 h j iþ1;j F iþ1;jþ1 þ 2F iþ1;jþ1 ;
D3 ¼ v^ iþ1;j F iþ1;jþ1 ; ^ iþ1;j ð1 uÞ2 þ 2uð1 uÞ þ v^ iþ1;j u2 : q4 ðuÞ ¼ u 5.1. Choice of derivatives Let us denote F xi;j and F yi;j as the first order derivatives with respect to x and y, respectively, at the data point F i;j . Similarly, x y xy let the mixed derivatives be denoted by F xy i;j . For most of the times, the derivatives F i;j and F i;j and F i;j are not known, so must be calculated either from the given data or by some other sources. Arithmetic mean method, as mentioned in Section 4.1 is the three-point difference approximation based on arithmetic calculation for the positive curve manipulation. This method can be oriented and extended for the 3D data visualization as follows:
b 0;j þ ð D b 0;j D b 1;j Þ F x0;j ¼ D
h0 ; h0 þ h1
b m1;j þ ð D b m1;j D b m2;j Þ F xm;j ¼ D F xi;j ¼
hm1 ; hm1 þ hm2
Di;j þ Di1;j ; 2
b i;n1 þ ð D b i;n1 D b i;n2 Þ F yi;n ¼ D
^n1 h ; ^n2 ^ hn1 þ h
b i;j þ D b i;j1 D ; i ¼ 0; 1; 2; 3; . . . ; m j ¼ 1; 2; 3; . . . ; n 1; 2 ( x ) y y x 1 F i;jþ1 F i;j1 F iþ1;j F i1;j ; i ¼ 1; 2; 3; . . . ; m 1 j ¼ 1; 2; 3; . . . ; n 1; ¼ þ ^ ^ þh 2 hi1 hi h j1 j
F yi;j ¼ F xy i;j
Di;j ¼
F iþ1;j F i;j ; hi
and
b i;j ¼ F i;jþ1 F i;j : D ^ h j
These arithmetic mean methods are computationally less costly and provide appropriate choice for visualization of positive shaped data. 6. Positive surface data model Let ðxi ; yj ; F i;j Þ be positive data defined over rectangular grid I ¼ ½xi ; xiþ1 ½yj ; yjþ1 ; i ¼ 0; 1; 2; 3; . . . ; m 1; j ¼ 0; 1; 2; 3; . . . ; n 1 such that F i;j > 0 8i; j. The bi-cubic partially blended surface patches (20) inherit all the properties of network boundary. The bi-cubic partially blended surface (20) is positive if the boundary curves Sðx; yj Þ; Sðx; yjþ1 Þ; Sðxi ; yÞ and Sðxiþ1 ; yÞ defined in (21)–(24) are positive.
Sðx; yj Þ > 0 if
3 X ð1 hÞ3i hi Ai > 0 and q1 ðhÞ > 0: i¼0
q1 ðhÞ > 0 if ui;j > 0 and
v i;j > 0:
2044
M. Sarfraz et al. / Applied Mathematics and Computation 216 (2010) 2036–2049 3 X ð1 hÞ3i hi Ai > 0 if Ai > 0; i¼0
Ai > 0;
i ¼ 0; 1; 2; 3: (
2F i;j i ¼ 0; 1; 2; 3 if ui;j > Max 0; F i;j þ hi F xi;j
Sðx; yjþ1 Þ > 0 if
)
(
and
v i;j
) 2F iþ1;j : > Max 0; F iþ1;j hi F xiþ1;j
3 X ð1 hÞ3i hi Bi > 0 and q2 ðhÞ > 0: i¼0
q2 ðhÞ > 0 if ui;jþ1 > 0 and
v i;jþ1 > 0:
3 X ð1 hÞ3i hi Bi > 0 if Bi > 0; i¼0
Bi > 0;
i ¼ 0; 1; 2; 3: (
i ¼ 0; 1; 2; 3 if ui;jþ1
2F i;jþ1 > Max 0; F i;jþ1 þ hi F xi;jþ1
) and
Table 3 A positive 3D data set. y=x
3
2
1
0
1
2
3
3 2 1 0 1 2 3
1 26 65 82 65 26 1
26 1 10 17 10 1 26
65 10 1 2 1 10 65
82 17 2 1 2 17 82
65 10 1 2 1 10 65
26 1 10 17 10 1 26
1 26 65 82 65 26 1
Fig. 5. Bi-cubic Hermite spline. (a) xz-view of Fig. 5. (b) yz-view of Fig. 5.
M. Sarfraz et al. / Applied Mathematics and Computation 216 (2010) 2036–2049
Fig. 6. Rational bi-cubic function. (a) xz-view of Fig. 6. (b) yz-view of Fig. 6.
(
v i;jþ1 > Max
0;
Sðxi ; yÞ > 0 if
) 2F iþ1;jþ1 : F iþ1;jþ1 hi F xiþ1;jþ1 3 X ð1 /Þ3i /i C i > 0 and q3 ð/Þ > 0: i¼0
^ i;j > 0 and q3 ð/Þ > 0 if u
v^ i;j > 0:
3 X ð1 /Þ3i /i C i > 0 if C i > 0;
i ¼ 0; 1; 2; 3:
i¼0
(
2F i;j ^ i;j > Max 0; C i > 0; i ¼ 0; 1; 2; 3 if u ^ Fy F i;j þ h j i;j ( ) 2F iþ1;j : v^ i;j > Max 0; ^ Fy F h iþ1;j
Sðxiþ1 ; yÞ > 0 if
and
j iþ1;j
3 X
ð1 /Þ3i /i Di > 0 and q4 ð/Þ > 0:
i¼0
^ iþ1;j > 0 and q4 ð/Þ > 0 if u
v^ iþ1;j > 0:
3 X ð1 /Þ3i /i Di > 0 if Di > 0; i¼0
)
i ¼ 0; 1; 2; 3:
2045
2046
M. Sarfraz et al. / Applied Mathematics and Computation 216 (2010) 2036–2049
Table 4 A positive 3D data set. y=x
0.0001
1.5
3
4.5
6
7.5
9
0.0001 1.5 3 4.5 6 7.5 9
0.6667 0.4422 0.0022 0.0472 0.0022 0.0156 0.0021
0.5 0.4807 0.1681 0.1295 0.0575 0.0515 0.0283
0.5 0.4936 0.3341 0.2603 0.1681 0.1331 0.0926
0.5 0.4970 0.4095 0.3491 0.2657 0.2184 0.1681
0.5 0.4982 0.4447 0.4006 0.3341 0.2876 0.2364
0.5 0.4989 0.4631 0.4309 0.3793 0.3385 0.2916
0.5 0.4992 0.4738 0.4497 0.4095 0.3752 0.3340
Fig. 7. Bi-cubic Hermite spline. (a) xz-view of Fig. 7. (b) yz-view of Fig. 7.
( Di > 0;
^ iþ1;j > Max 0; i ¼ 0; 1; 2; 3 if u (
v^ iþ1;j > Max
0;
2F iþ1;jþ1 ^ Fy h
F iþ1;jþ1
)
2F iþ1;j ^ Fy F iþ1;j þ h j iþ1;j
) and
:
j iþ1;jþ1
This discussion can be summarized in the following theorem: Theorem 6.1. The piecewise rational bi-cubic interpolant, defined over the rectangular mesh Ii;j ¼ ½xi ; xiþ1 ½yj ; yjþ1 ,in (14), is positive if the following sufficient conditions are satisfied
M. Sarfraz et al. / Applied Mathematics and Computation 216 (2010) 2036–2049
Fig. 8. Rational bi-cubic function. (a) xz-view of Fig. 8. (b) yz-view of Fig. 8.
(
) 2F i;j ; ui;j > Max 0; F i;j þ hi F xi;j ( ) 2F iþ1;j ; v i;j > Max 0; F iþ1;j hiþ1 F xiþ1;j ( ) 2F i;jþ1 ui;jþ1 > Max 0; ; F i;jþ1 þ hi F xi;jþ1 ( ) 2F iþ1;jþ1 ; v i;jþ1 > Max 0; F iþ1;jþ1 hi F xiþ1;jþ1 ( ) 2F i;j ^i;j > Max 0; u ; ^ Fy F i;j þ h j i;j ( ) 2F iþ1;j ; v^ i;j > Max 0; ^ Fy F iþ1;j h j iþ1;j ( ) 2F iþ1;j ^iþ1;j > Max 0; u ; ^ Fy F iþ1;j þ h j iþ1;j ( ) 2F iþ1;jþ1 ^ : v iþ1;j > Max 0; ^ Fy F h iþ1;jþ1
j iþ1;jþ1
The above constraints can be rearranged as:
2047
2048
M. Sarfraz et al. / Applied Mathematics and Computation 216 (2010) 2036–2049
( ui;j ¼ ai;j þ Max 0;
) 2F i;j ; F i;j þ hi F xi;j
(
v i;j ¼ bi;j þ Max
0;
ai;j > 0;
) 2F iþ1;j ; F iþ1;j hi F xiþ1;j
( ui;jþ1 ¼ ci;j þ Max 0;
bi;j > 0;
) 2F i;jþ1 ; F i;jþ1 þ hi F xi;jþ1
ci;j > 0;
(
) 2F iþ1;jþ1 ; li;j > 0; F iþ1;jþ1 hi F xiþ1;jþ1 ( ) 2F i;j ^ i;j ¼ mi;j þ Max 0; ; mi;j > 0; u ^j F y F i;j þ h i;j ( ) 2F iþ1;j ^ ; ni;j > 0; v i;j ¼ ni;j þ Max 0; ^ Fy F iþ1;j h j iþ1;j ( ) 2F iþ1;j ^ uiþ1;j ¼ oi;j þ Max 0; ; oi;j > 0; ^ Fy F iþ1;j þ h j iþ1;j ( ) 2F iþ1;jþ1 ; pi;j > 0: v^ iþ1;j ¼ pi;j þ Max 0; ^ Fy F h
v i;jþ1 ¼ li;j þ Max
0;
iþ1;jþ1
j iþ1;jþ1
6.1. Demonstration In this Section, the positive surface data modeling scheme developed in Section 7 is illustrated: Example 6.1. The positive data set in Table 3 is generated from the following function:
F 1 ðx; yÞ ¼ ðx2 y2 Þ2 þ 1: The Fig. 5 is produced from data set in Table 3 using bi-cubic Hermite spline which looses the shape of the data. Positive surface in Fig. 6 is produced by the same data set using the positive surface data modeling scheme developed in Section 6. Example 6.2. The positive data set in Table 4 is generated from the following function: 2
F 2 ðx; yÞ ¼
ðx2 þ sin yÞ : 2ðx2 þ y2 Þ
Fig. 7 is produced from data set in Table 4 using bi-cubic Hermite spline which looses the shape of data. Positive surface in Fig. 8 is produced by the same data set using the positive surface data modeling scheme developed n Section 7.
7. Conclusion A C1 piecewise rational cubic interpolant, with two parameters, has been developed for the modeling of positive data arising from some scientific phenomenon. Data dependent shape constraints are derived on these parameters that guarantee to preserve the shape of the data. The choice of arithmetic mean has been utilized for derivative computations. Generally, choice of the derivative parameters is left at the desire of the user as well. Any numerical derivatives, like arithmetic, geometric or harmonic mean choices can be adopted for this purpose. The proposed idea of positive C1 rational cubic spline has been extended to a positive rational bi-cubic partially blended surface. It ensures that the data is arranged over a rectangular grid. The scheme has been derived by imposing constraints upon the parameters in the description of bi-cubic partially blended rational function. The suggested curve and surface schemes have been demonstrated over the data sets and they proved visually attractive. The method of manipulation is robust. References [1] G. Beliakov, Monotonicity preserving approximation of multivariate scattered, BIT Numerical Mathematics 45 (4) (2005) 653–677. [2] S. Butt, Shape preserving curves and surfaces for computer graphics, Ph.D. Thesis, School of Computer Studies, The University of Leeds, UK, 1991.
M. Sarfraz et al. / Applied Mathematics and Computation 216 (2010) 2036–2049
2049
[3] K.W. Brodlie, S. Butt, Preserving convexity using piecewise cubic interpolation, Computers and Graphics 15 (1) (1991) 15–23. [4] S. Butt, K.W. Brodlie, Preserving positivity using piecewise cubic interpolation, Computers and Graphics 17 (1) (1993) 55–64. [5] P. Costantini, T.N.T. Goodman, C. Manni, Constructing C3 shape-preserving interpolating space curves, Advances in Computational Mathematics 14 (2001) 103–127. [6] Q. Duan, H. Zhang, Y. Zhang, E.H. Twizell, Error estimation of a kind of rational spline, Journal of Computational and Applied Mathematics 200 (1) (2007) 1–11. [7] R.D. Fahr, M. Kallay, Monotone linear rational spline interpolation, Computer Aided Geometric Design 9 (1992) 313–319. [8] T.N.T. Goodman, B.H. Ong, K. Unsworth, Constrained interpolation using rational cubic splines, in: G. Farin (Ed.), Proceedings of NURBS for Curve and Surface Design, 1991, pp. 59–74. [9] T.N.T. Goodman, B.H. Ong, M.L. Sampoli, Automatic interpolation by fair, shape-preserving G2 space curves, Computer Aided Design 30 (1998) 813– 822. [10] T.N.T. Goodman, Shape preserving interpolation by curves, in: J. Levesley, I.J. Anderson, J.C. Mason (Eds.), Algorithms for Approximation, vol. 4, University of Huddersfeld Proceeding Published, 2002, pp. 24–35. [11] J.A. Gregory, M. Sarfraz, A rational cubic spline with tension, Computer Aided Geometric Design 7 (1–4) (1990) 1–13. [12] M. Hussain, M.Z. Hussain, G. Randriambelosoa, Measurement of accuracy of rational cubic function, Italian Journal of Pure and Applied Mathematics 25 (2009) 143–156. [13] M.Z. Hussain, M. Sarfraz, Positivity – preserving interpolation of positive data by rational cubics, Journal of Computational and Applied Mathematics 218 (2) (2008) 446–458. [14] M. Sarfraz, S. Butt, M.Z. Hussain, Visualization of the shaped data by rational cubic interpolation, Computers and Graphics (2001) 833–845. [15] B.I. Kvasov, Algorithms for shape preserving local approximation with automatic selection of tension parameters, Computer Aided Geometric Design 17 (2000) 17–37. [16] P. Lamberti, C. Manni, Shape preserving C2 functional interpolation via parametric cubics, Numerical Algorithms 28 (2001) 229–254. [17] M. Sarfraz, A rational cubic spline for the visualization of monotonic data, Computers and Graphics 24 (2000) 509–516. [18] M. Sarfraz, M.Z. Hussain, S. Butt, A rational spline for visualizing positive data, in: Proceedings of the IEEE International Conference on Information Visualization, London, UK, July 19–21, 2000, pp. 57–62. [19] M. Sarfraz, M.Z. Hussain, Data visualization using rational spline interpolation, Journal of Computational and Applied Mathematics 189 (2006) 513– 525. [20] J.W. Schmidt, W. Heb, Positivity of cubic polynomial on intervals and positive spline interpolation, BIT 28 (1988) 340–352. [21] N. Dejdumrong, S. Tongtar, The generation of G1 cubic Bezier curve fitting for thai consonant contour, geometic modeling and imaging – new advances, in: M. Sarfraz, E. Banissi (Eds.), IEEE Computer Society, USA, 2007, pp. 48–53, ISBN: 0-7695-2901-1. [22] M. Sarfraz, M.Z. Hussain, F.S. Chaudry, Shape preserving cubic spline for data visualization, Computer Graphics and CAD/CAM 01 (2005) 185–193.