Mathematics Part 1
Mathematics Part 1
IBENG-2
1
Course map
2
Introduction and motivation
Non-linear problems
x x x
𝑓 𝑥 = 𝑎. 𝑥 + 𝑏
Examples :
𝑏 ; 𝑖𝑓 𝑥 ∈ −∞; 0
- High degree polynom 𝑓 𝑥 =ቊ
- Trigonometric functions 𝑎. 𝑥 + 𝑏 ; 𝑖𝑓 𝑥 ∈ 0; +∞
- Gaussian function
-…
3
Introduction and motivation
Let an interval 𝐼=[𝑎, 𝑏]⊆ ℝ and an application 𝑓 defined on this interval with real values. If it exists, we want to
determine the position of a real number 𝑥ҧ ∈ 𝐼 as:
𝑓 𝑥ҧ = 0
y
𝑦=𝑓 𝑥
𝑥ҧ
a b x
The non-linearity comes with a major difficulty: you do not know in advance if there are zero, one, many or an infinity of
solutions.
4
Introduction and motivation
Examples of problem
Example 1:
• We want to calculate the average annuity rate "𝐼" of an investment fund over several years. We have invested in the
fund 𝑣 = 1000 € each year and we find ourselves after 5 years with an amount 𝑀 = 6000 €.
• We know that the relationship between 𝑀, 𝑣, 𝐼 and the number of years "𝑛" is:
𝑛
1+𝐼
𝑀 = 𝜈 1+𝐼 𝑘 = 𝜈 1+𝐼 𝑛−1
𝐼
𝑘=1
The problem is to find “𝐼” as:
1+𝐼
𝑓 𝐼 =𝑀−𝜈 1+𝐼 𝑛−1 = 0
𝐼
This lead to solve a non-linear equation which we are not capable of finding an exact solution.
Example 2:
• Let’s consider a spring with a non-linear stiffness (duffing equation), the equilibrium of the system is as follow:
𝐹 = 𝛼. 𝑥 + 𝛽𝑥 3
• We want to know the displacement of the spring 𝒙 ഥ according to a certain force 𝐹 F
• Equation to solve : f x = 𝛼. 𝑥 + 𝛽𝑥 3 − 𝐹 = 0
x
𝑘 𝑥
5
Introduction and motivation
Definitions
The method used to solve this kind of problems is an iterative process which is going to calculate an approximation of
the solution at each step in order to « crawl » toward the solution.
The iterative process consists in:
• Building of a sequence 𝑥 (𝑘) , with 𝑘 ∈ ℕ which converges to 𝑥ҧ as lim 𝑥 (𝑘) = 𝑥ҧ
𝑘→∞
• Choosing an initial value 𝑥 (0) that should be close enough to the solution
Convergence
We define the absolute error at step 𝑛 by
𝑘 𝑘
𝑒 = 𝑥 − 𝑥ҧ , 𝑘 ≥ 0
A sequence 𝑥 (𝑘) built with a numerical method converges toward 𝑥ҧ with an order of convergence 𝑝 if
𝑝
∃𝐶 > 0 ∶ 𝑒 (𝑘+1) ≤ 𝐶 𝑒 𝑘 , ∀𝑘 ≥ 0
𝐶 is the convergence factor of the method.
Order of convergence
• If 𝑝 = 1 and 𝐶 < 1, the convergence is linear
• If 𝑝 = 2, the convergence is quadratic
6
Introduction and motivation
Definitions
• Increment
Optimal criteria most of the time
𝑥 (𝑘+1) − 𝑥 𝑘
≤𝜀
• Number of iterations :
𝑘 ≤ 𝑘𝑚𝑎𝑥
7
Bisection
• General concept
• Algorithm
• Example
• Particularity
8
8
Bisection
General concept
0
1
𝑓 𝑎
1
𝑓 𝑥
𝑎 (1) 𝑥ҧ 𝑥 2 𝑏 21 𝑏 0
𝑎(0) 𝑎(1)
𝑥 2 𝑥 (0) x
1
0 0
𝑓 𝑏
𝑥 𝑓 𝑏
9
Bisection
Algorithm
0 0
• Set the initial values of the interval 𝑎 ,𝑏
• Compute the mean value of this interval
𝑎 0 +𝑏 0
𝑥 (0) =
2
• Compute the values of the function at one boundary of the interval and
at the mean value : 𝑓 𝑎 0 , 𝑓 𝑥 0
• If none of the criteria is matched, repeat the process with the new
boundaries
10
Bisection
Example
𝑥1 𝑥2 𝑥3
𝑥 11
Bisection
Particularity
Convergence of bissection : If f has a unique zero 𝑥ҧ in the interval 𝑎, 𝑏 then the sequence 𝑥 𝑘 𝑘∈ℕ converge to 𝑥ҧ and
we have
𝑏−𝑎
∀𝑘 ∈ ℕ, 𝑥 𝑘 − 𝑥ҧ ≤ 𝑘+1
2
Globally convergent iterative method
Predictable number of iterations for a given precision on the solution
Few hypotheses are required for this method
Robust method but with slow convergence (linear convergence)
Often used for the initialization of faster (but less robust) methods
If 𝑓 has several zeros in 𝑎, 𝑏 , the algorithm converges toward one of them depending on the conditions
12
Fixed point method
• Definitions
• General concept
• Algorithm
• Example
• Particularity
13
Fixed point method
Definitions
• Fixed point
A fixed point is a point where we have an equation of the form of 𝑓 𝑥 = 𝑥 which means that it is the intersection of
the linear function 𝑦 = 𝑥 and 𝑦 = 𝑓 𝑥 .
Not every function has a fixed point (ex: 𝑦 = 𝑥 2 + 1)
14
Fixed point method
Definitions
• Contracting function
Let 𝐼 = 𝑎, 𝑏 ∈ ℝ and 𝑔 a function in 𝐼.
𝑔 is said to be (K-) contracting if a constant K exists which verifies
∀ 𝑥, 𝑦 ∈ 𝑎, 𝑏 , 𝑔 𝑥 − 𝑔 𝑦 ≤𝐾 𝑥−𝑦
∀𝑥 ∈ 𝑎, 𝑏 , 𝑔′ 𝑥 ≤𝐾<1
• General concept
The fixed point method for solving non linear equations 𝑓 𝑥 = 0 is to transform this function into an equivalent
function 𝑔 𝑥 = 𝑥. Function 𝑔 𝑥 has the following propriety : 𝑔 𝑥ҧ = 𝑥ҧ if and only if 𝑓 𝑥ҧ = 0
𝑥ҧ is said to be a fixed point of 𝑔(𝑥). Approaching the zeros of 𝑓 𝑥 is equivalent to finding the fixed points of 𝑔 𝑥 .
15
Fixed point method
• Convergence process
𝑘+1 𝑘
Build a sequence such as 𝑥 =𝑔 𝑥 , ∀𝑘 ∈ ℕ
𝑘
Because if lim 𝑥 = 𝑥ҧ and 𝑔 𝑥 is continuous on interval 𝑎, 𝑏 , then 𝑔 𝑥ҧ = 𝑥.ҧ
𝑘→∞
A necessary (but not sufficent) condition for convergence is
∀𝑥ҧ ∈ 𝑎, 𝑏 , 𝑔′ 𝑥ҧ < 1
• Examples of convergence
16
Fixed point method
Algorithm
Start
• Preliminary step
Set 𝑥 0
Find a function 𝑔 𝑥 who satisfy 𝑔 𝑥ҧ = 𝑥ҧ with 𝑓 𝑥ҧ = 0
0
Choose a starting point 𝑥 close enough to the solution
• Algorithm
• Compute the value of 𝑥 𝑘+1
with the function 𝑔 𝑥 𝑥 (𝑘+1) = 𝑔 𝑥 𝑘
𝑥 (𝑘) = 𝑥 𝑘+1
17
Fixed point method
Example 2
𝑥1 𝑥2
18
Fixed point method
Example
2 −2 2 −2 1
• 𝑔1 𝑥 = 𝑒 𝑥 , 𝑔1′ 𝑥 = 2𝑥. 𝑒 𝑥 • 𝑔2 𝑥 = ln 𝑥 + 2, 𝑔2′ 𝑥 =
2𝑥 ln 𝑥 +2
𝑘
• 𝑔1 𝑥 converge to 𝑥1 𝑘
• 𝑔2 𝑥 converge to 𝑥2
Contracting interval
Contracting interval
𝑥1 k x^(k) 𝑥2
𝑥1 k x^(k) 𝑥2
0 1
0 1
1 0.36787944
𝑔1 𝑥
𝑔2 𝑥
1 1.41421356
2 0.15494815
2 1.53185299
3 0.13862386
3 1.55771567
… …
… …
11 0.13793483
19 1.56446226
𝑔1′ 𝑥
𝑥 𝑔2′ 𝑥
𝑥 19
Fixed point method
20
Newton-Raphson method
• General concept
• Advantages and drawbacks
• Algorithm
• Example
• Multiple variable case
21
Newton-Raphson method
General concept
• Formula
𝑘
Linearization of the function at the point 𝑥 by Taylor-Young formula:
𝑘 𝑘 2
𝑓 𝑥 =𝑓 𝑥 + 𝑥−𝑥 𝑓′ 𝑥 𝑘
+𝑂 𝑥−𝑥 𝑘
𝑘+1
By solving this equation for 𝑓 𝑥 = 0 we get:
𝑘+1 𝑘
𝑓 𝑥𝑘
𝑥 =𝑥 − =𝑔 𝑥
𝑓′ 𝑥 𝑘
• Principle
𝑘+1 𝑘 𝑘
The point 𝑥 is calculated by finding the intersection between the tangent of the function 𝑓 at (𝑥 ,𝑓 𝑥 ) and
the 𝑥 axis.
y
3 ഥ
𝒙
𝑥
2 0
𝑥 1 𝑥 𝑥 x
23
Newton –Raphson method
1 0 x
𝑥 𝑥 24
Newton –Raphson method
• Advantages
• If the sequence converges, the convergence is really quick
• Only one starting point is needed
• Drawbacks
• Being able to get the derivative of the function 𝑓(𝑥)
• 𝑓 𝑥 has to be a 𝐶 2 function
• Less stable than bissection (convergence is not always sure)
25
Newton –Raphson method
Algorithm
Start
Set 𝑥 0
• Preliminary step
Find the expression of the derivative 𝑓 ′ 𝑥
0
Choose a starting point 𝑥 close enough to the solution 𝑥ҧ
Compute
𝑓 𝑥 𝑘 , 𝑓′ 𝑥 𝑘
• Algorithm
𝑘+1
• Compute the value of 𝑥 with
𝑓 𝑥𝑘
𝑥 (𝑘+1) = 𝑥 𝑘
− ′ 𝑘
𝑓 𝑥 𝑓 𝑥𝑘
𝑥 (𝑘+1)
=𝑥 𝑘
− ′ 𝑘 𝑥 (𝑘) = 𝑥 𝑘+1
𝑓 𝑥
• Check if one of the criteria is matched :
• Increment 𝑥 (𝑘+1) − 𝑥 𝑘
≤𝜀
• Number of iterations Stopping criteria no
satisfied ?
• If none of the criteria is matched, repeat the process
with the new value of 𝑥 𝑘 yes
End
𝑘+1
Solution is 𝑥
26
Newton–Raphson method
• ഥ ∈ 𝑈 such as
Let a non linear application 𝑓: 𝑈 ⊆ ℝ → ℝ. We search 𝒙
𝑓1 𝑥1 , 𝑥2 , … , 𝑥𝑛 = 0 𝑥1
𝑓 𝑥 , 𝑥 , … , 𝑥𝑛 = 0 𝑥2
𝒇 𝒙 =𝟎⟺ 2 1 2 , with 𝑥 = ⋮
⋮
𝑓𝑛 𝑥1 , 𝑥2 , … , 𝑥𝑛 = 0 𝑥𝑛
• For a N-dimensional problem 𝒇(𝒙) = 𝟎, the idea is the same but the derivative is replaced by the Jacobian
matrix 𝑱(𝒇 𝒙 ):
𝜕𝑓1 𝜕𝑓1
…
𝜕𝑥1 𝜕𝑥𝑛
𝑱 𝒇 𝒙 = ⋮ ⋱ ⋮
𝜕𝑓𝑛 𝜕𝑓𝑛
⋯
𝜕𝑥1 𝜕𝑥𝑛
Similarly as with one variable, the system to solve at each step is
−𝟏
𝒙(𝑘+1) = 𝒙 𝑘
− 𝑱 𝒇 𝒙 𝒇 𝒙𝑘 , with a given starting point 𝒙 0
27