1. Analytical Solution Of Cubic Equation
In this paper will illustrated how to find roots of cubic equation with formula as
following:-
Note:-
If your equation as following just divide equation on
parameter of x 3
(A) .The cubic equation has normally three real roots sometimes
all of them different or two of them equal each other and in cases has one real root.
Example:-
I. Roots
II. Roots
III. Root
CODE OF FUNCTION:-
function [ROOT] = CERO(A,B,C)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
Q=(power(A,2)-3*B)/9;
R=(2*power(A,3)-9*A*B+27*C)./54;
MM=power(R,2)-power(Q,3);
if MM<=0;
THET=acos(R./sqrt(power(Q,3)));
X1=-(2*sqrt(Q)*cos(THET./3))-A./3;
X2=-(2*sqrt(Q)*cos((THET-2*pi)./3))-A./3;
X3=-(2*sqrt(Q)*cos((THET+2*pi)./3))-A./3;
ROOT=[X1 X2 X3];
else
S=-sign(R)*power((abs(R)+sqrt(MM)),1/3);
TT=Q./S;
X1=S+TT-A./3;
ROOT=X1;
end
end