Created
July 30, 2020 18:04
-
-
Save jcrvz/1a684a49927637635065bd260a8eba2f to your computer and use it in GitHub Desktop.
Loh's method for quadratic formula
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% https://www.poshenloh.com/quadratic/ | |
function rts = altRoots(p2) | |
if p2(1) ~= 1 | |
p2 = p2 / p2(1); | |
end | |
average_value = p2(2) / 2; | |
product_value = p2(3); | |
distance = sqrt(average_value^2 - product_value); | |
rts = -average_value + distance * [-1; 1]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment