Post Reply 
cubic solver
06-29-2024, 03:29 PM (This post was last modified: 07-02-2024 11:12 AM by Albert Chan.)
Post: #5
RE: cubic solver
Previous post was for XCas. Here is for HP Prime Cas

Code:
#cas
quadratic(a,b) := 
BEGIN
LOCAL d;
a /= 2; /* x^2 = 2a*x + b */
print(d := normal(a*a+b));
IF d==0 THEN return [a,a] END;
d := sqrt(d);
a -= d * (-1) ^ bool(abs(a+d) >= abs(a-d));
return [a, -b/a];
END;

cubic(a,b) :=
BEGIN
a /= 3; /* x^3 = 3a*x + b */
b := quadratic(b,-a^3)[1];
IF b==0 THEN return [0,0,0] END;
b := surd(b,3)*(-1)^[0,2/3,-2/3]; 
return b .+ a ./ b;
END;
#end

Is there a way to print out discriminant on the same screen? (i.e. without pressing key to get back?)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
cubic solver - Albert Chan - 09-08-2023, 02:26 PM
RE: cubic solver - Albert Chan - 09-08-2023, 02:44 PM
RE: cubic solver - parisse - 09-08-2023, 06:56 PM
RE: cubic solver - Albert Chan - 06-29-2024, 02:46 PM
RE: cubic solver - Albert Chan - 06-29-2024 03:29 PM
RE: cubic solver - Albert Chan - 07-02-2024, 02:34 PM
RE: cubic solver - Albert Chan - 07-02-2024, 05:12 PM
RE: cubic solver - Albert Chan - 07-03-2024, 10:17 PM
RE: cubic solver - Albert Chan - 07-03-2024, 11:48 PM
Quarter Solver - Albert Chan - 07-04-2024, 08:37 PM



User(s) browsing this thread: 11 Guest(s)