The solution to the quartic equation on the HP50g, revisited
#1

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,074 12-13-2013, 09:36 AM
Last Post: CompSystems
  17BII & 17BII+ Discounted Payback Period Revisited Tom Neudorfl 8 2,808 11-25-2013, 10:28 AM
Last Post: Don Shepherd
  Touch periodic table on HP Prime - revisited Terje Vallestad 2 1,385 11-23-2013, 11:47 AM
Last Post: Mic
  Equation Library/App for the Prime Harold A Climer 3 1,680 10-30-2013, 10:14 AM
Last Post: CompSystems
  Equation Library on the PRIME Harold A Climer 0 1,036 10-26-2013, 10:01 AM
Last Post: Harold A Climer
  Meltiple Equation Solver PRIME Vs. HP 50G Harold A Climer 5 1,779 10-07-2013, 05:11 PM
Last Post: CR Haeger
  EOT--TI N-Spire Equation Limit Matt Agajanian 2 1,268 09-22-2013, 12:37 PM
Last Post: Matt Agajanian
  Does Prime Have a Multiple Equation Solver? Norman Dziedzic 2 1,343 09-20-2013, 09:43 AM
Last Post: Norman Dziedzic
  Equation of the parabola given three points Gerson W. Barbosa 27 6,262 09-18-2013, 01:58 PM
Last Post: Gerson W. Barbosa
  hp50g screen weird line Sok-khieng Chum Hun 2 1,569 09-10-2013, 08:11 AM
Last Post: Sok-khieng Chum Hun

Forum Jump: