1. Go to this page and download the library: Download gamajo/quadratic library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
gamajo / quadratic example snippets
use Gamajo\Quadratic;
// Represents x^2 + 5x + 6 = 0.
$equation = new BasicQuadraticEquation(1, 5, 6);
$solver = new Solver($equation);
$solver->solve();
echo $solver->get(); // '2 and 3'
echo $solver->get('root1'); // '2'
echo $solver->get('root2'); // '3'
use Gamajo\Quadratic;
// Represents 3x^2 + 4x + 5 = 0.
$equation = new BasicQuadraticEquation(3, 4, 5);
$solver = new Solver($equation);
$solver->solve();
echo $solver->get(); // '-0.667 + 1.106i and -0.667 - 1.106i'