Esempio n. 1
0
/**
 * Factorise un polynome en fonction de sa racine
 * @param  Polynome 				$polynome	Le polynome
 * @param  int 						$racines	Les racines
 * @return Array(string->string)				Les formes factorisée, alternative et le polynome de vérification
 */
function factorizeOne($P1, $racine)
{
    $P2 = racinesToPolynome($racine);
    $P3 = $P1->algorithme($P2);
    $racines = racines($P3);
    $P4 = racinesToPolynome($racines);
    $P5 = $P3->algorithme($P4);
    $factorise = "(" . $P2 . ")(" . $P4 . ")(" . $P5 . ")";
    $factorise2 = prettyFactors($P2, $P4, $P5);
    $verif = $P2->multPolynome($P4->multPolynome($P5));
    return array("factorise" => $factorise, "factorise2" => $factorise2, "verification" => $verif);
}
Esempio n. 2
0
$matF0tmp2 = subMatrices($A, $matF0tmp);
$F1 = multMatrices($A, $matF0tmp2);
echo printMatrice($F1, "F1", "F1");
$trF1 = trace($F1) / 2;
$matF1tmp = multMatriceNumber($I3, $trF1);
$matF1tmp2 = subMatrices($F1, $matF1tmp);
$F2 = multMatrices($A, $matF1tmp2);
echo printMatrice($F2, "F2", "F2");
$trF2 = trace($F2) / 3;
echo "</div>";
$monomeCube = new Monome(-1, 3);
$monomeCarre = new Monome($trA, 2);
$monomeSimple = new Monome($trF1, 1);
$monomeZero = new Monome($trF2, 0);
$PA = new Polynome(array($monomeCube, $monomeCarre, $monomeSimple, $monomeZero));
$racines = racines($PA);
echo "<div class='panel panel-warning'>" . "<div class='panel-heading'>" . "<h2 class='panel-title'>Polynôme</h2></div>" . "<div class='panel-body'><h3><strong>" . $PA . "</strong></h3></div></div>";
echo "<div class='panel panel-info'><div class='panel-heading'><h2 class='panel-title'>Racines</h2></div><div class='panel-body'>";
if (count($racines) == 1) {
    $res = factorizeOne($PA, $racines[0]);
    $factorise = $res["factorise"];
    $factorise2 = $res["factorise2"];
    $verif = $res["verification"];
    echo "<h3>La racine entière de ce polynôme est <strong>" . $racines[0] . "</strong></h3>";
} elseif (count($racines) == 2) {
    $res = factorizeTwo($PA, $racines);
    $factorise = $res["factorise"];
    $factorise2 = $res["factorise2"];
    $verif = $res["verification"];
    echo "<h3>Les deux racines entières de ce polynôme sont <strong>" . $racines[0] . "</strong> et <strong>" . $racines[1] . "</strong>.</h3>";
} elseif (count($racines) == 3) {
Esempio n. 3
0
<?php 
include_once 'fonctions.php';
include_once 'Monome.php';
include_once 'Polynome.php';
$time_start = microtime(true);
$a3 = $_POST["a3"];
$a2 = $_POST["a2"];
$a1 = $_POST["a1"];
$a0 = $_POST["a0"];
$monomeX = new Monome(1, 1);
$monomeCube = new Monome($a3, 3);
$monomeCarre = new Monome($a2, 2);
$monomeSimple = new Monome($a1, 1);
$monomeZero = new Monome($a0, 0);
$polynome = new Polynome(array($monomeCube, $monomeCarre, $monomeSimple, $monomeZero));
$racines = racines($polynome);
echo "<div class='panel panel-warning'>" . "<div class='panel-heading'>" . "<h2 class='panel-title'>Polynôme</h2></div>" . "<div class='panel-body'><h3><strong>" . $polynome . "</strong></h3></div></div>";
echo "<div class='panel panel-info'><div class='panel-heading'><h2 class='panel-title'>Racines</h2></div><div class='panel-body'>";
if (count($racines) == 1) {
    $res = factorizeOne($polynome, $racines[0]);
    $factorise = $res["factorise"];
    $factorise2 = $res["factorise2"];
    $verif = $res["verification"];
    echo "<h3>La racine entière de ce polynôme est <strong>" . $racines[0] . "</strong></h3>";
} elseif (count($racines) == 2) {
    $res = factorizeTwo($polynome, $racines);
    $factorise = $res["factorise"];
    $factorise2 = $res["factorise2"];
    $verif = $res["verification"];
    echo "<h3>Les deux racines entières de ce polynôme sont <strong>" . $racines[0] . "</strong> et <strong>" . $racines[1] . "</strong>.</h3>";
} elseif (count($racines) == 3) {