Académique Documents
Professionnel Documents
Culture Documents
RAPPORT
0
N1
function[x,y,niter]=bissection(f,a,b,eps)
if f(a)*f(b)>0
error('intervalleinadapté');
return
end
niter=0;
while abs(b-a)>eps
x=(a+b)/2;
if f(x)==0
niter = niter +1;
y=0
return
elseif f(a)*f(x) > 0
a = x;
elseif f(b)*f(x) > 0
b= x;
end
niter = niter +1;
end
y=f(x);[x,y,niter]=bissection(f,a,b,eps)
Command window
clc;closeall; clear all;
f=inline('2*sin(x)-x');
a=1
b=2
eps=0.00001
[x,y,niter]=bissection(f,a,b,eps)
eps x y niter
function[alpha,erreur,niter]=pointfixe(g,x0,itmax,eps)
alpha=x0;
for niter=1:itmax
x=alpha;
alpha=g(x);
erreur=abs(alpha-x);
if erreur<eps
return
end;end
Command window
clear all
close all
clc
x0=0
f=inline('exp(x./(-2))');
eps=0.01;
itmax=10;
[alpha , erreur , niter]= pointfixe(f,x0,itmax,eps)
𝑓(𝑥):2sin(𝑥) − 𝑥
𝑓(𝑥):𝑥 + 2𝑙𝑛(𝑥)
f(x):2 sin(x)-x g1(x):x=2sin(x)
01 090..1 1911.0 01
1910
11 090..1 1911.0 01
01 090..1 1911.0 01
0.3
01 090..1 1911.0 01
1911110
11 090..1 7.3723*10-6 62
01 090.00 7.3723*10-6 62
01 090.1. 191002 01
1910
11 090.01 1911.0 00
01 090.01 1911.0 00
190
01 090.1. 191002 01
1911110
11 090.00 8.7953*10-6 62
01 090.00 8.7953*10-6 62
01 090.02 191011 .
1910
11 090.02 191011 .
01 090.02 191011 .
190
01 090.01 191121 01
1911110
11 090.00 7.5383*10-6 60
01 090.00 7.5383*10-6 60
f(x):2 sin(x)-x
X0 Eps Itmax alpha erreur Niter
01 2.3974*10-7 1911.1 6
1910
11 2.3974*10-7 1911.1 6
01 2.3974*10-7 1911.1 6
191
01 4.5528*10-21 2.3974*10-7 1
1911110
11 4.5528*10-21 2.3974*10-7 1
01 4.5528*10-21 2.3974*10-7 1
01 190.10*10-15 2.3223*10-5 1
1910
11 190.10*10-15 2.3223*10-5 1
01 190.10*10-15 2.3223*10-5 1
190
01 0 190.10*10-15 1
1911110
11 0 190.10*10-15 1
01 0 190.10*10-15 1
01 090160*10-9 191100 1
1910
11 090160*10-9 191100 1
01 090160*10-9 191100 1
190
01 1 090160*10-9 1
1911110
11 1 090160*10-9 1
01 1 090160*10-9 1
f(x):x+2ln(x) g1(x):exp(-x/2)
01 19.100 1911.1 0
19110
11 19.100 1911.1 0
01 19.100 1911.1 0
191
01 19.110 19010.*10-5 01
1911110
11 19.110 5.9827*10-6 06
01 19.110 5.9827*10-6 06
01 19.112 191111 0
19110
11 19.112 191111 0
01 19.112 191111 0
190
01 19.110 8.2744*10-6 00
1911110
11 19.110 8.2744*10-6 00
01 19.110 8.2744*10-6 00
01 19.11. 191102 1
19110
11 19.11. 191102 1
01 19.11. 191102 1
190
01 19.110 091020*10-5 01
1911110
11 19.110 091020*10-5 00
01 19.110 091020*10-5 00
f(x):x+2ln(x) g2(x):2ln(x)
X0 Eps itmax alpha erreur Niter
01 -3.463+4.459i 09.620 01
19110
11 -3.462+4.461i 09.610 11
01 -3.462+4.461i 09.610 01
191
01 -3.463+4.450i 09.620 01
1911110
11 -3.462+4.461i 09.610 11
01 -3.462+4.461i 09.610 01
01 -3.463+4.459i 09.601 01
19110
11 -3.462+4.461i 09.610 11
01 -3.462+4.461i 09.610 01
190
01 -3.463+4.458i 09.601 01
1911110
11 -3.462+4.461i 09.610 11
01 -3.462+4.461i 09.610 01
01 -3.457-4.461i 09.101 01
19110
11 -3.462-4.461i 09.610 11
01 -3.462-4.461i 09.610 01
190
01 -3.457-4.468i 09.101 01
1911110
11 -3.462-4.461i 09.610 11
01 -3.462-4.461i 09.610 01
Command window
clear all
close all
clc
f= @(x) 2*sin(x)-x
fplot(f,[0.5,1])
title('le graphe de f(x)')
grid on
clear all
close all
clc
f=@(x) (x+2*(log(x)))
fplot(f,[0.5 1])
title('le graphe de f(x)')
grid on
TP N 3 0
METHODE DE NEWTON
Programme :newton.m
function [alpha,y,erreur,niter]=newton(f,df,x0,itmax,eps)
alpha=x0;
for niter=1:itmax
x=alpha;
alpha=x-f(x)/df(x);
erreur=abs(alpha-x)/abs(alpha);
iferreur<eps
y=f(alpha);
return
end;end
y=f(alpha);
Command window
Clc
clear all
close all
f=inline('x+2*log(x)')
df=inline('1+(2./x)')
a=0.5;
b=1;
eps=0.01;
[alpha,y,erreur,niter]=newton(f,df,x0,itmax,eps)
f1(x):2sin(x)-x f'1 (x):2cos(x)-1