Commit Graph
3 Commits
Author SHA1 Message Date
Andre Neto 45a1449324 licenca: nomeia a co-autora no copyright — a linha passa a Ines Ferreira and Andre Neto, os autores registados no README.txt. So a atribuicao; a licenca MIT ja aplicada nao muda. 2026-10-08 15:01:45 +01:00
Andre Neto d547f2fc28 Make the solvers run and be tested under Octave
The project is MATLAB coursework and had never been run outside MATLAB. Two
things stop it in Octave, both found by running it rather than reading it:

  * newtonr.m called sym/matlabFunction unconditionally. Octave has no
    matlabFunction, so the file died before the first iteration with
    "'sym' undefined near line 12, column 5". The derivative is now taken
    from the Symbolic Math Toolbox when it is there and from a central
    difference otherwise. The method and its results are unchanged: on the
    test functions the numeric derivative agrees with the analytic one to
    2.3e-16 or better.
  * secant.m and newtonr.m built plot labels with "a" + i + "b". A
    double-quoted literal is a char array in Octave, not a string, so the
    addition became numeric and secant.m stopped at line 58 with
    "operator +: nonconformant arguments (op1 is 1x10, op2 is 1x2)". The
    labels are now built by concatenation and the text is identical.

No mathematics was changed. The defects that were found are left in place and
documented instead: tab = (max) is not a preallocation, newtonr returns
without assigning x1 when f'(x0) == 0, secant rejects an interval without a
sign change, and none of the three reports exhaustion of the iteration cap.

Added so the behaviour can be checked instead of asserted:

  * tests/run_tests.m - 13 checks against roots known analytically, solvers
    called at tol=1e-10, assertion tolerance 1e-6, exit 1 on any failure
  * a Makefile with test, demo, run and clean, and tests/demo.m
  * README.md in the house format; README.txt is kept as the original note
  * .gitignore for MATLAB autosave files and the captured plot output

Verified on the raspberry pi with Octave 9.4.0: make test reports 13 checks,
0 failures and exits 0, and a deliberately wrong expected root gives exit 1.
projetodlg.m was not made to run under Octave: it is built from MathWorks
dialogs and needs a display.
2026-10-08 14:54:36 +01:00
Andre Neto 7af800849f Add MIT LICENSE (first commit year 2022) and a README section pointing to it
O repo era publico e espelhado sem licenca e nao tem codigo de terceiros. MIT
foi a licenca decidida para o catalogo; ano = primeiro commit (2022). O
README.txt original fica como esta.
2026-10-08 14:53:40 +01:00