The following warnings occurred:
Warning [2] Undefined array key 226040 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 226089 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 226096 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 226106 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 226109 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 226129 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 226130 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 226142 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 226242 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $thread - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $fid - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 226129 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 226242 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $theme - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $theme - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $lang - Line: 5 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 5 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Attempt to read property "messages_in_thread" on null - Line: 5 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 5 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks





Cubic Formula: HP 71B



#2

Calculator Blog

(Updated 7/1/12 - thanks everyone!)


Edited: 1 July 2012, 4:49 p.m. after one or more responses were posted


#3

Hi Eddie,

Thanks for sharing this interesting approach.

Just for sake of precision, in your program listing, line 36 seems truncated and merged with line 38; and line 54 can be removed.

Hope this helps.

Best wishes.

Diego.


#4

Also, there's a typo in line 30. It should be

30 P = 2*B^3 - 9*A*B*C + 27*A^2*D. 
If line 36 is changed to
36 IF A1 < 0 THEN 48
it will work for his first and last examples. Assuming line 36 is correct, there's still one typo left because of the byte count (547 bytes instead of 549). There is another typo in X1 in the second example (an extra zero between 4 and 6).
This will be a nice program to convert to RPN when Eddie fixes the typos.

Regards,

Gerson.


#5

Quote:
Also, there's a typo in line 30. It should be
30 P = 2*B^3 - 9*A*B*C + 27*A^2*D. 
If line 36 is changed to
36 IF A1 < 0 THEN 48
it will work for his first and last examples. Assuming line 36 is correct, there's still one typo left because of the byte count (547 bytes instead of 549). There is another typo in X1 in the second example (an extra zero between 4 and 6).
This will be a nice program to convert to RPN when Eddie fixes the typos.

Regards,

Gerson.


Diego and Gerson: Thank you so much. I made the corrections. In addition to deleting line 54, I also deleted line 100. I also had to make corrections on one of the examples.

The program is now 533 bytes.

The link on the original post is updated. I appreciate that you pointed my errors to me. :)


#6

Eddie,

Would you please double-check the lines 48, 50 and 52? It still doesn't work when A1<0 (your second and fourth examples). Two bytes are still missing. X1 in the second example should be -3.46050487001, not -3.406050487001.

Thank you,

Gerson.


#7

For Example 2
A = 1,

B = 4,

C = 1,

D = -3

I get:


P = 11


Q = 13


A1 = -2166.75


For Example 4

A = 1

B = -2

C = -5

D = 6

I get:

P = 56

Q = 19

A1 = -6075


Does this help?


Edited: 2 July 2012, 8:54 a.m.

#8

Quote:
Eddie,

Would you please double-check the lines 48, 50 and 52? It still doesn't work when A1<0 (your second and fourth examples). Two bytes are still missing. X1 in the second example should be -3.46050487001, not -3.406050487001.

Thank you,

Gerson.


Line 52 should be

52 X1 = -B/(3*A) - 2/(3*A) * (P1^(1/3)*COS(P2/3))

On a separate note, I edited line 68 to:

68 IF K>=0 THEN 70 ELSE 90

This corrects the display for repeated roots (Example 5)

I edited the blog too.


Edited: 2 July 2012, 9:40 a.m.


#9

Hello Eddie,

Thanks for the program! The algorithm will be perfect for calculators that don't have native complex numbers. Thanks also for your prompt fixing of the typos. All examples work fine now:


>RUN
CUBIC
A,B,C,D 3,3,-3,6
X1=-1.99999999999
REAL= .499999999995
IMAG= .866025403772

>RUN
CUBIC
A,B,C,D 1,4,1,-3
X1=-3.46050487001
X2= .699628148275
X3=-1.23912327826

>RUN
CUBIC
A,B,C,D -2,0,-1,5
X1= 1.23477282504
REAL=-.61738641252
IMAG=-1.28198983892

>RUN
CUBIC
A,B,C,D 1,-2,-5,6
X1=-1.99999999999
X2= 3
X3= .999999999985

>RUN
CUBIC
A,B,C,D 1,-3,3,-1
X1= 1
X2= 1
X3= 1

Have you considered using Jean-François Garnier's
Emu71 emulator? You can avoid typing errors by editing your program on the emulator and copying the program lines from the DOS windows and pasting them to your text editor (I think this should be possible also on Christoph Giesselink's HP71B Emulator).
Since there is no line between lines 68 and 70, you can save a few bytes by rewriting line 68 as

68 IF K<0 THEN 90

Best regards,

Gerson.


#10

I like emulators, but for me, there is nothing like operating on the real thing.


Possibly Related Threads…
Thread Author Replies Views Last Post
  how to manage formula in prime fabrice48 5 2,427 12-05-2013, 01:09 PM
Last Post: Steve Simpkin
  Quadratic & Cubic Regression RPN progs Matt Agajanian 9 2,832 09-17-2013, 11:37 AM
Last Post: Jeff O.
  Cubic root (-8) = 2 ? Gilles Carpentier 37 10,023 08-12-2013, 10:26 PM
Last Post: jep2276
  Fast Quadratic Formula for the HP-41C Gerson W. Barbosa 21 5,987 07-18-2012, 08:53 AM
Last Post: Gerson W. Barbosa
  Quadratic formula program help Chris C 18 4,694 06-16-2012, 12:14 AM
Last Post: Matt Agajanian
  Complex Cubic Equation - 41Z Version Ángel Martin 3 1,226 10-19-2011, 04:23 PM
Last Post: Ángel Martin
  Which quadratic formula is use? Michel Beaulieu 7 2,238 09-29-2011, 10:17 PM
Last Post: Jeff O.
  Solving a cubic equation using trigonometry, but with a2 term? snaggs 1 965 09-29-2011, 07:19 AM
Last Post: Dieter
  Solving a cubic equation using trigonometry Thomas Klemm 10 2,559 03-26-2011, 05:42 PM
Last Post: Eddie W. Shore
  Re: The lost formula Csaba Tizedes (Hungary) 5 1,797 01-26-2011, 05:59 AM
Last Post: Csaba Tizedes (Hungary)

Forum Jump: