You are on page 1of 3

Aplicatii MN:

1. Sa se rezolve ecuatia: 𝑓 𝑥 = 0, unde 𝑓 𝑥 = 𝑥 − 𝑒 −𝑥 .

• % function rad_ec = bisectie_ec(a0,b0,max_err,max_it,index_f)

• L1_bisectie(0,1,1e-3,20,2) pentru 𝜖 = 10−3 si apoi 𝜖 = 10−6 .

• In Matlab: format long;

fzero(‘x-exp(-x)’, [0 1])

2. Sa se rezolve ecuatia: 𝑓 𝑥 = 0, unde 𝑓 𝑥 = 𝑥 3 − 𝑥 2 − 𝑥 − 1 .

• % function root = newton_ec(x0,max_err,max_it,index_f)

• L2_newton(2,1e-6,12,3)

• In Matlab: format long;

roots([1 -1 -1 -1])

fzero('x.^3-x.^2-x-1', [0 2])

3. Sa se rezolve ecuatia: 𝑓 𝑥 = 0, unde 𝑓 𝑥 = 𝑥 3 − 𝑥 − 2 .

• % function rad_ec = aprox_succ_ec(x0,max_err,max_it,index_fi)

• L3_aprox_succ(1.5,1e-6,20,2)

4. Sa se rezolve ecuatia: 𝑓 𝑥 = 0, unde 𝑓 𝑥 = 𝑥 − 𝑒 −𝑥 .

• % function rad_ec = secanta_ec(a0,b0,max_err,max_it,index_f)

• L4_secanta(0,1,1e-6,12,2)

• % function sol_sist = gauss_1(A,b)


• A = [6 1 -3 2;1 -4 0 2;-3 2 5 8;2 7 -3 4]

• b = [6;-1;12;10]

• L5_gauss_1(A,b)

• %function sol_sist = G_J_1(A,b)

• L6_G_J_1(A,b)

• L6_G_J_inv(A,b)

• % function sol_sist = Jacobi_1(A,b,x0,max_err,max_it)

• A=[8 -2 1 1;1 -9 3 2;2 -1 10 2;1 0 -3 6]

• b=[8;-3;13;4]

• L8_Jacobi_1(A,b,[0;0;0;0],1e-6,30)

• % function sol_sist = G_Seidel_1(A,b,x0,max_err,max_it)

• L9_G_Seidel_1(A,b,[0;0;0;0],1e-6,20)

• % function val_f = Lagrange(xk,yk,x)

• xk = [-2 1 2 5]

• yk = [6 -2 4 10 ]

• L10_Lagrange(xk,yk,2.5)

• % function val_f = Newton_DF(xk,yk,x)

• xk = [1 2 3 4 5 ]
• yk = [-3 2 -1 3 10]

• L12_Newton_DF( xk,yk,2.5)

• % function integr = trapez_int(a,b,n,index_f)

• pentru un singur trapez: n=1

• L14_trapez_int(1,2,1,5)

• In Matlab: format long;

x=linspace(1,2,100);

y=exp(x);

trapz(x,y)

• % function integr = simpson_int(a,b,n,index_f)

• Se calculeaza aceeasi integrala;

• L15_simpson_int(1,2,1,5)

• In Matlab: format long;

quad( ‘exp(x)’, 1, 2, 1e-6)

You might also like