Post Reply 
(11C) CUBIC EQUATION
06-10-2018, 09:35 PM (This post was last modified: 06-11-2018 07:55 AM by Dieter.)
Post: #15
RE: (11C) CUBIC EQUATION
(06-10-2018 02:36 PM)Gamo Wrote:  Somehow the program I listed seem to work.
Under X>Y there is one STO 4 follow by X<0 then branch to LBL 1

Gamo, I now have looked a bit closer at all this. And it looks a bit clearer now.

1. I had an error in the program I entered into the 15C emulator. One of the test command was wrong. Sorry, my bad. So I corrected this.

2. After the correction the program still required a substantial time even on the emulator. On a real 15C this would mean several minutes before a result is returned. If at all. It turned out that this depends on the initial value of R4. Which confirms my idea that it cannot be right that R4 is not initialized in the program: Depending on the initial R4 value the program runs fine, or may take a very long time.

R4 seems to hold some kind of initial guess for the first root. Now if R4 happens to hold a value like 10^9 and the root is near 1... I just stopped such an iteration which seemed to run endlessly.

So R4 should be initialized. There are two options now:

3a: The program as listed has an error and there actually is some code that initializes R4, but it is missing in the listing. That's why I asked you to carefully compare the code with the original listing.

3b: The original 29C program indeed has no initializsation code for R4. That's bad programming, but of course it's not your fault. In this case one could start with R4=0 (instead of what happens to be stored in R4 on program start). This can be done with a simple STO 4 after the final CLX at the end of the LBL A routine.

I modified the program this way and for the cases I tested it seems to run fine. At least there were no cases where the program required an exceptionally long execution time.

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(11C) CUBIC EQUATION - Gamo - 06-09-2018, 11:49 AM
RE: (11C) CUBIC EQUATION - Gamo - 06-09-2018, 12:34 PM
RE: (11C) CUBIC EQUATION - Dieter - 06-09-2018, 12:54 PM
RE: (11C) CUBIC EQUATION - rprosperi - 06-09-2018, 01:00 PM
RE: (11C) CUBIC EQUATION - Dieter - 06-09-2018, 06:05 PM
RE: (11C) CUBIC EQUATION - Dieter - 06-09-2018, 07:50 PM
RE: (11C) CUBIC EQUATION - Dieter - 06-10-2018, 07:15 AM
RE: (11C) CUBIC EQUATION - Dieter - 06-10-2018, 09:17 PM
RE: (11C) CUBIC EQUATION - Albert Chan - 07-20-2021, 10:12 PM
RE: (11C) CUBIC EQUATION - Gamo - 06-10-2018, 02:42 AM
RE: (11C) CUBIC EQUATION - Gamo - 06-10-2018, 02:36 PM
RE: (11C) CUBIC EQUATION - Dieter - 06-10-2018, 03:34 PM
RE: (11C) CUBIC EQUATION - Dieter - 06-10-2018 09:35 PM
RE: (11C) CUBIC EQUATION - Gamo - 06-11-2018, 02:16 AM
RE: (11C) CUBIC EQUATION - Dieter - 06-11-2018, 07:04 AM
RE: (11C) CUBIC EQUATION - Gamo - 06-11-2018, 08:19 AM
RE: (11C) CUBIC EQUATION - Dieter - 06-11-2018, 08:19 PM
RE: (11C) CUBIC EQUATION - Gamo - 06-12-2018, 07:02 AM



User(s) browsing this thread: