Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Code Block
languagenone
function result = simpsons_error(start, stop, error, fn)
N = 2; % N må være et partall
Si = simpsons(start, stop, N, fn);
S2i = simpsons(start, stop, 2*N, fn);
while abs(Si-S2i) >= error
    N = 2 * N;
    Si = simpsons(start, stop, N, fn)S2i;
    S2i = simpsons(start, stop, 2*N, fn);
end
fprintf('Antal ledd: %d\n', N);
result = Si;
end

...