Skip to content

Commit 0b5bd07

Browse files
committed
ajout de Lagrange
1 parent 1a3255a commit 0b5bd07

File tree

13 files changed

+33
-396
lines changed

13 files changed

+33
-396
lines changed

InitialValueProblem/.idea/InitialValueProblem.iml

-10
This file was deleted.

InitialValueProblem/.idea/inspectionProfiles/profiles_settings.xml

-6
This file was deleted.

InitialValueProblem/.idea/misc.xml

-7
This file was deleted.

InitialValueProblem/.idea/modules.xml

-8
This file was deleted.

InitialValueProblem/.idea/workspace.xml

-147
This file was deleted.

Interpolation&Fitting/Lagrange.py

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import numpy as np
2+
import math
3+
4+
def Lagrange(xData,yData, x):
5+
"""
6+
Lagrange interpolation function is used to aproximate the f(x) value
7+
8+
@pre : Here length of xData must be the same for yData
9+
xData : <list> The known x-points
10+
yData : <list> The points y associated with a x
11+
x : <Float> The point at which we are looking for the image
12+
13+
@post : return <Float> The Pn (x) value
14+
"""
15+
# Apply the equation
16+
res = 0
17+
for i in range(len(xData)):
18+
prod = 1
19+
for j in range(len(yData)):
20+
if(i!=j):
21+
prod *= (x-xData[j])/(xData[i]-xData[j])
22+
res += prod*yData[i]
23+
return res
24+
25+
26+
# --------------- EXAMPLE ---------------
27+
28+
# xData = [ -1.2, 0.3, 1.1]
29+
# yData = [ -5.76, -5.61, -3.69]
30+
# x = 0
31+
#
32+
# print(Lagrange(xData, yData, x))

LinearSystem/DecompLU.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def LUsolve(a, b, rp):
3737
then Ux = y using backward substitution.
3838
3939
@pre : a : <np.array | type=float64> The matrix LU (n x n) from LUdecomp(A)
40-
b : <np.array | type=float32> The matrix b (1 x n)
40+
b : <np.array | type=float64> The matrix b (1 x n)
4141
rp : <List> indices of the lines that where pivoted in LUdecompRP()
4242
4343
@post : return <np.array> : (1 x n) matrix

Optimization/.idea/.name

-1
This file was deleted.

Optimization/.idea/Optimization.iml

-10
This file was deleted.

Optimization/.idea/inspectionProfiles/profiles_settings.xml

-6
This file was deleted.

Optimization/.idea/misc.xml

-7
This file was deleted.

Optimization/.idea/modules.xml

-8
This file was deleted.

0 commit comments

Comments
 (0)