Estratto del documento

BISEZIONE

[xvect, it, xdif, fx] = bisez (a, b, nmax, toll, fun)

  • if (fun(a)*fun(b) > 0)
  • error ('...')
  • end
  • it = 0;
  • xvect = [a; b; (a + b) / 2];
  • fa = fun(a); fb = fun(b);
  • err = abs (b - a);

while (xdif(it + 1) > = toll & it < nmax)

  • x = a + (b-a) / 2;
  • fx = fun(x);
  • if fx*fa < 0
  • b = x; fb = fx;
  • else
  • a = x; fa = fx;
  • end
  • xdif = [xdif; err];
  • xvect = [xvect; x];
  • it, (fa < fx(xdif)) = 0
  • a = x; fx = log((a + b)/2);
  • else
  • b = x; fx = fa;
  • fb = fx (xdif);

end

NEWTON

[xvect, it] = newton (a, b, y, nmax, toll, fun)

  • it = 0;
  • xvect = [x0];

while (err > toll & it < nmax)

  • k = V * xvect(end);
  • if (fun (xv) == 0)
  • disp ('Arresto.')
  • break
  • end
  • x1 = xv - (fan (xv) / dfun (xv));
  • err = abs (xv - x1);
  • xvect = [xvect x1];
  • it = it + 1;
  • if, it = it + 1;
  • end
  • end

PTOFIS

[xvect, it] = ptofisl (phi, x0, nmax, toll)

  • it = 0;
  • xvect = [x0];
  • err = toll + 1;

while (err > toll & it < nmax)

  • xv = xvect(end);
  • x1 = phi (xv);
  • err = abs (x1 - x0);

end

PREDCOMP

[I = predcomp (f, a, b, N)

  • x1 = (b - a) / N;
  • x_nodi = a: h: b;
  • Y = f (x_nodi);
  • I = H * sum (y);

end

SIMPCOMP

[I = simcomp (f, a, b, N)

  • h = (b - a) / N;
  • x_nodi = a: h: b;
  • x_med = a + h / 2; b - h / 2;
  • Y, estr = F (x_nodi); ymed = F (x_med);

end

  • I = [2 / 3 * h * (ext(1) + ymed + ext (end)]
  • +2 / (3 * h * (ext (end - 1.)
  • +4 * sum (ymed)] );

end

EIGPOWER / INVPOWER / INVPOWERMSHIFT

[lambda, v, it] = eigpower (A, toll, nmax, x0)

  • it = 0;
  • y0 = x0 / norm (y0);
  • y = (a -
  • lambda 0 = y (t);

end

while (un tol stoi it < nmax)

  • y = x / norm (x);
  • x = a * y;

end

-- > x = A * y

-- > x = a * y

  • lambda(0) = y7
  • it = abs (lambda - lambdaold) / abs (lambdaold);

lambda0 = lambda:

  • print

end

n = size (x0);

m = a + m^4 * eye (n)

  • x = My;

x = M * y

Bisezione

[xvect,it] = bisez (a,b,nmax,toll,fun)

if (fun(a) * fun(b) > 0)

   error ('...')

end

it = 0;

xvect = [ ]; x = [ ]; xfd = [ ]

fa = fun(a); fb = fun(b);

err = abs (b - a);

while (err >= toll && it < nmax)

   x = a

end

Newton

[xvect,it] = newton (a,b,y0,nmax,toll,fun,dfun)

etao;

xvect = [x0];

ea = toll;

while (ea >= toll && it < nmax)

   xv = xvect(end)

   if (dfun (xv) == 0)

      disp ('Arresto')

      it = it + 1;

      break;

end

xr = xv - (fun(xv)/dfun(xv));

end

Ptofis

[xvect,it] = ptofis (phi,x0,nmax,toll)

it = 0;

xvect = [x0];

ea = toll + 1;

while (ea >= toll && it < nmax)

   xv = xvect(end);

   xr = phi (xv) ;

   ea = abs (xr - xv);

   it = it + 1;

end

Pmedcomp

I = pmedcomp (F,a,b,n,N)

x_i = (b-a)/n;

x_nodi = a : h : b-h;

.

Simpson

I = simpcomp (f,a,b,n,N)

x_i = (b - a)/n;

x_nodi = a : h : b; v

x_med = a + h/2 : h : b-h/2;

end

Eigpower | Invariant | Invpowershift

[lambda,y,it] = eigpower (A,toll,nmax,x0)

it = 0;

y0 = x0/norm(x0);

y = A*y0; lambda_0 = y.1

end

FWSub BKSub

x = fwsub(B'/A')b

n = length(b);if( min(A , b) == min b) b ([A , b] == 0) disp('Errore'); returnendif( A == tril(A)) if( prod(diag(A)) == 0) disp('Errore'); return end x = zeros(n, 2); x(1) = b(1)/A(1,1); for i = 2 : n x(i) = ( b(i) - A ( i, 1 : i - 1) * x (1 : i - 1)...

Jacobi GS

[x,n,k] = jacobi ( A, b, x0, xtol, nmax) k = 0; n = length(b); x = x0; r = b - A*x0; eta = norm(r)/norm(b); while ( kxtol) for i = 1 : n x(i) = ( b(i) - A ( i, 1 : i - 1) * x( 1: i - 1) - ... end k = k+1; r = b - A * x; eta = norm(b)/norm(b); x = xw;

GRADIENTE IN GRADOPRECIGRADCONT

[x, iter, xinvver] = gaden(A, b, x0, maxatol)

iter = 0;

x = x.old;

r = b-A*x0;

r0 = norm(b) * norm(r);

for iter = 1: num(maxiter, max(erro*tol))

  • z = r;
  • w(rho = z*r);
  • for i = 1:m
  • w = rho/alpha*w;
  • alpha = rho/Ap*w;
  • x = x + alpha*w;
  • r = r-alpha*A*w;
  • eudi = norm(r); norm(u1);
  • x.old = j; x(old) = rho(old) = ε;; z;
  • rho = r;
  • x0 = x;
  • x1(x1.eudi) < tol)
  • end
  • eudi

if (en(eudi) < tol)

end

fprintf('O di attuazione') iter;

EUERO AVANTI

[t, h, u, ~] = EE ( f, t0:tmax, y0)

t = t0 : h : tmax;

n = length (t; h);

u = zeros (a`, b);

u0 = (1)y0;

h = b- a(j);

for i=2:n

x.old = u (i.)

r . old = k (t-i.)

ulat(i) = u.old + h*f(t.old, u.old);

end

RUNGE KUTTA

[t, h, u, h] = RK2 (f, t0, tmax,y0)

t = t0 : h : tmax;

u( length(u) = n);

u0 = b+ zeros 1(j,n);

  • u1(u) (1:y0);
  • for i = 2:n
  • x2. old = u1 (i;)
  • ne = old + h * h [foi (a,n) a. old),
  • hi (1/n)ulold = u0ld + 0. 3 j (f(t_old.x0ld) f (b.ng)na0).

end

Anteprima
Vedrai una selezione di 1 pagina su 4
Calcolo numerico: algoritmi Pag. 1
1 su 4
D/illustrazione/soddisfatti o rimborsati
Acquista con carta o PayPal
Scarica i documenti tutte le volte che vuoi
Dettagli
SSD
Scienze matematiche e informatiche MAT/08 Analisi numerica

I contenuti di questa pagina costituiscono rielaborazioni personali del Publisher cescamhr1 di informazioni apprese con la frequenza delle lezioni di Calcolo numerico e studio autonomo di eventuali libri di riferimento in preparazione dell'esame finale o della tesi. Non devono intendersi come materiale ufficiale dell'università Politecnico di Milano o del prof Antonietti Paola Francesca.
Appunti correlati Invia appunti e guadagna

Domande e risposte

Hai bisogno di aiuto?
Chiedi alla community