The following warnings occurred:
Warning [2] Undefined array key 200973 - 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 200973 - 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 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





The solution to the quartic equation on the HP50g, revisited



#2

The last time I posted about this topic, I had a program that had the HP50g itself go through the steps to solve the equation from first principles. This took about 3 minutes (for the most general case), and the final result couldn't be displayed in pretty print.

This solution is basically just plugging into an already simplified solution. It "solves" the general case in about 10 seconds, and the result can be displayed in pretty print.

%%HP: T(3)A(R)F(.);
\<< 0 0 0 0 \-> A B C D E ALPHA BETA GAMM DELTA
\<< C 2 ^ 3 B D * * - 12 A E * * + 'ALPHA' STO 2 C 3 ^ * 9 B C D * * * - 27 A D 2 ^ * * + 27 B 2 ^ E * * + 72 A C E * * * - 'BETA' STO BETA 'SQUAREROOT' \v/ 'SQUAREROOT' -4 ALPHA 3 ^ * BETA 2 ^ + = SUBST + 'GAMM' STO 'SQUAREROOT' \v/ 'SQUAREROOT' B 2 ^ 4 A 2 ^ * / 2 C * 3 A * / - ALPHA 3 A GAMM 2 / 3 INV ^ * * / 1 3 A * / GAMM 2 / 3 INV ^ * + + = SUBST 'DELTA' STO B NEG 4 A * / 2 INV DELTA * - 2 INV NEG 'SQUAREROOT' \v/ 'SQUAREROOT' B 2 ^ 2 A 2 ^ * / 4 C * 3 A * / - ALPHA 3 A * GAMM 2 / 3 INV ^ * / - 3 A * INV GAMM 2 / 3 INV ^ * - B 3 ^ A 3 ^ / 4 B C * * A 2 ^ / - 8 D * A / + 4 DELTA * / + = SUBST * +
\>>
\>>


The solution is:

%%HP: T(3)A(R)F(.);
'((-(B/(4*A)))-((1/2)*(\v/((((B^2)/(4*(A^2)))-((2*C)/(3*A)))+(((((C^2)-(3*(B*D)))+(12*(A*E)))/(3*(A*XROOT(3,((((((2*(C^3))-(9*(B*(C*D))))+(27*(A*(D^2))))+(27*((B^2)*E)))-(72*(A*(C*E))))+(\v/(((-4)*((((C^2)-(3*(B*D)))+(12*(A*E)))^3))+((((((2*(C^3))-(9*(B*(C*D))))+(27*(A*(D^2))))+(27*((B^2)*E)))-(72*(A*(C*E))))^2))))/2))))+((1/(3*A))*XROOT(3,((((((2*(C^3))-(9*(B*(C*D))))+(27*(A*(D^2))))+(27*((B^2)*E)))-(72*(A*(C*E))))+(\v/(((-4)*((((C^2)-(3*(B*D)))+(12*(A*E)))^3))+((((((2*(C^3))-(9*(B*(C*D))))+(27*(A*(D^2))))+(27*((B^2)*E)))-(72*(A*(C*E))))^2))))/2)))))))-((1/2)*(\v/((((((B^2)/(2*(A^2)))-((4*C)/(3*A)))-((((C^2)-(3*(B*D)))+(12*(A*E)))/((3*A)*XROOT(3,((((((2*(C^3))-(9*(B*(C*D))))+(27*(A*(D^2))))+(27*((B^2)*E)))-(72*(A*(C*E))))+(\v/(((-4)*((((C^2)-(3*(B*D)))+(12*(A*E)))^3))+((((((2*(C^3))-(9*(B*(C*D))))+(27*(A*(D^2))))+(27*((B^2)*E)))-(72*(A*(C*E))))^2))))/2))))-((1/(3*A))*XROOT(3,((((((2*(C^3))-(9*(B*(C*D))))+(27*(A*(D^2))))+(27*((B^2)*E)))-(72*(A*(C*E))))+(\v/(((-4)*((((C^2)-(3*(B*D)))+(12*(A*E)))^3))+((((((2*(C^3))-(9*(B*(C*D))))+(27*(A*(D^2))))+(27*((B^2)*E)))-(72*(A*(C*E))))^2))))/2)))+(((((B^3)/(A^3))-((4*(B*C))/(A^2)))+((8*D)/A))/(4*(\v/((((B^2)/(4*(A^2)))-((2*C)/(3*A)))+(((((C^2)-(3*(B*D)))+(12*(A*E)))/(3*(A*XROOT(3,((((((2*(C^3))-(9*(B*(C*D))))+(27*(A*(D^2))))+(27*((B^2)*E)))-(72*(A*(C*E))))+(\v/(((-4)*((((C^2)-(3*(B*D)))+(12*(A*E)))^3))+((((((2*(C^3))-(9*(B*(C*D))))+(27*(A*(D^2))))+(27*((B^2)*E)))-(72*(A*(C*E))))^2))))/2))))+((1/(3*A))*XROOT(3,((((((2*(C^3))-(9*(B*(C*D))))+(27*(A*(D^2))))+(27*((B^2)*E)))-(72*(A*(C*E))))+(\v/(((-4)*((((C^2)-(3*(B*D)))+(12*(A*E)))^3))+((((((2*(C^3))-(9*(B*(C*D))))+(27*(A*(D^2))))+(27*((B^2)*E)))-(72*(A*(C*E))))^2))))/2))))))))))'


I've tested it with numerical inputs, and confirmed it works.

Caveats from the previous thread still apply. If you want a numerical result, you should be in approx. mode before running the program, or the calculator might not be able to evaluate the result to a number.


Possibly Related Threads…
Thread Author Replies Views Last Post
  [HP-PIRME] BUG Pretty Print, Solution: abs => |...|, ABS => ||...|| CompSystems 2 2,039 12-13-2013, 09:36 AM
Last Post: CompSystems
  17BII & 17BII+ Discounted Payback Period Revisited Tom Neudorfl 8 2,787 11-25-2013, 10:28 AM
Last Post: Don Shepherd
  Touch periodic table on HP Prime - revisited Terje Vallestad 2 1,353 11-23-2013, 11:47 AM
Last Post: Mic
  Equation Library/App for the Prime Harold A Climer 3 1,668 10-30-2013, 10:14 AM
Last Post: CompSystems
  Equation Library on the PRIME Harold A Climer 0 1,024 10-26-2013, 10:01 AM
Last Post: Harold A Climer
  Meltiple Equation Solver PRIME Vs. HP 50G Harold A Climer 5 1,755 10-07-2013, 05:11 PM
Last Post: CR Haeger
  EOT--TI N-Spire Equation Limit Matt Agajanian 2 1,254 09-22-2013, 12:37 PM
Last Post: Matt Agajanian
  Does Prime Have a Multiple Equation Solver? Norman Dziedzic 2 1,326 09-20-2013, 09:43 AM
Last Post: Norman Dziedzic
  Equation of the parabola given three points Gerson W. Barbosa 27 6,150 09-18-2013, 01:58 PM
Last Post: Gerson W. Barbosa
  hp50g screen weird line Sok-khieng Chum Hun 2 1,540 09-10-2013, 08:11 AM
Last Post: Sok-khieng Chum Hun

Forum Jump: