Bug in MATH ROM of the TI-95
|
03-09-2023, 06:30 PM
(This post was last modified: 03-09-2023 06:54 PM by Thomas Klemm.)
Post: #3
|
|||
|
|||
RE: Bug in MATH ROM of the TI-95
Based on the source code of NTN starting at line 683A I wrote these functions in Python:
Code: from math import exp, hypot This is the mapping of the variables to the registers:
Examples \( \begin{align} f(x) &= e^x - 3x^2 \\ x &= -0.458962 \\ x &= 0.910008 \\ x &= 3.73308 \\ \end{align} \) Code: ntn(f, -1, 1e-10, 10) -0.45896226753694863 Code: ntn(f, 1, 1e-10, 10) 0.9100075724887092 Code: ntn(f, 4, 1e-10, 10) 3.7330790286328144 \( \begin{align} g(x) &= x^2 - 5 x + 6 \\ x &= 2 \\ x &= 3 \\ \end{align} \) Code: ntn(g, 0, 1e-10, 10) 1.9999999999942588 Code: ntn(g, 4, 1e-10, 10) 3.0000000000000013 To me the implementation in the MATH ROM looks solid. However, I was able to get nonsensical results if the starting value was close to a critical point where the derivative is 0. Examples Code: ntn(f, 2.833, 1e-10, 5) #it REACHED -271.9295080855029 Code: ntn(g, 2.5, 1e-10, 10) #it REACHED -2746.2796055906856 Though I haven't tried it in an emulator, I assume that both the accuracy \(\delta\) and the maximal number of iterations \(n\) have to be stored in registers 0009 and 0010 respectively. Also if the value in register 0010 is 0, the default value 10 is used instead. Maybe you can check if the value in register 0009 is not 0? It should be a fairly small value, like maybe \(10^{-5}\). But I'm not sure if that helps. |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Bug in MATH ROM of the TI-95 - Namir - 03-08-2023, 07:46 PM
RE: Bug in MATH ROM of the TI-95 - Dave Britten - 03-09-2023, 02:57 PM
RE: Bug in MATH ROM of the TI-95 - Thomas Klemm - 03-09-2023 06:30 PM
RE: Bug in MATH ROM of the TI-95 - Namir - 03-10-2023, 12:16 PM
RE: Bug in MATH ROM of the TI-95 - Thomas Klemm - 03-10-2023, 01:13 PM
RE: Bug in MATH ROM of the TI-95 - Namir - 03-10-2023, 02:07 PM
|
User(s) browsing this thread: 4 Guest(s)