| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 
 | var Polynome = function (a, b, c){
    if ((a===undefined) && (a!== typeOf(number))) a = 0;
    if ((b===undefined) && (b!== typeOf(number))) b = 0;
    if ((c===undefined) && (c!== typeOf(number))) c = 0;
 
    this.a = a;
    this.b = b;
    this.c = c;
    this.racine = 0;
    var determin = this.determinant(this.a, this.b, this.c);
    this.racine()
};
 
// methode interne
Polynome.prototye.determinant = function(a, b, c) {
   return (Math.sqrt((this.b*this.b)-(4*this.a*this.c)))
}
// methode interne
Polynome.prototye.racine = function(){
    if (this.determinant()>0) {
        this.racinePos();
        this.racineNeg();
    } else {
        return ("Ce polynome n'a pas de racine");
    }
}
// methode interne
Polynome.prototye.racinePos = function() {
    return ((-this.b+(this.determinant))/2*this.a);
    ++this.racine;
 
}
// methode interne
 Polynome.prototye.racineNeg = function() {
    return ((-this.b-(this.determinant))/2*this.a);
    ++this.racine;
 }
// methode interne
  Polynome.prototye.getRacine = function() {
    if (this.determinant===undefined) return ("Ce polynome n'a pas de racines réelles");
    return(this.racine)
  }
 
  Polynome.prototye.toString = function(){
    return("f(x)=" + this.a + "x2" + this.b + "x" + this.c
           + "# de racine" + this.racine);
  } | 
Partager