1 Introduction

Trigonometric spline curves have become the significant graphic approach to depict 2D data in various upcoming fields such as industrial design, computer graphics, data analysis and scientific visualization. In computer graphics, Bernstein–Bézier functions are often used for graphic purposes due to its productive geometric properties. When a designer desires to interpolate the intrinsic-shaped data (positive, monotone and convex) with Bézier functions, these functions are unable to preserve the specific shape of the data. The trigonometric spline functions serve as an alternative choice for the designer and guarantee the shape characteristics of the data, satisfying all the geometric properties of Bézier functions, i.e., end point interpolation, convex hull, affine invariance and variation diminishing.

A plenty of work (Butt and Brodlie 1993; Costantini 2000; Cravero and Manni 2003; Duan et al. 2007; Floater and Pe˜na 2000; Han 2004, 2014; Hussain et al. 2014; Ibraheem et al. 2012; Kvasov 2013; Kouibia and Pasadas 2001, 2003; Sarfraz et al. 2013, 2014; Verlan 2010) has been done in the area of shape preservation. Butt and Brodlie (1993) worked on a positivity-preserving curve scheme for positive data. To preserve the positivity of positive data, the cubic Hermite interpolation was used. The authors in (Butt and Brodlie 1993) inserted some extra knots, if anywhere in the subinterval the polynomial failed to preserve the shape of the curve. Costantini (2000) presented polynomials with variable degree to create curves and surfaces. These polynomials were good like cubic polynomials with respect to their geometric effects. Furthermore, Costantini (2000) used the presented polynomials as a parameter tool to govern the shape of \( C^{2} \) B-spline or NURBS curves and surfaces. Cravero and Manni (2003) established a \( C^{3} \) interpolant for shape preservation of the positive, monotone and convex data. The established schemes were global and equally suitable for data with or without derivatives. Likewise, the tension parameters were introduced for shape handling. Han (2004) built the cubic trigonometric polynomial with shape parameter to approximate the cubic B-spline curves. But the curves drawn by the proposed methods were nearer to the convex hull than the B-spline curves.

Han (2014) presented trigonometric polynomials based on the symmetric basis. Han (2014) estimated the convergence of the derivatives of the proposed trigonometric polynomials. Also, some properties of the proposed trigonometric polynomials were discussed such as non-negativity, linear independence and degree elevation of basis functions. Hussain et al. (2014) developed a control point form of \( GC^{1} \) quadratic trigonometric functions with two free parameters in each subinterval. Constraints were derived on these free parameters to interpolate the shape of positive, monotone and convex data. These parameters were also helpful to obtain the more flexible tangents at both ends of each subinterval.

Ibraheem et al. (2012) discussed positivity using rational cubic trigonometric function. The rational cubic trigonometric function was defined piecewise with four free parameters over each subinterval. Two parameters were constrained for shape preservation, whereas two parameters were left free for further shape amendment. Kvasov (2013) constructed algorithms using weighted cubic splines for discrete data sets. Those algorithms were used to preserve monotonicity and convexity with the automatic choice of the shape-controlling parameters. Kouibia and Pasadas (2001) developed a shape-preserving method of interpolation for scattered data. Verlan (2010) developed an algorithm which was used to preserve the convexity for the given data. In this persistence, \( C^{2} \) spline of arbitrary degree was used.

In this paper, two schemes were developed to preserve the shape of the positive and constrained data. Positive data is raised from population density, probability distribution and amount of monthly rainfall. The inspection of gas leakage during the process of experiments is also a good illustration of positive data. The applications of constrained data are in the fields of medicine, transport and optimization theory, etc. The developed schemes have the following benefits:

  • A new \( GC^{1} \) cubic trigonometric spline function is developed.

  • The developed cubic trigonometric spline function has two free parameters in its description. One free parameter is constrained to preserve the inherited shape of the data, whereas the other free parameter is used to modify the shape of the curve. However, in (Ibraheem et al. 2012; Sarfraz et al. 2013), four parameters were used in the construction of spline functions, from which two parameters were constrained for the shape preservation of the data while the remaining two parameters were free to modify the shape of the curve.

  • The developed schemes are local and work equally for uniform and non-uniform data.

  • Unlike Butt and Brodlie (1993), no extra knots are inserted.

  • In Hussain et al. (2014), \( GC^{1} \) quadratic trigonometric function with two shape parameters was developed and both parameters were constrained. So, there was no freedom to the user for shape modification.

  • The error approximation of the developed cubic trigonometric spline function is of order three.

This paper is organized as follows. Section 2 describes the developed \( GC^{1} \) cubic trigonometric function. In Sect. 3, the error approximation of \( GC^{1} \) cubic trigonometric spline function is calculated. Constraints on free parameter are derived in Sect. 4 to preserve the shape of positive and constrained data. Section 5 establishes the graphical view of the schemes developed in Sect. 4. Finally, Sect. 6 concludes the paper.

2 Cubic Trigonometric Spline Function

Consider the data \( \left\{ {\left( {x_{i} , f_{i} } \right) ;i = 0, 1, 2, \ldots , n} \right\} \) over the interval [a, b] with the knots \( a = x_{0} < x_{1} < x_{2} < \cdots < x_{n} = b \). The cubic trigonometric function over each subinterval \( I_{i} = \left[ {x_{i} , x_{i + 1} } \right] \), \( i = 0, 1, 2, \ldots , n - 1 , \) is defined as:

$$ S_{i} \left( x \right) = \mathop \sum \limits_{l = 0}^{3} A_{l} \left( x \right)P_{l } \forall x \in \left[ {x_{i} , x_{i + 1} } \right], $$
(1)

where

$$ \begin{aligned} A_{0} & = \left( {1 - \sin \theta } \right)^{3} ,\;A_{1} = 3\sin \theta - 4{ \sin }^{2} \theta + { \sin }^{3} \theta , \hfill \\ A_{2} & = 3\cos \theta - 4{ \cos }^{2} \theta + { \cos }^{3} \theta ,\;A_{3} = \left( {1 - \cos \theta } \right)^{3} , \hfill \\ \end{aligned} $$

\( \theta = \frac{\pi }{2}\delta , \delta = \frac{{x - x_{i} }}{{h_{i} }} ,h_{i} = x_{i + 1} - x_{i} , i = 0, 1, 2, \cdots , n - 1 . \)

\( A_{l} \left( x \right), l = 0, 1, 2, 3 \) are the cubic trigonometric basis functions and \( P_{l} \left( x \right), l = 0, 1, 2, 3 \) are the control points. Applying the \( C^{1} \) conditions: \( S\left( {x_{i} } \right) = f_{i} , S\left( {x_{i + 1} } \right) = f_{i + 1} , S^{'} \left( {x_{i} } \right) = d_{i} , S^{'} \left( {x_{i + 1} } \right) = d_{i + 1} \). The cubic trigonometric function (1) takes the form:

$$ \begin{aligned} S_{i} \left( x \right) = \left( {1 - \sin \theta } \right)^{3} f_{i} + \left( {3\sin \theta - 4\sin^{2} \theta + \sin^{3} \theta } \right)\left( {f_{i} + \frac{{2h_{i} d_{i} }}{3\pi }} \right) \hfill \\ \quad \quad + \left( {3\cos \theta - 4\cos^{2} \theta + \cos^{3} \theta } \right)\left( {f_{i + 1} + \frac{{2h_{i} d_{i + 1} }}{3\pi }} \right) + \left( {\left( {1 - \cos \theta } \right)^{3} } \right)f_{i + 1} . \hfill \\ \end{aligned} $$
(2)

The cubic trigonometric spline function (2) has fixed value of derivatives at each end of each subinterval. The elasticity of the derivative values is attained by implementing \( GC^{1} \) continuity conditions on the cubic trigonometric spline function (2) as follows:

$$ S_{i - 1}^{\prime } \left( {x_{{i|\theta = \frac{\pi }{2}}} } \right) = \varGamma_{1} S_{i}^{\prime } \left( {x_{i|\theta = 0} } \right)\forall i,\;\varGamma_{1} = \frac{1}{{\alpha_{i} + \beta_{i} }} \ne 1, $$
$$ S_{i}^{'} \left( {x_{{i + 1|\theta = \frac{\pi }{2}}} } \right) = \varGamma_{2} S_{i + 1}^{'} \left( {x_{i + 1|\theta = 0} } \right)\forall i, \varGamma_{2} = \frac{1}{{\alpha_{i} + \beta_{i} }} \ne 1, $$

i.e.,

$$ d_{i} \to \frac{{d_{i} }}{{\alpha_{i} + \beta_{i} }} ,\quad d_{i + 1} \to \frac{{d_{i + 1} }}{{\alpha_{i} + \beta_{i} }}, $$

where \( \alpha_{i} > 0 \) and \( \beta_{i} > 0 \) are the parameters.

The cubic trigonometric spline function (2) is transformed into \( GC^{1} \) cubic trigonometric spline function described as:

$$ S_{i} \left( x \right) = \mathop \sum \limits_{l = 0}^{3} A_{l} \left( x \right)B_{l } \forall x \in \left[ {x_{i} , x_{i + 1} } \right], $$
(3)

where

$$ B_{0} = f_{i} , B_{1} = f_{i} + \frac{{2h_{i} d_{i} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}}, \, B_{2} = f_{i + 1} + \frac{{2h_{i} d_{i + 1} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}}, B_{3} = f_{i + 1} . $$

2.1 Geometric Properties

The developed cubic trigonometric function (1) has the following properties.

  1. 1.

    The cubic trigonometric function (1) interpolates the end points of each subinterval, i.e., \( S_{i} \left( {x_{i} } \right)|_{\theta = 0} = P_{0} \) and \( S_{i} \left( {x_{i + 1} } \right)|_{{\theta = \frac{\pi }{2}}} = P_{3} \).

  2. 2.

    The sum of all basis functions is one, i.e., \( \mathop \sum \nolimits_{l = 0}^{3} A_{l} \left( x \right) = 1 \) and \( A_{l} \left( x \right), l = 0, 1, 2, 3 \) are all non- negative. That means the cubic trigonometric function (1) is confined to the convex hull of its control points \( P_{l} \left( x \right), l = 0, 1, 2, 3 \). Its graphical view is shown in Fig. 1a.

    Fig. 1
    figure 1

    a Cubic trigonometric function and its control polygon and b variation diminishing property for cubic trigonometric function

  3. 3.

    The cubic trigonometric function (1) is invariant under the affine transformation. Let U be an affine transformation defined as: \( U\left( X \right) = FX + U_{1} \), where \( F \) is the affine transformation matrix, \( X \) the vector to be transformed and \( U_{1} \) the translation vector. Applying affine transformation to cubic trigonometric function (1),

    $$ U\left( {S_{i} \left( x \right)} \right) = U\left( {\mathop \sum \limits_{l = 0}^{3} A_{l} \left( x \right)P_{l} } \right) = F\mathop \sum \limits_{l = 0}^{3} A_{l} \left( x \right)P_{l} + U_{1} . $$

    Since \( \mathop \sum \nolimits_{l = 0}^{3} A_{l} \left( x \right) = 1 \), the above expression can be written as:

    $$ \begin{aligned} U(S_{i} (x)) &= U\left( {\sum\limits_{l = 0}^{3} {A_{l} (x)P_{l} } } \right) = F\sum\nolimits_{l = 0}^{3} {A_{l} (x)P_{l} } + \sum\limits_{l = 0}^{3} {A_{l} (x)} U_{1} \hfill \\ &= \sum\limits_{l = 0}^{3} {A_{l} (x)} (FP_{l} + U_{1} ) = \sum\limits_{l = 0}^{3} {A_{l} (x)} U(P_{l} ). \hfill \\ \end{aligned} $$
  4. 4.

    The cubic trigonometric function (1) also satisfies the variation diminishing property, i.e., an arbitrary line is drawn over the curve cuts it less than or equal to the number of cuts with the control polygon. Its graphical view is shown in Fig. 1b.

2.2 Observation

The parameters \( \alpha_{i} \) and \( \beta_{i} \) are defined as free parameters. The parameter \( \beta_{i} \) has a major effect on the graphical view of the data, whereas \( \alpha_{i} \) can take any positive real value. However, \( GC^{1} \) cubic trigonometric spline function (3) has naturally an oscillatory behavior due to its basis functions which involves sine and cosine functions. Therefore, to obtain the shape-preserving results of the shape-preserving data, it is essential to constrain the parameter. Its mathematical proofs and graphical demonstration can be seen in Sects. 4 and 5, respectively. It is observed that for the particular value of \( \beta_{i} \) in a certain interval, the \( GC^{1} \) cubic trigonometric function (3) converges toward a straight line. This observation is illustrated through the closed data set

$$ \left\{ {\left( {x_{i} , f_{i} } \right):\left( {0, 1} \right), \left( {1, 4} \right), \left( {2, 1} \right), \left( {3, 4} \right), \left( {0, 1} \right) } \right\} $$

and simple closed data set

$$ \left\{ {\left( {x_{i} , f_{i} } \right):\left( { - 1, 0} \right), \left( {0, - 1} \right), \left( {1, 0} \right), \left( {0, 1} \right), \left( { - 1, 0} \right) } \right\}. $$

Figures 2a and 3a show the smooth closed curves, but as the value of \( \beta_{i } \) is increased to \( 0.05 \), the cubic trigonometric spline function (3) converges to a straight line as shown in Figs. 2b and 3b, while the value of \( \alpha_{i} \) is 0.37.

Fig. 2
figure 2

a \( GC^{1} \) cubic trigonometric spline function with parameters \( \alpha_{i} = 0.37,\; \beta_{i} = 0.01. \) b \( GC^{1} \) cubic trigonometric spline function with parameters \( \alpha_{i} = 0.37,\; \beta_{i} = 0.05 \)

Fig. 3
figure 3

a \( GC^{1} \) cubic trigonometric spline function with parameters \( \alpha_{i} = 0.37 , \beta_{i} = 0.001. \) b \( GC^{1} \) cubic trigonometric spline function with parameters \( \alpha_{i} = 0.37, \beta_{i} = 0.05 \)

3 Error Approximation of Cubic Trigonometric Spline Function

This section focuses on the approximation properties of \( GC^{1} \) cubic trigonometric spline function (3). It is supposed that the data are generated from third-order continuously differentiable function. Since the developed spline function in Sect. 2 is local, the error of approximation is calculated in the subinterval \( I_{i} = \left[ {x_{i} , x_{i + 1} } \right] \). The absolute error is expressed in terms of Peano kernel (Duan et al. 2007) as follows:

$$ R\left[ f \right] = f\left( x \right) - S_{i} \left( x \right) = \frac{1}{2}\mathop \int \limits_{{x_{i} }}^{{x_{i + 1} }} f^{\left( 3 \right)} \left( \tau \right)R_{x} \left[ {\left( {x - \tau } \right)_{ + }^{2} } \right]d\tau . $$
(4)

It is assumed that the function being interpolated is \( f\left( x \right) \in C^{3} \left[ {x_{0} , x_{n} } \right] \). The absolute error in \( I_{i} = \left[ {x_{i} , x_{i + 1} } \right] \) is

$$ \left| {f\left( x \right) - S_{i} \left( x \right)} \right| \le \frac{1}{2}||f^{\left( 3 \right)} \left( \tau \right)||\int \nolimits_{{x_{i} }}^{{x_{i + 1} }} \left| {R_{x} \left[ {\left( {x - \tau } \right)_{ + }^{2} } \right]} \right|d\tau , $$

where \( R_{x} \) is the Peano kernel and \( \left( {x - \tau } \right)_{ + }^{2} \) is the truncated power function. The truncated power function \( R_{x} \left[ {\left( {x - \tau } \right)_{ + }^{2} } \right] \) is partitioned into two subintervals as follows:

$$ R_{x} \left[ {\left( {x - \tau } \right)_{ + }^{2} } \right] = \left\{ {\begin{array}{*{20}c} {r\left( {\tau , x} \right)} & {x_{i} < \tau < x} \\ {s\left( {\tau , x} \right)} & {x < \tau < x_{i + 1} } \\ \end{array} } \right.. $$

Therefore, the integral involved in (4) can be expressed as:

$$ \mathop \int \limits_{{x_{i} }}^{{x_{i + 1} }} \left| {R_{x} \left[ {\left( {x - \tau } \right)_{ + }^{2} } \right]} \right|d\tau = \mathop \int \limits_{{x_{i} }}^{x} \left| {r\left( {\tau , x} \right)} \right|d\tau + \mathop \int \limits_{x}^{{x_{i + 1} }} \left| {s\left( {\tau , x} \right)} \right|d\tau . $$
(5)

For the \( GC^{1} \) cubic trigonometric spline function (3), \( r\left( {\tau , x} \right) \) and \( s\left( {\tau , x} \right) \) have the value

$$ r\left( {\tau , x} \right) = \left( {x - \tau } \right)^{2} - \left\{ {\left( {A_{2} + A_{3} } \right)\left( {x_{i + 1} - \tau } \right)^{2} - \frac{{2h_{i} A_{2} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}}\left( {x_{i + 1} - \tau } \right)} \right\} , $$
$$ s\left( {\tau , x} \right) = - \left\{ {\left( {A_{2} + A_{3} } \right)\left( {x_{i + 1} - \tau } \right)^{2} - \frac{{2h_{i} A_{2} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}}\left( {x_{i + 1} - \tau } \right)} \right\} , $$
$$ A_{2} = 3\cos \theta - 4{ \cos }^{2} \theta + { \cos }^{3} \theta ,\;A_{3} = \left( {1 - \cos \theta } \right)^{3} . $$

To calculate the integral of absolute values in (5), the roots of \( r\left( {\tau , x} \right) \) and \( s\left( {\tau , x} \right) \) are calculated. The roots of \( r\left( {x, x} \right) \) in \( \left[ {0, 1} \right] \) are \( \delta = 0 , \delta = 1 \) and \( \delta = 1 - \frac{{8 - 6\left( {\alpha_{i} + \beta_{i} } \right)}}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}} \). Let \( 1 - \frac{{8 - 6\left( {\alpha_{i} + \beta_{i} } \right)}}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}} = \delta^{*} \).

To calculate the roots of \( r\left( {\tau , x} \right) \), it is rearranged as:

$$ \begin{aligned} r\left( {\tau , x} \right) = \left( {1 - A_{2} + A_{3} } \right)\left( {x - \tau } \right)^{2} + 2h_{i} \left( {\frac{{A_{2} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}} - \left( {1 - \delta } \right)\left( {A_{2} + A_{3} } \right)} \right)\left( {x - \tau } \right) \hfill \\ + h_{i}^{2} \left( {\frac{{2A_{2} \left( {1 - \delta } \right)}}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}} - \left( {A_{2} + A_{3} } \right)\left( {1 - \delta } \right)^{2} } \right) . \hfill \\ \end{aligned} $$

The roots of \( r\left( {\tau , x} \right) = 0 \) are \( \tau_{1} = x + h_{i} \left( {\frac{B - D}{A}} \right) \) and \( \tau_{2} = x + h_{i} \left( {\frac{B + D}{A}} \right) \), where \( A = \left( {1 - A_{2} + A_{3} } \right) \), \( B = \left( {\frac{{A_{2} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}} - \left( {1 - \delta } \right)\left( {A_{2} + A_{3} } \right)} \right) \), and

$$ D = \sqrt {\left( {\frac{{A_{2} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}} - \left( {1 - \delta } \right)\left( {A_{2} + A_{3} } \right)} \right)^{2} - \left( {1 - A_{2} + A_{3} } \right)\left( {\frac{{2A_{2} \left( {1 - \delta } \right)}}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}} - \left( {A_{2} + A_{3} } \right)\left( {1 - \delta } \right)^{2} } \right)}. $$

The roots of \( s\left( {\tau , x} \right) \) are \( \tau^{*} = x_{i + 1} \) and \( \tau^{*} = x_{i + 1} - \frac{{2h_{i} A_{2} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)\left( {A_{2} + A_{3} } \right)}}. \)

From the above discussion, the following cases arise:

Part 1: For \( 0 \le \delta \le \delta^{*} , \left( {\alpha_{i} + \beta_{i} } \right) \in \left[ {\frac{8}{{3\left( {\pi + 2} \right)}} , \frac{3}{4}} \right] , \)

$$ \left| {f\left( x \right) - S_{i} \left( x \right)} \right| \le \frac{1}{2}||f^{\left( 3 \right)} \left( \tau \right)||h_{i}^{3} \lambda_{1} \left( {\alpha_{i} , \beta_{i} ,\delta } \right), $$
(6)

where

$$ \begin{aligned} \lambda_{1} \left( {\alpha_{i} , \beta_{i} ,\delta } \right) & = \int \limits_{{x_{i} }}^{x} \left| {r\left( {\tau , x} \right)} \right|d\tau + \int \limits_{x}^{{x_{i + 1} }} \left| {s\left( {\tau , x} \right)} \right|d\tau \\ \quad & = - \int \limits_{{x_{i} }}^{{\tau_{1} }} r\left( {\tau , x} \right)d\tau + \int \limits_{{\tau_{1} }}^{x} r\left( {\tau , x} \right)d\tau - \int \limits_{x}^{{\tau^{*} }} s\left( {\tau , x} \right)d\tau + \int \limits_{{\tau^{*} }}^{{x_{i + 1} }} s\left( {\tau , x} \right)d\tau \\ \quad & = - \frac{2}{3}\left( {1 - A_{2} + A_{3} } \right)\left( {\frac{B - D}{A}} \right)^{3} + 2\left( {\frac{{A_{2} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}} - \left( {1 - \delta } \right)\left( {A_{2} + A_{3} } \right)} \right)\left( {\frac{B - D}{A}} \right)^{2} \\ & \quad - 2\left( {\frac{{2A_{2} \left( {1 - \delta } \right)}}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}} - \left( {A_{2} + A_{3} } \right)\left( {1 - \delta } \right)^{2} } \right)\left( {\frac{B - D}{A}} \right) - \frac{1}{3}\left( {1 - A_{2} + A_{3} } \right)\delta^{3} \\ & \quad - \left( {\frac{{A_{2} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}} - \left( {1 - \delta } \right)\left( {A_{2} + A_{3} } \right)} \right)\delta^{2} - \left( {\frac{{2A_{2} \left( {1 - \delta } \right)}}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}} - \left( {A_{2} + A_{3} } \right)\left( {1 - \delta } \right)^{2} } \right)\delta \\ & \quad - \frac{1}{3}\left( {A_{2} + A_{3} } \right)\left( {2\left( {\frac{{2A_{2} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)\left( {A_{2} + A_{3} } \right)}}} \right)^{3} - \left( {1 - \delta } \right)^{3} } \right) + \frac{{A_{2} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}} \\ & \quad \left( {2\left( {\frac{{2A_{2} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)\left( {A_{2} + A_{3} } \right)}}} \right)^{2} - \left( {1 - \delta } \right)^{2} } \right). \end{aligned} $$

Part 2: For \( \delta^{*} \le \delta \le 1, \left( {\alpha_{i} + \beta_{i} } \right) \in \left[ {\frac{8}{{3\left( {\pi + 2} \right)}} , \frac{3}{4}} \right] , \)

$$ | {f( x ) - S_{i} ( x )} | \le \frac{1}{2}\|f^{(3)} (\tau)\|h_{i}^{3} \lambda_{2} (\alpha_{i}, \beta_{i}, \delta), $$
(7)

where

$$ \begin{aligned} \lambda_{2} \left( {\alpha_{i} , \beta_{i} ,\delta } \right) = \int \limits_{{x_{i} }}^{x} \left| {r\left( {\tau , x} \right)} \right|d\tau + \int \limits_{x}^{{x_{i + 1} }} \left| {s\left( {\tau , x} \right)} \right|d\tau \hfill \\ \quad = \int \limits_{{x_{i} }}^{{\tau_{1} }} r\left( {\tau , x} \right)d\tau - \int \limits_{{\tau_{1} }}^{{\tau_{2} }} r\left( {\tau , x} \right)d\tau + \int \limits_{{\tau_{2} }}^{x} s\left( {\tau , x} \right)d\tau + \int \limits_{x}^{{x_{i + 1} }} s\left( {\tau , x} \right)d\tau \hfill \\ \quad= \frac{2}{3}\left( {1 - A_{2} + A_{3} } \right)\left( {\frac{B - D}{A}} \right)^{3} - 2\left( {\frac{{A_{2} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}} - \left( {1 - \delta } \right)\left( {A_{2} + A_{3} } \right)} \right)\left( {\frac{B - D}{A}} \right)^{2} \hfill \\ \qquad+ 2\left( {\frac{{2A_{2} \left( {1 - \delta } \right)}}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}} - \left( {A_{2} + A_{3} } \right)\left( {1 - \delta } \right)^{2} } \right)\left( {\frac{B - D}{A}} \right) + \frac{2}{3}\left( {1 - A_{2} + A_{3} } \right)\left( {\frac{B + D}{A}} \right)^{3} \hfill \\ \qquad+ 2\left( {\frac{{A_{2} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}} - \left( {1 - \delta } \right)\left( {A_{2} + A_{3} } \right)} \right)\left( {\frac{B + D}{A}} \right)^{2} + 2\left( {\frac{{2A_{2} \left( {1 - \delta } \right)}}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}}} \right. \hfill \\ \qquad\left. -{ \left( {A_{2} + A_{3} } \right)\left( {1 - \delta } \right)^{2} } \right)\left( {\frac{B + D}{A}} \right) + \frac{1}{3}\left( {1 - A_{2} + A_{3} } \right)\delta^{3} + \left( {\frac{{A_{2} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}}} \right. \hfill \\ \qquad\left( {1 - \delta } \right)^{3} + \frac{{A_{2} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}}\left( {1 - \delta } \right)^{2} . \hfill \\ \end{aligned} $$

The above discussion can be briefed as:

Theorem 1 The error of \( GC^{1} \) cubic trigonometric spline function (3), for \( f\left( x \right) \in C^{3} \left[ {x_{0} , x_{n} } \right] \), in each subinterval \( I_{i} = \left[ {x_{i} , x_{i + 1} } \right] \) is

$$ \left| {f\left( x \right) - S_{i} \left( x \right)} \right| \le \frac{1}{2}||f^{\left( 3 \right)} \left( \tau \right)||h_{i}^{3} C_{i} , C_{i} = \mathop {\hbox{max} }\limits_{0 \le \delta \le 1} \varphi \left( {\alpha_{i} , \beta_{i} , \delta } \right), $$
$$ \varphi \left( {\alpha_{i} , \beta_{i} , \delta } \right) = \left\{ {\begin{array}{*{20}c} {\hbox{max} \varphi_{1} \left( {\alpha_{i} , \beta_{i} , \delta } \right)} & {0 \le \delta \le \delta^{*} } \\ {\hbox{max} \varphi_{2} \left( {\alpha_{i} , \beta_{i} , \delta } \right)} & {\delta^{*} \le \delta \le 1} \\ \end{array} } \right.. $$

4 Shape-Preserving Trigonometric Spline Curves

This section describes the schemes for shape-preserving data. In Subsect. 4.1, constraints are derived on the free parameter \( \beta_{i} \) in the description of \( GC^{1} \) trigonometric cubic spline function to preserve the shape of positive data, while Subsect. 4.2 generalizes the scheme developed in Subsect. 4.1 for positive data (data may lie above, below and between any arbitrary straight lines).

4.1 Positive Trigonometric Spline Curve

Consider the positive data \( \left\{ {\left( {x_{i} , f_{i} } \right) ;i = 0, 1, 2, \ldots , n} \right\} \) over the interval \( \left[ {a, b} \right] \) with the knots \( a = x_{0} < x_{1} < x_{2} < \cdots < x_{n} = b \). The \( GC^{1} \) cubic trigonometric spline function (3) inherits the positive shape of the data if in each subinterval \( I_{i} = \left[ {x_{i} , x_{i + 1} } \right] \) and \( i = 0, 1, 2, \ldots , n - 1 \), and the following result holds:

$$ S_{i} \left( x \right) = \mathop \sum \limits_{l = 0}^{3} A_{l} \left( x \right)B_{l } > 0,\forall x \in \left[ {x_{i} , x_{i + 1} } \right] ;, i = 0, 1, 2, \ldots , n - 1. $$

\( S_{i} \left( x \right) > 0 \), if \( A_{l} \left( x \right), l = 0, 1, 2, 3 \) and \( B_{l} , l = 0, 1, 2, 3 \) are positive, since \( A_{l} \left( x \right), l = 0, 1, 2, 3 \) are all positive (all basis functions are non-negative). Therefore, the positivity of \( S_{i} \left( x \right) \) only depends on the positivity of the coefficients \( B_{l} ;l = 0, 1, 2, 3 \). The coefficients \( B_{0} = f_{i} \) and \( B_{3} = f_{i + 1} \) are positive as the data under consideration are positive. \( B_{1} \) is positive if \( B_{1} = f_{i} + \frac{{2h_{i} d_{i} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}} > 0. \) This implies that \( \beta_{i} > - \alpha_{i} - \frac{{2h_{i} d_{i} }}{{3\pi f_{i} }};\alpha_{i} > 0 \), and \( B_{2} \) is positive if \( B_{2} = f_{i + 1} + \frac{{2h_{i} d_{i + 1} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}} > 0. \) This implies that

$$ \beta_{i} > - \alpha_{i} + \frac{{2h_{i} d_{i + 1} }}{{3\pi f_{i + 1} }} ; \alpha_{i} > 0. $$

The above discussion can be briefed as:

Theorem 2 The \( GC^{1} \) cubic trigonometric spline function (3) is positive, if in each subinterval \( I_{i} = \left[ {x_{i} , x_{i + 1} } \right] \), the parameters \( \alpha_{i} \) and \( \beta_{i} \) satisfy the following conditions:

$$ \beta_{i} > max\left\{ {0, - \alpha_{i} - \frac{{2h_{i} d_{i} }}{{3\pi f_{i} }} , - \alpha_{i} + \frac{{2h_{i} d_{i + 1} }}{{3\pi f_{i + 1} }}} \right\} ; \alpha_{i} > 0 . $$

The above conditions can be rearranged as: For any real number \( m_{i} > 0 \),

$$ \beta_{i} = m_{i} + max\left\{ {0, - \alpha_{i} - \frac{{2h_{i} d_{i} }}{{3\pi f_{i} }} , - \alpha_{i} + \frac{{2h_{i} d_{i + 1} }}{{3\pi f_{i + 1} }}} \right\} ; \alpha_{i} > 0 . $$

4.2 Constrained Trigonometric Spline Curve

For constraint data, the three following cases arise:

4.2.1 Case 1: The Data Lie Above a Line

Consider the data \( \left\{ {\left( {x_{i} , f_{i} } \right) ;i = 0, 1, 2, \ldots , n} \right\} \) that lie above any arbitrary straight line \( y = mx + c \), i.e.,

$$ f_{i} > mx_{i} + c,\;i = 0, 1, 2, \ldots , n. $$

The \( GC^{1} \) cubic trigonometric spline function (3) preserves the shape of the given constrained data if in each subinterval \( I_{i} = \left[ {x_{i} , x_{i + 1} } \right] \), \( i = 0, 1, 2, \ldots , n - 1 \), the following relation holds:

$$ S_{i} \left( x \right) > mx_{i} + c, \forall i = 0, 1, 2, \ldots , n - 1. $$
(8)

The parametric form of the straight line \( mx_{i} + c \), \( m > 0 \) (the case \( m < 0 \) can also be dealt in the similar way) can be defined as:

For each subinterval \( I_{i} = \left[ {x_{i} , x_{i + 1} } \right] \), the straight line \( L = mx_{i} + c \) can be written as:

$$ L = \gamma_{i} \left( {1 - \frac{2}{\pi }\theta } \right) + \mu_{i} \frac{2}{\pi }\theta , \gamma_{i} = mx_{i} + c , \mu_{i} = mx_{i + 1} + c . $$
(9)

Substituting relation (9) in relation (8) and after simplification we have

$$ \mathop \sum \limits_{l = 0}^{3} A_{l} \left( x \right)B_{l } - L > 0. $$
(10)

Since \( \sum \nolimits_{l = 0}^{3} A_{l} \left( x \right) = 1 \) (convex hull property), relation (10) becomes

$$ \mathop \sum \limits_{l = 0}^{3} A_{l} \left( x \right)B_{l } - \mathop \sum \limits_{l = 0}^{3} A_{l} \left( x \right)L = \mathop \sum \limits_{l = 0}^{3} A_{l} \left( x \right)M_{l } > 0 , $$
(11)

where

$$ M_{0} = f_{i} - L , M_{1} = \left( {\left( {f_{i} - L} \right) + \frac{{2h_{i} d_{i} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}}} \right) , $$

\( M_{2} = \left( {\left( {f_{i + 1} - L} \right) + \frac{{2h_{i} d_{i + 1} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}}} \right) , M_{3} = f_{i + 1} - L. \)

In relation (11), \( \sum \nolimits_{l = 0}^{3} A_{l} \left( x \right)M_{l } > 0 \) if \( A_{l} \left( x \right), l = 0, 1, 2, 3 \) and \( M_{l} , l = 0, 1, 2, 3 \) are positive. Since \( A_{l} \left( x \right), l = 0, 1, 2, 3 \) are all positive (all basis functions are non-negative), the positivity of \( \sum \nolimits_{l = 0}^{3} A_{l} \left( x \right)M_{l } \) only depends on the positivity of the coefficients \( M_{l} , l = 0, 1, 2, 3 \).

\( M_{0} > 0 \) and \( M_{3} > 0 \) as the data under consideration lie above the straight line. \( M_{1} > 0 \) if \( \left( {f_{i} - L} \right) + \frac{{2h_{i} d_{i} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}} > 0 \). This implies that \( \beta_{i} > - \alpha_{i} - \frac{{2h_{i} d_{i} }}{{3\pi \left( {f_{i} - L} \right)}};\alpha_{i} > 0, \) and \( M_{2} > 0 \) if \( \left( {f_{i + 1} - L} \right) + \frac{{2h_{i} d_{i + 1} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}} > 0. \) This implies that \( \beta_{i} > - \alpha_{i} + \frac{{2h_{i} d_{i + 1} }}{{3\pi \left( {f_{i + 1} - L} \right)}}; \alpha_{i} > 0. \)

The above discussion can be briefed as:

Theorem 3

The \( GC^{1} \) cubic trigonometric spline function (3) lies above the given straight line, if in each subinterval \( I_{i} = \left[ {x_{i} , x_{i + 1} } \right] \), the parameters \( \alpha_{i} \) and \( \beta_{i} \) satisfy the following conditions:

$$ \beta_{i} > { \hbox{max} }\left\{ {0, - \alpha_{i} - \frac{{2h_{i} d_{i} }}{{3\pi \left( {f_{i} - {\text{L}}} \right)}} , - \alpha_{i} + \frac{{2h_{i} d_{i + 1} }}{{3\pi \left( {f_{i + 1} - {\text{L}}} \right)}}} \right\}; \alpha_{i} > 0. $$

The above conditions can be rearranged as follows: for any real number \( t_{i} > 0 \),

$$ \beta_{i} = t_{i} + { \hbox{max} }\left\{ {0, - \alpha_{i} - \frac{{2h_{i} d_{i} }}{{3\pi \left( {f_{i} - {\text{L}}} \right)}} , - \alpha_{i} + \frac{{2h_{i} d_{i + 1} }}{{3\pi \left( {f_{i + 1} - {\text{L}}} \right)}}} \right\}; \alpha_{i} > 0. $$

4.2.2 Case 2: The Data Lie Below a Line

Consider the data \( \left\{ {\left( {x_{i} , f_{i} } \right) ;i = 0, 1, 2, \ldots , n} \right\} \) that lie below any arbitrary straight line \( y = mx + c \), i.e., \( f_{i} < mx_{i} + c,\;i = 0, 1, 2, \ldots , n. \)

The \( GC^{1} \) cubic trigonometric spline function (3) preserves the shape of the given constrained data if in each subinterval \( I_{i} = \left[ {x_{i} , x_{i + 1} } \right] \), \( i = 0, 1, 2, \ldots , n - 1, \) the following relation holds:

$$ S_{i} \left( x \right) < mx_{i} + c, \forall i = 0, 1, 2, \ldots , n - 1. $$
(12)

The parametric form of the straight line \( mx_{i} + c \) is defined in relation (9). Substituting the relation (9) in relation (12) and after simplification, we have

$$ L - \mathop \sum \limits_{l = 0}^{3} A_{l} \left( x \right)B_{l } > 0. $$
(13)

Since \( \mathop \sum \nolimits_{l = 0}^{3} A_{l} \left( x \right) = 1 \) (convex hull property), relation (13) becomes

$$ \mathop \sum \limits_{l = 0}^{3} A_{l} \left( x \right)L - \mathop \sum \limits_{l = 0}^{3} A_{l} \left( x \right)B_{l} = \mathop \sum \limits_{l = 0}^{3} A_{l} \left( x \right)N_{l } > 0, $$
(14)

where

$$ N_{0} = L - f_{i} , N_{1} = \left( {\left( {L - f_{i} } \right) + \frac{{2h_{i} d_{i} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}}} \right) , $$
$$ N_{2} = \left( {\left( {L - f_{i + 1} } \right) + \frac{{2h_{i} d_{i + 1} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}}} \right) , N_{3} = L - f_{i + 1} . $$

In relation (14), \( \mathop \sum \nolimits_{l = 0}^{3} A_{l} \left( x \right)N_{l } > 0 \) if \( A_{l} \left( x \right), l = 0, 1, 2, 3 \) and \( N_{l } , l = 0, 1, 2, 3 \) are positive. Since \( A_{l} \left( x \right), l = 0, 1, 2, 3 \) are all positive (all basis functions are non-negative), the positivity of \( \mathop \sum \nolimits_{l = 0}^{3} A_{l} \left( x \right)N_{l } \) only depends on the positivity of the coefficients \( N_{l } , l = 0, 1, 2, 3 \). \( N_{0} > 0 \) and \( N_{3} > 0 \) as the data under consideration lie below the straight line. \( N_{1} > 0 \) if \( \left( {L - f_{i} } \right) + \frac{{2h_{i} d_{i} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}} > 0. \) This implies that

$$ \beta_{i} > - \alpha_{i} - \frac{{2h_{i} d_{i} }}{{3\pi \left( {\left( {L - f_{i} } \right)} \right)}} ; \alpha_{i} > 0 $$

and \( N_{2} > 0 \) if \( \left( {L - f_{i + 1} } \right) + \frac{{2h_{i} d_{i + 1} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}} > 0. \) This implies that

$$ \beta_{i} > - \alpha_{i} + \frac{{2h_{i} d_{i + 1} }}{{3\pi \left( {L - f_{i + 1} } \right)}} ; \alpha_{i} > 0. $$

The above discussion can be briefed as:

Theorem 4

The \( GC^{1} \) cubic trigonometric spline function (3) lies below the given straight line, if in each subinterval \( I_{i} = \left[ {x_{i} , x_{i + 1} } \right] \), the parameters \( \alpha_{i} \) and \( \beta_{i} \) satisfy the following conditions:

$$ \beta_{i} > { \hbox{max} }\left\{ {0, - \alpha_{i} - \frac{{2h_{i} d_{i} }}{{3\pi \left( {{\text{L}} - f_{i} } \right)}} , - \alpha_{i} + \frac{{2h_{i} d_{i + 1} }}{{3\pi \left( {{\text{L}} - f_{i + 1} } \right)}}} \right\}; \alpha_{i} > 0. $$

The above conditions can be rearranged as: for any real number \( u_{i} > 0 \),

$$ \beta_{i} = u_{i} + { \hbox{max} }\left\{ {0, - \alpha_{i} - \frac{{2h_{i} d_{i} }}{{3\pi \left( {{\text{L}} - f_{i} } \right)}} , - \alpha_{i} + \frac{{2h_{i} d_{i + 1} }}{{3\pi \left( {{\text{L}} - f_{i + 1} } \right)}}} \right\}; \alpha_{i} > 0. $$

4.2.3 Case 3: Data Lie Between Two Lines

Consider the data \( \left\{ {\left( {x_{i} , f_{i} } \right) ;i = 0, 1, 2, \ldots , n} \right\} \) that lie between any two arbitrary straight lines \( y_{1} = m_{1} x + c_{1} \) and \( y_{2} = m_{2} x + c_{2} \), i.e., \( m_{1} x_{i} + c_{1} < f_{i} < m_{2} x_{i} + c_{2} ,\;i = 0, 1, 2, \ldots , n. \)

The \( GC^{1} \) cubic trigonometric spline function (3) preserves the shape of the given constrained data if in each subinterval \( I_{i} = \left[ {x_{i} , x_{i + 1} } \right] \), \( i = 0, 1, 2, \ldots , n - 1, \) the following relation holds:

$$ m_{1} x_{i} + c_{1} < S_{i} \left( x \right) < m_{2} x_{i} + c_{2} , \forall i = 0, 1, 2, \ldots , n - 1, $$
(15)

where the parametric form of the straight line \( L_{1} = m_{1} x_{i} + c_{1} \) and \( L_{2} = m_{2} x_{i} + c_{2} ;m_{1} ,m_{2} > 0 \) (the case \( m_{1} ,m_{2} < 0 \) can also be dealt in a similar way) can be defined as:

$$ L_{1} = \gamma_{i}^{1} \left( {1 - \frac{2}{\pi }\theta } \right) + \mu_{i}^{1} \frac{2}{\pi }\theta , \;\gamma_{i}^{1} = m_{1} x_{i} + c_{1} , \;\mu_{i}^{1} = m_{1} x_{i + 1} + c_{1} , $$
$$ L_{2} = \gamma_{i}^{2} \left( {1 - \frac{2}{\pi }\theta } \right) + \mu_{i}^{2} \frac{2}{\pi }\theta , \;\gamma_{i}^{2} = m_{2} x_{i} + c_{2} ,\;\mu_{i}^{2} = m_{2} x_{i + 1} + c_{2} . $$

Substituting the values of \( L_{1} \) and \( L_{2} \) in relation to (15), we have

$$ L_{1} < S_{i} \left( x \right),\;\forall i = 0, 1, 2, \ldots , n - 1. $$
(16)

and

$$ S_{i} \left( x \right) < L_{2} , \forall i = 0, 1, 2, \ldots , n - 1. $$
(17)

Solving relation (16), \( S_{i} \left( x \right) - L_{1} > 0,\;\forall i = 0, 1, 2, \ldots , n - 1, \)

$$ \mathop \sum \limits_{l = 0}^{3} A_{l} \left( x \right)B_{l } - L_{1} > 0 . $$
(18)

Since \( \mathop \sum \nolimits_{l = 0}^{3} A_{l} \left( x \right) = 1 \) (convex hull property), relation (18) becomes

$$ \mathop \sum \limits_{l = 0}^{3} A_{l} \left( x \right)B_{l } - \mathop \sum \limits_{l = 0}^{3} A_{l} \left( x \right)L_{1} = \mathop \sum \limits_{l = 0}^{3} A_{l} \left( x \right)M_{i}^{*} > 0 , $$
(19)

where

$$ M_{0}^{*} = f_{i} - L_{1} , M_{1}^{*} = \left( {\left( {f_{i} - L_{1} } \right) + \frac{{2h_{i} d_{i} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}}} \right) , $$

\( M_{2}^{*} = \left( {\left( {f_{i + 1} - L_{1} } \right) + \frac{{2h_{i} d_{i + 1} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}}} \right) , M_{3}^{*} = f_{i + 1} - L_{1} . \)

In relation (19) \( \mathop \sum \nolimits_{l = 0}^{3} A_{l} \left( x \right)M_{i}^{*} > 0, \) if \( A_{l} \left( x \right), l = 0, 1, 2, 3 \) and \( M_{i}^{*} , l = 0, 1, 2, 3 \) are positive. Since \( A_{l} \left( x \right), l = 0, 1, 2, 3 \) are all positive (all basis functions are non-negative), the positivity of \( \mathop \sum \nolimits_{l = 0}^{3} A_{l} \left( x \right)M_{i}^{*} \) only depends on the positivity of the coefficients \( M_{i}^{*} , l = 0, 1, 2, 3 \).

As \( M_{0}^{*} > 0 \) and \( M_{3}^{*} > 0 \), \( M_{1}^{*} > 0 \) if \( \left( {f_{i} - L_{1} } \right) + \frac{{2h_{i} d_{i} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}} > 0. \) This implies that

$$ \beta_{i} > - \alpha_{i} - \frac{{2h_{i} d_{i} }}{{3\pi \left( {f_{i} - L_{1} } \right)}} ; \alpha_{i} > 0, $$

and \( M_{2}^{*} > 0 \) if \( \left( {f_{i + 1} - L_{1} } \right) + \frac{{2h_{i} d_{i + 1} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}} > 0 \). This implies that \( \beta_{i} > - \alpha_{i} + \frac{{2h_{i} d_{i + 1} }}{{3\pi \left( {f_{i + 1} - L_{1} } \right)}}; \alpha_{i} > 0. \)

Now, solving relation (17),

$$ \begin{aligned} L_{2} - S_{i} \left( x \right) > 0,\forall i = 0, 1, 2, \ldots , n - 1, \hfill \\ L_{2} - \mathop \sum \limits_{l = 0}^{3} A_{l} \left( x \right)B_{l } > 0 . \hfill \\ \end{aligned} $$
(20)

Since \( \mathop \sum \nolimits_{l = 0}^{3} A_{l} \left( x \right) = 1 \) (convex hull property), relation (20) becomes

$$ \mathop \sum \limits_{l = 0}^{3} A_{l} \left( x \right)L_{2} - \mathop \sum \limits_{l = 0}^{3} A_{l} \left( x \right)B_{l } = \mathop \sum \limits_{l = 0}^{3} A_{l} \left( x \right)N_{i}^{*} > 0, $$
(21)

where

$$ N_{0}^{*} = L_{2} - f_{i} , N_{1}^{*} = \left( {\left( {L_{2} - f_{i} } \right) + \frac{{2h_{i} d_{i} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}}} \right) , $$

\( N_{2}^{*} = \left( {\left( {L_{2} - f_{i + 1} } \right) + \frac{{2h_{i} d_{i + 1} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}}} \right) , N_{3}^{*} = L_{2} - f_{i + 1} . \)

In relation (21), \( \mathop \sum \nolimits_{l = 0}^{3} A_{l} \left( x \right)N_{i}^{*} > 0 \) if \( A_{l} \left( x \right), l = 0, 1, 2, 3 \) and \( N_{i}^{*} , l = 0, 1, 2, 3 \) are positive. Since \( A_{l} \left( x \right), l = 0, 1, 2, 3 \) are all positive (all basis functions are non-negative), the positivity of \( \mathop \sum \nolimits_{l = 0}^{3} A_{l} \left( x \right)N_{i}^{*} \) only depends on the positivity of the coefficients \( N_{i}^{*} , l = 0, 1, 2, 3 \).

As \( N_{0}^{*} > 0 \) and \( N_{3}^{*} > 0 \), \( N_{1}^{*} > 0 \) if \( \left( {L_{2} - f_{i} } \right) + \frac{{2h_{i} d_{i} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}} > 0. \) This implies that

$$ \beta_{i} > - \alpha_{i} - \frac{{2h_{i} d_{i} }}{{3\pi \left( {L_{2} - f_{i} } \right)}} ; \alpha_{i} > 0, $$

and \( N_{2}^{*} > 0 \) if \( \left( {L_{2} - f_{i + 1} } \right) + \frac{{2h_{i} d_{i + 1} }}{{3\pi \left( {\alpha_{i} + \beta_{i} } \right)}} > 0. \) This implies that

$$ \beta_{i} > - \alpha_{i} + \frac{{2h_{i} d_{i + 1} }}{{3\pi \left( {L_{2} - f_{i + 1} } \right)}}; \alpha_{i} > 0. $$

Combining the conditions of relation (19) and (21), we have

$$ \beta_{i} > { \hbox{max} }\left\{ {0,a_{1} , a_{2} , a_{3} , a_{4} } \right\} ; \alpha_{i} > 0, $$

\( a_{1} = - \alpha_{i} - \frac{{2h_{i} d_{i} }}{{3\pi \left( {f_{i} - L_{1} } \right)}},\;a_{2} = - \alpha_{i} + \frac{{2h_{i} d_{i + 1} }}{{3\pi \left( {f_{i + 1} - L_{1} } \right)}} \), \( a_{3} = - \alpha_{i} - \frac{{2h_{i} d_{i} }}{{3\pi \left( {L_{2} - f_{i} } \right)}},\;a_{4} - \alpha_{i} + \frac{{2h_{i} d_{i + 1} }}{{3\pi \left( {L_{2} - f_{i + 1} } \right)}}. \)

The above discussion can be briefed as:

Theorem 5

The \( GC^{1} \) cubic trigonometric spline function (3) lies between the given two arbitrary straight lines, if in each subinterval \( I_{i} = \left[ {x_{i} , x_{i + 1} } \right] \), the parameters \( \alpha_{i} \) and \( \beta_{i} \) satisfy the following conditions:

$$ \beta_{i} > max\left\{ {0,a_{1} , a_{2} , a_{3} , a_{4} } \right\} ; \alpha_{i} > 0. $$

The above conditions can be rearranged as:For any real number \( v_{i} > 0 \),\( {\beta }_{i} = v_{i} + { \hbox{max} }\left\{ {0, a_{1} , a_{2} , a_{3} , a_{4} } \right\}; \alpha_{i} > 0 \).

5 Numerical Results

This section is meant for the demonstrations of the shape-preserving schemes developed in Sect. 4.

5.1 Positive Data

The positive data is shown in Table 1. Figure 4a shows the graphical view of the data in Table 1. The \( GC^{1} \) cubic trigonometric spline function (3) is used to draw the data of Table 1 in Fig. 4b for arbitrary values \( \alpha_{i} = 1.4,\; \beta_{i} = 1.9. \) Figure 4b shows some negative behavior of the data in Table 1, while the original data behavior is positive. To resolve this problem, the positivity-preserving scheme developed in Sect. 4.1 is used to draw Fig. 4c for Table 1. It can be clearly observed that Fig. 4c preserves the positive behavior of the data. The effect of \( \alpha_{i} \) on the positive curve of Fig. 4c is shown in Fig. 4d.

Table 1 Positive data
Fig. 4
figure 4

a Graphical view of data in Table 1. b \( GC^{1} \) cubic trigonometric spline function with arbitrary values of parameters \( \alpha_{i} = 1.4,\; \beta_{i} = 1.9. \) c \( GC^{1} \) positive cubic trigonometric function with parameters \( \alpha_{i} = 0.15. \) d \( GC^{1} \) positive cubic trigonometric function with parameters \( \alpha_{i} = 0.0001 \)

5.2 Constrained Data

5.2.1 Case 1: The Data Lie Above a Line

The constrained data taken in Table 2 lies above the straight line \( y = 0.31x + 1 \). Figure 5a shows the graphical view of the data in Table 2. Figure 5b for Table 2 with arbitrary values \( \alpha_{i} = 0.15,\; \beta_{i} = 0.40 \) is drawn using \( GC^{1} \) cubic trigonometric spline function (3). In Fig. 5b, the data in Table 2 lies above the given straight line. This means that the required shape of the data given in Table 2 is not achieved. Figure 5c for Table 2 is produced using the scheme developed in Sect. 4.2 (case 1), which preserves the required shape of the data given in Table 2. By varying the value of the free parameter \( \alpha_{i} \), Fig. 5d is produced to show the control on \( \alpha_{i} \).

Table 2 Constrained data
Fig. 5
figure 5

a Graphical view of constrained data of Table 2. b \( GC^{1} \) cubic trigonometric spline function with arbitrary values of parameters \( \alpha_{i} = 0.15,\;\beta_{i} = 0.40. \) c \( GC^{1} \) constrained cubic trigonometric spline function with parameter \( \alpha_{i} = 0.01. \) d \( GC^{1} \) constrained cubic trigonometric spline function with parameter \( \alpha_{i} = 0.12 \)

5.2.2 Case 2: Data Lie Below a Line

The constrained data taken in Table 3 lies below the straight line \( y = x + 2.5 \). Figure 6a shows the graphical view of the data in Table 3. Figure 6b for Table 3 with arbitrary values \( \alpha_{i} = 0.2 , \beta_{i} = 0.21 \) is drawn using \( GC^{1} \) cubic trigonometric spline function (3). In Fig. 6b, the data of Table 3 lies below the given straight line. This means that the required shape of the data given in Table 3 is not achieved. Figure 6c for Table 3 is produced using the scheme developed in Sect. 4.2 (case 2) which preserves the required shape of the given data. More smooth result of Fig. 6c is obtained in Fig. 6d by varying the value of the free parameter \( \alpha_{i} \).

Table 3 Constrained data
Fig. 6
figure 6

a Graphical view of constrained data of Table 3. b \( GC^{1} \) cubic trigonometric spline function with arbitrary values of parameters \( \alpha_{i} = 0.2,\; \beta_{i} = 0.21. \) c \( GC^{1} \) constrained cubic trigonometric spline function with parameter \( \alpha_{i} = 0.001.\,\,{\mathbf{d}} \,\varvec{ }GC^{1} \) constrained cubic trigonometric spline function with parameter \( \alpha_{i} = 0.1 \)

5.2.3 Case 3: Data Lie Between Two Lines

The constrained data is taken in Table 4 and lies between the two arbitrary straight lines \( y_{1} = x + 0.1 \) and \( y_{2} = 8x + 6 \). Figure 7a shows the graphical view of the data given in Table 4. Figure 7b for Table 4 with arbitrary values \( \alpha_{i} = 0.2,\; \beta_{i} = 0.5 \) is drawn using \( GC^{1} \) cubic trigonometric spline function (3) which does not preserve the original shape of the data given in Table 4. The constrained curve is shown in Fig. 7c for data in Table 4, which is produced using constrained preserving scheme developed in Sect. 4.2(case 3). So, more pleasing constrained curve is obtained by varying the value of the free parameter \( \alpha_{i} \) as shown in Fig. 7d.

Table 4 Constrained data
Fig. 7
figure 7

a Graphical view of constrained data of Table 4. b \( GC^{1} \) cubic trigonometric spline function with arbitrary values of parameters \( \alpha_{i} = 0.2 , \beta_{i} = 0.5. \) c \( GC^{1} \) constrained cubic trigonometric spline function with parameter \( \alpha_{i} = 0.4. \) d \( GC^{1} \) constrained cubic trigonometric spline function with parameter \( \alpha_{i} = 0.1 \)

6 Conclusion

In this paper, a \( GC^{1 } \) cubic trigonometric spline function is developed consisting of two parameters in each subinterval. One parameter is constrained to preserve positive and constrained data, while the other parameter is the free parameter. Instead of Butt and Brodlie (1993), the developed trigonometric spline function requires no extra knots to preserve the intrinsic properties of the data. In Cravero and Manni (2003), global schemes were developed. Therefore, it was not possible to modify the shape of the curve in some particular interval. Considering this deficiency, in the presented paper, local schemes are developed to obtain local control on the shape of the curve. Also, the developed schemes are equally suitable for both uniform and non-uniform data. The developed trigonometric spline function includes one free parameter which provides freedom to the user to modify the shape of the curve, whereas in Hussain et al. (2014) the degree of freedom is not provided to the user. The developed trigonometric spline function preserves the shape of the data with two parameters, whereas in Ibraheem et al. (2012) and Sarfraz et al. (2013) four parameters are used for shape preservation of the data. The degree of the developed function is unique over each subinterval, whereas in Verlan (2010) variable degree was used in the subintervals. The approximation error of the developed function is also discussed and is of order three.