Guest User

Untitled

a guest
May 17th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. function M = newton_mod(fn,dfn,d2fn,x0,E) // CAMBIA TUTTO!
  2. x = x0; // Punto iniziale.
  3. df = dfn(x);
  4. while (df <> 0) // Condizione di punto NON stazionario.
  5. d2f = d2fn(x);
  6. if (d2f == 0) then
  7. d = -df;
  8. else
  9. S = -(d2f^(-1))*df;
  10. if (abs(df*S) < E*abs(df)*abs(S)) then
  11. d = -df;
  12. else
  13. d = S;
  14. end
  15. end
  16. alfa = armijo(fn,x,d); // Calcolo un passo adatto e determino
  17. x = x+alfa*d; // la "x" successiva con cui proseguire
  18. df = dfn(x); // la determinazione del punto di minimo
  19. d2f = d2fn(x);
  20. end
  21. M = [x fn(x)];
  22. return M;
  23. endfunction
Add Comment
Please, Sign In to add comment