An Optimal Spline Method For Solving Numerical Problem - Ferdaws Farhad Rafiq
An Optimal Spline Method For Solving Numerical Problem - Ferdaws Farhad Rafiq
Salahaddin University-Erbil
Research project:
Prepared By:
Ferdaws Farhad Rafiq
Supervised by:
Assist. Prof. Dr. Ivan Subhi Latif
April-2023
Certification of the supervisors
I certify that this work was prepared under my supervision at the Department of
Mathematics/College of Education/Salahaddin University-Erbil in partial
fulfillment of the requirements for the degree of Bachelor of philosophy of Science
in Mathematics.
Signature:
In view of the available recommendations, I forward this work for debate by the
examining committee.
Signature:
ii
Acknowledgment
Primarily, I would like to thanks my god for helping me to complete this research
with success.
Also, I would like to thank my family, friend and library staff whose support has
helped me to conceive this research
iii
Abstract
In this paper, we present the spline function of degree one transformation for the
sine and cosine functions of degree one. We first introduce the concept of spline
functions and its application. We then discuss the properties of the sine and cosine
functions and how they can be transformed using spline functions of degree one.
Finally, we provide examples and graphical representations to illustrate the
effectiveness and applicability of these transformations.
iv
Table of Contents
Certification of the supervisors ........................................................................................................ii
Acknowledgment ............................................................................................................................. iii
Abstract ............................................................................................................................................ iv
Table of Contents ............................................................................................................................. v
Table of Figure ................................................................................................................................ vi
CHAPTER ONE .............................................................................................................................. 1
INTRODUCTION ....................................................................................................................... 1
1.1 Introduction: ....................................................................................................................... 1
1.2 History of Spline Function: ................................................................................................ 3
CHAPTER TWO ............................................................................................................................. 4
SPLINE FUNCTION ................................................................................................................... 4
2 Spline function ...................................................................................................................... 4
2.1 Mathematical Definition of spline ..................................................................................... 5
CHAPTER THREE ....................................................................................................................... 10
TRANSFORMATION SPLINE FUNCTION OF POLYNOMIAL DEGREE ONE ............... 10
3.1 Transformation for sine function and cosine function of polynomial degree one ........... 10
3.2 Spline by geometric function ........................................................................................... 14
3.3 Matlab of transformation of spline degree one ................................................................ 21
3.4 Algorithm of transformation of spline degree one ........................................................... 23
CHAPTER FOUR .............................................................................................................................. 25
NUMERICAL RESULT ............................................................................................................ 25
Reference ....................................................................................................................................... 32
پوخته...................................................................................................................................................a
v
List of Figure
vi
CHAPTER ONE
INTRODUCTION
1.1 Introduction:
The study of splines has been developed, mostly by French mathematicians. It
is well known that interpolating cubic splines can be derived as the solutions of
certain variational problems. In its simple form, the mathematical spline is
continuous and has both a continuous first derivative and a continuous second
derivative. Normally, for many important applications, this mathematical model of
the draftsman's spline is highly realistic. (R.Champision:C.T.Lenard:T.M.Mills
1996) (J.H.Ahlbery:E.N.Nilson, The Theorey of Spline and Their Application
1997)
Let's begin with the simplest method linear interpolation. The idea is that we are
given a set of numerical points and function values at these points. The task is to
use the given set and approximate the function's value at some different points.
That is, given where our task is to estimate for
. Of course we may require to go outside of the range of our set of points, which
would require extrapolation (or projection outside the known function
values).Almost all interpolation techniques are based around the concept of
function approximation. Mathematically, the backbone is simple:
1
The above expression tells us that the value of function we are approximating at
point will be around and that . We can rewrite this expression as
follows:
now taking a form of linear regression around .Linear interpolation is the most
basic type of interpolations. It works remarkably well for smooth functions with
sufficient number of points. However, because it is such a basic method,
interpolating more complex. (Elena 2015)
2
Figure 1.1 curve of spline mechanical
The history of spline functions is rooted in the work of draftsmen, who often
needed to draw a gently turning curve between points on a drawing. This process is
called fairing and can be accomplished with a number of ad hoc devices, such as
the French curve, made of plastic and presenting a number of curves of different
curvature for the draftsman to select. Long strips of wood were also used, being
made to pass through the control points by weights laid on the draftsman's table and
attached to the strips. The weights were called ducks and the strips of wood were
called splines, even as early as 1891. Spline functions have proved to be very useful
in numerical analysis and statistics. (kincaid 2013)
(R.Champision:C.T.Lenard:T.M.Mills 1996)
3
CHAPTER TWO
SPLINE FUNCTION
2 Spline function
It seems appropriate to begin a research on spline theory by defining a spline in
its simplest and most widely used form, and also to indicate the motivation leading
to this definition. For many years, longs, thin strips of wood or some other material
have been used much like French curve by draftsmen to fair in a smooth curve
between specified points. These strips or spline are anchored in place by attaching
lead weights called “ducks” at points along the spline. By varying the points where
the ducks are attached to the spline itself and the position of both the spline and the
duck relative to the drafting surface, the spline can be made to pass through the
specified points provided a sufficient number of ducks are used.
If we regard the draftsmen’s spline as a thin beam, then the Bernoulli-Euler law
Since the ducks act effectively as simple supports, the variation of between
duck positions is linear.
4
The mathematical spline is the result of replacing the draftsmen’s spline by it’s
elastic and then approximating the latter by a piecewise cubic( normally a different
cubic between each pair of adjacent duck) with certain discontinuities of
derivatives permitted at the junction points(the ducks) where two cubics join.
(J.H.Ahlbery:E.N.Nilson, The Theorey of Spline and Their Application 1997)
5
●
𝑆4 𝑆6
● ● 5
𝑆 𝑆3
● ●
𝑆
● ● ●
● ● ● ● ● ● ● ● x
a=𝑡 𝑡 𝑡 𝑡3 𝑡4 𝑡5 𝑡6 𝑡7 𝑏
Where
6
Because each piece of is piecewise linear. If the knots were given
and if the coefficients were all known, then the
evaluation of at a specific would proceed by first determining the interval
the contains and then using the appropriate linear function for that interval. If the
function defined by Equation (1) is continuous. We call it a first-degree spline. It
is characterized by the following three properties. (kincaid 2013)
● 𝑡𝑖 𝑦𝑖
(𝑡𝑖 𝑦𝑖 ) ●
● ●
𝑡𝑖 𝑡𝑖
𝑠𝑖 𝑥 𝑦𝑖 𝑚𝑖 𝑥 𝑡𝑖 3
7
On the interval [ ], where is the SLOP of the line and is therefore given
the formula
Example 2.1: Determine a spline function of degree one which interpolates the
following data:
X 1 2 3 4
Y 0 1 0 1
Solution: since
{ 3
3
8
3
3
4 3
x-3
3 3 ; 3
3 3 3
3
3 3 3
2 ● ●
1 ( )●
𝑆 𝑥 𝑆 𝑥
● ●
1 2 3 4
9
CHAPTER THREE
(x,y)●
y
𝜃
𝑦
𝑆𝑖𝑛𝜃
𝑟
10
𝑟 𝑥 𝑦
Property of sin(x) 3.1.2 :
𝑆𝑖𝑛 𝑥
1
x
3𝜋 𝜋 𝜋 3𝜋
𝜋 𝜋 𝜋 𝜋
-1
1. Domain:
2. Range: .
3. The sine function is a periodic function with fundamental period .
4. The -intercepts are integer multiples of , where is
an integer: ( ).
5. The Maximum(1) and Minimum(-1) value of the sine function
11
Cosine Function 3.1.3:
(x,y)●
y
𝜃
𝑟 𝑥 𝑦
𝐶𝑜𝑠𝜃
3 3
0
-1
12
1. Domain: .
2. Range: .
3. The cosine function is periodic function with fundamental period .
3 5
4. The -intercepts, , , ,…, are odd integer multiplies of , which have
5. The Maximum (1) and Minimum (-1) values of the cosine function
correspond to -value that are integer multiplies of such as
Example 3.1: The terminal side of an angel in standard position passes through
the point . (Young 2012)
Solution:
r ●(2,5)
Y=5
X=2
13
√
, √
√ √
√ √
√ √
√ √
{ 3
Where
14
●
𝑥𝑖 𝑦𝑖
(𝑥𝑖 𝑦𝑖 ) ●
● ●
𝑥𝑖 𝑥𝑖
𝑠𝑖 𝑥 𝑆𝑖𝑛 𝑦𝑖 𝑚𝑖 𝑥 𝑥𝑖 3 3
On the interval [ ], where is the SLOP of the line and is therefore given
the formula
* + 3
Example 3.2: Determine a spline function of degree one for transformation for sine
function of polygonal degree one which interpolates the following data:
X 1 2 3 4
Y 0 1 0 1
Solution: since
S(x) ={ 3
3
15
( )
( )
(3 )
( )
3 ( )
4 3
x-3)
=0.0174
7
3 =0.0174
3 3 ; 3
3 3 3
3
3 3 3
16
1
)●
𝑆 𝑥 𝑆 𝑥
●
1 2 3 4
-1
Figure 3.2.2 spline function of degree one for transformation for sine function of
polygonal degree one.
{ _____ 3
Where
17
● 𝑥𝑖 𝑦𝑖
(𝑥𝑖 𝑦𝑖 ) ●
● ●
𝑥𝑖 𝑥𝑖
On the interval [ ], where is the SLOP of the line and is therefore given
the formula
----- (3.2.4)
* + ----- (3.2.5)
Example 3.3: Determine a spline function of degree one for transformation for
cosine function of polygonal degree one which interpolates the following data:
X 1 2 3 4
Y 0 1 0 1
Solution: since
18
{ 3
3
( )
( )
(3 )
( )
3 ( )
4 3
3 =
19
3 3 ; 3
3 3 3
3
3 3 3
𝑆 𝑥 𝑆 𝑥
●
1
𝑆 𝑥 𝑆 𝑥 ●
1 2 3 4
-1
Figure 3.2.4 spline function of degree one for transformation for cosine function of
polygonal degree one.
20
3.3 Matlab of transformation of spline degree one
Spline functions of degree one 3.3.1:
clc
n=input('n='); %n=4
x1=input('x1='); %x1=2.5
x=input('x='); %x=[1 2 3 4]
y=input('y='); %y=[1 0 1 0]
m=input('m='); %m=[1 2;2 3;3 4]
s=zeros(n-1,1);
for i=1:n-1
if (x1>=m(i,1))&&(x1<=m(i,2))
s(i,1)=(y(1,i+1)-y(1,i))/(x(1,i+1)-x(1,i))*(x1-
x(1,i))+y(1,i);
disp(s(i,1))
end
plot(x,y,x1,s(i,1))
end
clc
n=input('n='); %n=4
x1=input('x1='); %x1=2.5
x=input('x='); %x=[1 2 3 4]
y=input('y='); %y=[1 0 1 0]
m=input('m='); %m=[1 2;2 3;3 4]
s=zeros(n-1,1);
for i=1:n-1
if (x1>=m(i,1))&&(x1<=m(i,2))
s(i,1)=sin(y(1,i+1)-y(1,i))/(x(1,i+1)-x(1,i))*(x1-
x(1,i))+y(1,i);
disp(s(i,1))
21
end
plot(x,y,x1,s(i,1))
end
clc
n=input('n='); %n=4
x1=input('x1='); %x1=2.5
x=input('x='); %x=[1 2 3 4]
y=input('y='); %y=[1 0 1 0]
m=input('m='); %m=[1 2;2 3;3 4]
s=zeros(n-1,1);
for i=1:n-1
if (x1>=m(i,1))&&(x1<=m(i,2))
s(i,1)=cos(y(1,i+1)-y(1,i))/(x(1,i+1)-x(1,i))*(x1-
x(1,i))+y(1,i);
disp(s(i,1))
end
plot(x,y,x1,s(i,1))
end
22
3.4 Algorithm of transformation of spline degree one
Spline functions of degree one 3.4.1:
Step1: Assume that value of interval for and , and the number of data valued
, and the range for using formula (2.1)
Step 3: Polite the spline function of degree one using formula (2.5)
Step 4: end.
Step1: Assume that value of interval for and and the number of data
valued , and the range for using formula (3.3.1)
Step 3: Polite the spline function of degree one transformation sine for degree one
using formula (3.1.5)
Step 4: end.
23
Spline functions of degree one transformation of cosine function
3.5.3:
Step1: Assume that value of interval for and and the number of data
valued , and the range for using formula (3.2.1)
Step 3: Polite the spline function of degree one transformation cosine for degree
one using formula (3.2.5)
Step 4: end.
24
CHAPTER FOUR
NUMERICAL RESULT
Example 4.1.1: Determine a spline function of degree one which interpolates the
following data:
X 1 2 3 4
Y 0 1 0 1
Solution: use linear spline to produce curve for the following data:
25
1.2
0.8
0.6
Series1
0.4
0.2
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5
Example 4.1.2: Determine a spline function of degree one for transformation for
sine function of polygonal degree one which interpolates the following data:
X 1 2 3 4
Y 0 1 0 1
Solution: use spline function of degree one for transformation for sine function of
polygonal degree one to produce curve for the following data:
26
0.9
0.8
0.7
0.6
0.5
0.4 Series1
0.3
0.2
0.1
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5
Example 4.1.3: Determine a spline function of degree one for transformation for
cosine function of polygonal degree one which interpolates the following data:
X 1 2 3 4
Y 0 1 0 1
Solution: use spline function of degree one for transformation for cosine function
of polygonal degree one to produce curve for the following data:
27
Series1
1.2
1
0.8
0.6
0.4
0.2
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5
Example 4.2.1: Determine a spline function of degree one which interpolates the
following data:
X 0 1 3
Y 2 4 5
Solution: use linear spline to produce curve for the following data:
X 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2 2.1 2.2 2.3 2.4 2.5
y 4 4.05 4.1 4.15 4.2 4.25 4.3 4.35 4.4 4.45 4.5 4.55 4.6 4.65 4.7 4.75
28
6
3
Series1
2
0
0 0.5 1 1.5 2 2.5 3 3.5
Example 4.2.2: Determine a spline function of degree one for transformation for
sine function of polygonal degree one which interpolates the following data:
X 0 1 3
Y 2 4 5
Solution: use spline function of degree one for transformation for sine function of
polygonal degree one to produce curve for the following data:
29
1.5
0.5
0 Series1
0 0.5 1 1.5 2 2.5 3 3.5
-0.5
-1
-1.5
Example 4.2.3: Determine a spline function of degree one for transformation for
cosine function of polygonal degree one which interpolates the following data:
X 0 1 3
Y 2 4 5
Solution: use spline function of degree one for transformation for cosine function
of polygonal degree one to produce curve for the following data:
30
X 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2
y -0.615 -0.574 -0.533 -0.490 -0.446 -0.400 -0.354 -0.307 -0.259 -0.210
0.4
0.2
0
0 0.5 1 1.5 2 2.5 3 3.5
-0.2
-0.4 Series1
-0.6
-0.8
-1
-1.2
31
Reference
32
پُخحً
لًم جُێژیىًَەیًدا ،ئێمً کشداسی سپالیىی پلًی یًک گۆڕاوکاسی پێشکًش دەکًیه بۆ ئًسکًکاوی سایه َ
کۆسایه لً پلًی یًک .ئێمً سًسەجا چًمکی کشداسی سپالیه َ جێبًجێکشدوی دەخًیىً ڕََ .دَاجش باس لً
جایبًجمًوذییًکاوی کاسەکاوی سایه َ کۆسایه دەکًیه َ چۆن دەجُاوشێث بگۆڕدسێه بً بًکاسٌێىاوی کشداسی
سپالیىی پلًی یًک .لً کۆجاییذا ،ئێمً ومَُوً َ وُێىًسایًجی گشافیکی پێشکًش دەکًیه بۆ ڕََوکشدوًَەی
کاسیگًسی َ جێبًجێکشدوی ئًم گۆڕاوکاسییاوً.
a
ملخص
في ٌزا البحث ،وقذم َظائف خذد الححُیل مه الذسجة األَلى لُظائف الجیب َجیب الحمام مه الذسجة
األَلى .وقذم أَالً مفٍُم عملیة الششیحة َجىفیزٌا .بعذ رلك ،وىاقش خصائص َظائف الجیب َجیب الحمام
أخیشا ،وقذم أمثلة َجمثیالت سسُمیة لششح
ً َكیف یمكه جحُیلٍما باسحخذام عملیات خذد مه الذسجة األَلى.
جأثیش َجىفیز ٌزي الحغییشات.
b