SlideShare a Scribd company logo
1 of 63
Download to read offline
!
quot;#



                  (

     $   %'
          &
1
3
ax + bx + c = 0
      2




4
)




       − b ± b − 4ac
              2
    x=
             2a


5
)




    ∆ = b − 4ac
        2




6
)quot;        *
    y




        X1   X2
                      x




7
&       *             ) quot;(

        Initial Request



           1 Day
           After




                   1 Week
                    After




8
&       *             ) quot;(

        Initial Request          Evolution Request



           1 Day
           After
                                             Few Weeks Later




                                    1 Day
                   1 Week
                                    After
                    After




9
1
10
)quot;        &

          j



     X1        X2




                        x




11
&       *             ) quot;(

         Initial Request



            1 Day
            After




                    1 Week
                     After




12
&       *             ) quot;(

         Initial Request          Evolution Request



            1 Day                               Few Weeks Later
            After




                                     1 Day
                    1 Week
                                     After
                     After




13
1
14
)&      +*        ,
     y




             X1        X2
                                x



                  X
                            X
         X



15
&       *             ) quot;(

         Initial Request



            1 Day
            After




                    1 Week
                     After




16
&       *             ) quot;(

         Initial Request          Evolution Request



            1 Day
            After
                                             Few Weeks Later ?




                                     1 Day
                    1 Week
                                     After
                     After




17
1
18
Start


                           Input coefficients a,b,c




                           Computes discriminant
                           Delta = b * b – 4 * a * c



                                                       <0
                      >0        Discriminant
                                    Sign

                                           =0
     Computes roots         Computes single root



       print roots                print root                print no roots



                                     End


19
1
20
delta = (b*b) - (4*a*c); // discrimant computation

     if (delta < 0.0) {
              System.out.println (quot; No rootsquot;);
     }

     else if (delta > 0.0) {
             System.out.println (quot; Two roots :quot;);
             System.out.println (quot; x1 = quot; + (-b + Math.sqrt(delta))/ (2.0 * a));
             System.out.println (quot; x2 = quot; + (-b - Math.sqrt(delta))/ (2.0 * a));
     }

     else {
              System.out.println (“ Single root: quot;);
              System.out.println (quot; x = quot; + (-b / (2.0 * a)));
     }




21
1
22
Start


                           Input coefficients a,b,c




                           Computes discriminant
                           Delta = b * b – 4 * a * c



                                                       <0
                      >0        Discriminant
                                    Sign

                                           =0
     Computes roots         Computes single root



       print roots                print root                print no roots



                                     End


23
&                  (
                                     Start


                           Input coefficients a,b,c




                           Computes discriminant
                           Delta = b * b – 4 * a * c



                                                       <0
                      >0        Discriminant
                                    Sign

                                           =0
                                                            Computes Complex roots
     Computes roots        Computes double root



       print roots                print root                      print roots



                                     End
24
delta = (b*b) - (4*a*c); // discrimant computation

     if (delta < 0.0) {
              System.out.println (quot; No rootsquot;);
     }

     else if (delta > 0.0) {
             System.out.println (quot; Two roots :quot;);
             System.out.println (quot; x1 = quot; + (-b + Math.sqrt(delta))/ (2.0 * a));
             System.out.println (quot; x2 = quot; + (-b - Math.sqrt(delta))/ (2.0 * a));
     }

     else {
              System.out.println (“ Single root: quot;);
              System.out.println (quot; x = quot; + (-b / (2.0 * a)));
     }




25
quot;                quot;
     delta =   (b*b) -    (4*a*c); // discrimant computation

     if (delta < 0.0) {
              System.out.println (quot; No rootsquot;);
     }

     else if   (delta > 0.0) {
               System.out.println (quot; Two roots :quot;);
               System.out.println (quot; x1 = quot; + (-b + Math.sqrt(delta))/ (2.0 * a));
               System.out.println (quot; x2 = quot; + (-b - Math.sqrt(delta))/ (2.0 * a));

     System.out.println   (quot;   Complex rootsquot;);
     System.out.println   (quot;   x1 real part = quot; + (-b / (2.0*a)));
     System.out.println   (quot;   x2 imaginary part = quot; + (-b - Math.sqrt(-delta))/ (2.0*a)+ quot;iquot;);
     System.out.println   (quot;   x2 real part = quot; + (-b / (2.0*a)));
     System.out.println   (quot;   x2 imaginary part= quot; + (-b - Math.sqrt(-delta))/ (2.0*a)+ quot;iquot;);

     }

     else {
               System.out.println (“ Single root: quot;);
               System.out.println (quot; x = quot; + (-b / (2.0 * a)));
     }




26
1
27
,            )&   +*       ,

     y




                 X1            X2
                                        x



                      X
                                    X
         X



28
&         +*                        ,)

                                                           Discriminat
                                                              Sign
                                                                              <0
                                              >0

                                                                   =0
          Computes root case 1                     Computes roots case 2 2

                                         T                                         F
      T                          F                   ( /X1/ <= X & X <=
                X == X1
                                                            /X2/ )




 Return True              Return False       Return True                 Return False   Return False




                                                      End



29
&       *             ) quot;(

         Initial Request



            1 Day
            After




                    1 Week
                     After




30
&       *             ) quot;(

         Initial Request          Evolution Request



            1 Day
            After
                                             Few Weeks Later ?




                                     1 Day
                    1 Week
                                     After
                     After




31
&

 static boolean isInBetweenRoots(double x,double a,double b, double c) {

          double delta, x1, x2;
          delta = (b*b) - (4*a*c);

          if (delta < 0.0)

                   return false;

          else if (delta > 0.0) {

                   System.out.print(quot;delta > 0quot;);
                   x1 = (-b + Math.sqrt(delta))/ (2.0*a);
                   x2 = (-b - Math.sqrt(delta))/ (2.0*a);
                   return (Math.abs(x1) <= Math.abs(x)) && (Math.abs(x) <= Math.abs(x2));

          }

          else {
                   x1 = -b / (2.0 * a);
                   return (x == x1);
          }
 }




32
1
33
-     )                 -

                             6HFRQG 2UGHU
                              3 RO  QRP L D O




      6L QJ O H 5 RRW          7 Z R 5 RRW V            1 R 5 RRW
     6HFRQG 2UGHU            6HFRQG 2UGHU            6HFRQG 2UGHU
      3 RO  QRP L D O        3 RO  QRP L D O        3 RO  QRP L D O




34
-     )                 -

                             6HFRQG 2UGHU
                              3 RO  QRP L D O           ' L V FUL P L QD QW




      6L QJ O H 5 RRW          7 Z R 5 RRW V            1 R 5 RRW
     6HFRQG 2UGHU            6HFRQG 2UGHU            6HFRQG 2UGHU
      3 RO  QRP L D O        3 RO  QRP L D O        3 RO  QRP L D O




35
-       #
                              6HFRQG 2UGHU
                               3 RO  QRP L D O

                                                      ' L V FUL P L QD QW
                             Double a
                             Double b
                             Double c
                              computeRoots()




      6L QJ O H 5 RRW           7 Z R 5 RRW V        1 R 5 RRW
     6HFRQG 2UGHU             6HFRQG 2UGHU        6HFRQG 2UGHU
      3 RO  QRP L D O         3 RO  QRP L D O    3 RO  QRP L D O


     computeRoots()           computeRoots()      computeRoots()




36
-      &                #

                             6HFRQG 2UGHU
                              3 RO  QRP L D O
                             computeRoots()
                                create()




      6L QJ O H 5 RRW          7 Z R 5 RRW V        1 R 5 RRW
     6HFRQG 2UGHU            6HFRQG 2UGHU        6HFRQG 2UGHU
      3 RO  QRP L D O        3 RO  QRP L D O    3 RO  QRP L D O
     computeRoots()          computeRoots()      computeRoots()




37
1
38
-



                         ' L V FUL P L QD QW
     6HFRQG 2UGHU
      3 RO  QRP L D O




39
-     )
                             6HFRQG 2UGHU
                              3 RO  QRP L D O




         6HFRQG 2UGHU
          3 RO  QRP L D O
            ) D FW RU



                             ' L V FUL P L QD QW




40
-   )
                                 6HFRQG 2UGHU
                                  3 RO  QRP L D O




             6HFRQG 2UGHU
              3 RO  QRP L D O
                ) D FW RU



                                 ' L V FUL P L QD QW




41
-       #
                              6HFRQG 2UGHU
                               3 RO  QRP L D O

                                                      ' L V FUL P L QD QW
                             Double a
                             Double b
                             Double c
                              computeRoots()




      6L QJ O H 5 RRW           7 Z R 5 RRW V        1 R 5 RRW
     6HFRQG 2UGHU             6HFRQG 2UGHU        6HFRQG 2UGHU
      3 RO  QRP L D O         3 RO  QRP L D O    3 RO  QRP L D O


     computeRoots()           computeRoots()      computeRoots()




42
class Discriminant {

            private double delta;


            public Discriminant (double a, double b, double c) {

                   delta = (b * b) - (4.0 * a * c);

            }

            public double value () {

                   return delta;
            }

     }




43
)            *

 static Polynome create( double a, double b, double c) {

         Discriminant theDiscriminant = new Discriminant(a,b,c);
         double delta = theDiscriminant.value();
         Polynome polynome;

         if (delta == 0.0) {

                  return polynome = new SingleRootPolynome(a,b,c,theDiscriminant) ;
         }
         else if (delta > 0.0) {

                  return polynome = new TwoRootsPolynome(a,b,c,theDiscriminant) ;
         }
         else {

                  return polynome = new NoRootPolynome(a,b,c,theDiscriminant);
         }
 }




44
*                         &

 static Polynome create( double a, double b, double c) {

          Discriminant theDiscriminant = new Discriminant(a,b,c);
          double delta = theDiscriminant.value();
          Polynome polynome;

          if (delta == 0.0) {

                   return polynome = new SingleRootPolynome(a,b,c,theDiscriminant) ;
          }
          else if (delta > 0.0) {

                   return polynome = new TwoRootsPolynome(a,b,c,theDiscriminant) ;
          }
          else {

                   return polynome = new ComplexRootsPolynome(a,b,c,theDiscriminant);
          }
 }




45
1
46
-      #
                              6HFRQG 2UGHU
                               3 RO  QRP L D O

                                                      ' L V FUL P L QD QW
                             Double a
                             Double b
                             Double c
                              computeRoots()




      6L QJ O H 5 RRW           7 Z R 5 RRW V        1 R 5 RRW
     6HFRQG 2UGHU             6HFRQG 2UGHU        6HFRQG 2UGHU
      3 RO  QRP L D O         3 RO  QRP L D O    3 RO  QRP L D O


     computeRoots()           computeRoots()      computeRoots()




47
&                  )        *




void computesRoots() {


         System.out.println (quot; Single root: quot;);
         System.out.println (quot; x = quot; + (-b / (2.0*a)));
}




48
-      #
                              6HFRQG 2UGHU
                               3 RO  QRP L D O

                                                      ' L V FUL P L QD QW
                             Double a
                             Double b
                             Double c
                              computeRoots()




      6L QJ O H 5 RRW           7 Z R 5 RRW V        1 R 5 RRW
     6HFRQG 2UGHU             6HFRQG 2UGHU        6HFRQG 2UGHU
      3 RO  QRP L D O         3 RO  QRP L D O    3 RO  QRP L D O


     computeRoots()           computeRoots()      computeRoots()




49
&                          ) #*



void computesRoots() {


         System.out.println (quot; Two roots :quot;);
         System.out.println (quot; x1 = quot; + (-b + Math.sqrt(discriminant.value()))/ (2.0*a));
         System.out.println (quot; x2 = quot; + (-b - Math.sqrt(discriminant.value()))/ (2.0*a));
}




50
-      #
                              6HFRQG 2UGHU
                               3 RO  QRP L D O

                                                      ' L V FUL P L QD QW
                             Double a
                             Double b
                             Double c
                              computeRoots()




      6L QJ O H 5 RRW           7 Z R 5 RRW V        1 R 5 RRW
     6HFRQG 2UGHU             6HFRQG 2UGHU        6HFRQG 2UGHU
      3 RO  QRP L D O         3 RO  QRP L D O    3 RO  QRP L D O


     computeRoots()           computeRoots()      computeRoots()




51
&                  ). *




void computesRoots() {


         System.out.println (quot; No rootsquot;);
}




52
1
53
-      #
                              6HFRQG 2UGHU
                               3 RO  QRP L D O

                                                      ' L V FUL P L QD QW
                             Double a
                             Double b
                             Double c
                              computeRoots()




      6L QJ O H 5 RRW           7 Z R 5 RRW V        1 R 5 RRW
     6HFRQG 2UGHU             6HFRQG 2UGHU        6HFRQG 2UGHU
      3 RO  QRP L D O         3 RO  QRP L D O    3 RO  QRP L D O


     computeRoots()           computeRoots()      computeRoots()




54
-      #
                              6HFRQG 2UGHU
                               3 RO  QRP L D O

                                                       ' L V FUL P L QD QW
                             Double a
                             Double b
                             Double c
                              computeRoots()




      6L QJ O H 5 RRW           7 Z R 5 RRW V     & RP S O H[ 5 RRW V
     6HFRQG 2UGHU             6HFRQG 2UGHU         6HFRQG 2UGHU
      3 RO  QRP L D O         3 RO  QRP L D O     3 RO  QRP L D O


     computeRoots()           computeRoots()      computeRoots()




55
&                    )&           (*

     void computesRoots() {


             System.out.println (quot; Complex rootsquot;);


             System.out.println (quot; x1 real part = quot; + (-b / (2.0*a)));
             System.out.println (quot; x1 imaginary part = “
                               + (-b + Math.sqrt(-discriminant.value()))/ (2.0*a)+
     quot;iquot;);


             System.out.println (quot; x2 real part = quot; + (-b / (2.0*a)));
             System.out.println (quot; x2 imaginary part = “
                               + (-b - Math.sqrt(-discriminant.value()))/ (2.0*a)+
     quot;iquot;);
     }




56
1
57
-

                             6HFRQG 2UGHU
                              3 RO  QRP L D O
                             computeRoots()
                           isInBetweenRoots()




        6L QJ O H 5 RRW        7 Z R 5 RRW V          1 R 5 RRW
       6HFRQG 2UGHU          6HFRQG 2UGHU          6HFRQG 2UGHU
        3 RO  QRP L D O      3 RO  QRP L D O      3 RO  QRP L D O
       computeRoots()        computeRoots()        computeRoots()
     isInBetweenRoots()    isInBetweenRoots()    isInBetweenRoots()




58
/+                       )




boolean isInBetweenRoots(double x) {


     return (x == x1);


}




59
-
                             6HFRQG 2UGHU
                              3 RO  QRP L D O

                             computeRoots()
                           isInBetweenRoots()




        6L QJ O H 5 RRW        7 Z R 5 RRW V          1 R 5 RRW
       6HFRQG 2UGHU          6HFRQG 2UGHU          6HFRQG 2UGHU
        3 RO  QRP L D O      3 RO  QRP L D O      3 RO  QRP L D O
       computeRoots()        computeRoots()        computeRoots()
     isInBetweenRoots()    isInBetweenRoots()    isInBetweenRoots()




60
/+                                )#




boolean isInBetweenRoots(double x) {


       return (Math.abs(x1) <= Math.abs(x)) &&
                                             (Math.abs(x) <=
Math.abs(x2));


}




61
-
                             6HFRQG 2UGHU
                              3 RO  QRP L D O

                             computeRoots()
                           isInBetweenRoots()




        6L QJ O H 5 RRW        7 Z R 5 RRW V          1 R 5 RRW
       6HFRQG 2UGHU          6HFRQG 2UGHU          6HFRQG 2UGHU
        3 RO  QRP L D O      3 RO  QRP L D O      3 RO  QRP L D O
       computeRoots()        computeRoots()        computeRoots()
     isInBetweenRoots()    isInBetweenRoots()    isInBetweenRoots()




62
/+                       )




boolean isInBetweenRoots(double x) {


     return false;
}




63
01
      11




64

More Related Content

What's hot

The Ring programming language version 1.7 book - Part 48 of 196
The Ring programming language version 1.7 book - Part 48 of 196The Ring programming language version 1.7 book - Part 48 of 196
The Ring programming language version 1.7 book - Part 48 of 196Mahmoud Samir Fayed
 
The Ring programming language version 1.4 book - Part 8 of 30
The Ring programming language version 1.4 book - Part 8 of 30The Ring programming language version 1.4 book - Part 8 of 30
The Ring programming language version 1.4 book - Part 8 of 30Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 32 of 189
The Ring programming language version 1.6 book - Part 32 of 189The Ring programming language version 1.6 book - Part 32 of 189
The Ring programming language version 1.6 book - Part 32 of 189Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 44 of 184
The Ring programming language version 1.5.3 book - Part 44 of 184The Ring programming language version 1.5.3 book - Part 44 of 184
The Ring programming language version 1.5.3 book - Part 44 of 184Mahmoud Samir Fayed
 
The Ring programming language version 1.4.1 book - Part 13 of 31
The Ring programming language version 1.4.1 book - Part 13 of 31The Ring programming language version 1.4.1 book - Part 13 of 31
The Ring programming language version 1.4.1 book - Part 13 of 31Mahmoud Samir Fayed
 
The Ring programming language version 1.5 book - Part 8 of 31
The Ring programming language version 1.5 book - Part 8 of 31The Ring programming language version 1.5 book - Part 8 of 31
The Ring programming language version 1.5 book - Part 8 of 31Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 39 of 212
The Ring programming language version 1.10 book - Part 39 of 212The Ring programming language version 1.10 book - Part 39 of 212
The Ring programming language version 1.10 book - Part 39 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 54 of 212
The Ring programming language version 1.10 book - Part 54 of 212The Ring programming language version 1.10 book - Part 54 of 212
The Ring programming language version 1.10 book - Part 54 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 34 of 196
The Ring programming language version 1.7 book - Part 34 of 196The Ring programming language version 1.7 book - Part 34 of 196
The Ring programming language version 1.7 book - Part 34 of 196Mahmoud Samir Fayed
 
FLATMAP ZAT SHIT : les monades expliquées aux geeks (Devoxx France 2013)
FLATMAP ZAT SHIT : les monades expliquées aux geeks (Devoxx France 2013)FLATMAP ZAT SHIT : les monades expliquées aux geeks (Devoxx France 2013)
FLATMAP ZAT SHIT : les monades expliquées aux geeks (Devoxx France 2013)François Sarradin
 
The Ring programming language version 1.5.2 book - Part 29 of 181
The Ring programming language version 1.5.2 book - Part 29 of 181The Ring programming language version 1.5.2 book - Part 29 of 181
The Ring programming language version 1.5.2 book - Part 29 of 181Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 53 of 210
The Ring programming language version 1.9 book - Part 53 of 210The Ring programming language version 1.9 book - Part 53 of 210
The Ring programming language version 1.9 book - Part 53 of 210Mahmoud Samir Fayed
 
Stamps - a better way to object composition
Stamps - a better way to object compositionStamps - a better way to object composition
Stamps - a better way to object compositionVasyl Boroviak
 
The Ring programming language version 1.5.1 book - Part 31 of 180
The Ring programming language version 1.5.1 book - Part 31 of 180The Ring programming language version 1.5.1 book - Part 31 of 180
The Ring programming language version 1.5.1 book - Part 31 of 180Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 47 of 212
The Ring programming language version 1.10 book - Part 47 of 212The Ring programming language version 1.10 book - Part 47 of 212
The Ring programming language version 1.10 book - Part 47 of 212Mahmoud Samir Fayed
 
2020 Droid Knights CustomLint 적용기
2020 Droid Knights CustomLint 적용기2020 Droid Knights CustomLint 적용기
2020 Droid Knights CustomLint 적용기Insung Hwang
 
The Ring programming language version 1.3 book - Part 21 of 88
The Ring programming language version 1.3 book - Part 21 of 88The Ring programming language version 1.3 book - Part 21 of 88
The Ring programming language version 1.3 book - Part 21 of 88Mahmoud Samir Fayed
 
Exploring ZIO Prelude: The game changer for typeclasses in Scala
Exploring ZIO Prelude: The game changer for typeclasses in ScalaExploring ZIO Prelude: The game changer for typeclasses in Scala
Exploring ZIO Prelude: The game changer for typeclasses in ScalaJorge Vásquez
 

What's hot (20)

The Ring programming language version 1.7 book - Part 48 of 196
The Ring programming language version 1.7 book - Part 48 of 196The Ring programming language version 1.7 book - Part 48 of 196
The Ring programming language version 1.7 book - Part 48 of 196
 
The Ring programming language version 1.4 book - Part 8 of 30
The Ring programming language version 1.4 book - Part 8 of 30The Ring programming language version 1.4 book - Part 8 of 30
The Ring programming language version 1.4 book - Part 8 of 30
 
The Ring programming language version 1.6 book - Part 32 of 189
The Ring programming language version 1.6 book - Part 32 of 189The Ring programming language version 1.6 book - Part 32 of 189
The Ring programming language version 1.6 book - Part 32 of 189
 
The Ring programming language version 1.5.3 book - Part 44 of 184
The Ring programming language version 1.5.3 book - Part 44 of 184The Ring programming language version 1.5.3 book - Part 44 of 184
The Ring programming language version 1.5.3 book - Part 44 of 184
 
The Ring programming language version 1.4.1 book - Part 13 of 31
The Ring programming language version 1.4.1 book - Part 13 of 31The Ring programming language version 1.4.1 book - Part 13 of 31
The Ring programming language version 1.4.1 book - Part 13 of 31
 
The Ring programming language version 1.5 book - Part 8 of 31
The Ring programming language version 1.5 book - Part 8 of 31The Ring programming language version 1.5 book - Part 8 of 31
The Ring programming language version 1.5 book - Part 8 of 31
 
The Ring programming language version 1.10 book - Part 39 of 212
The Ring programming language version 1.10 book - Part 39 of 212The Ring programming language version 1.10 book - Part 39 of 212
The Ring programming language version 1.10 book - Part 39 of 212
 
The Ring programming language version 1.10 book - Part 54 of 212
The Ring programming language version 1.10 book - Part 54 of 212The Ring programming language version 1.10 book - Part 54 of 212
The Ring programming language version 1.10 book - Part 54 of 212
 
The Ring programming language version 1.7 book - Part 34 of 196
The Ring programming language version 1.7 book - Part 34 of 196The Ring programming language version 1.7 book - Part 34 of 196
The Ring programming language version 1.7 book - Part 34 of 196
 
FLATMAP ZAT SHIT : les monades expliquées aux geeks (Devoxx France 2013)
FLATMAP ZAT SHIT : les monades expliquées aux geeks (Devoxx France 2013)FLATMAP ZAT SHIT : les monades expliquées aux geeks (Devoxx France 2013)
FLATMAP ZAT SHIT : les monades expliquées aux geeks (Devoxx France 2013)
 
The Ring programming language version 1.5.2 book - Part 29 of 181
The Ring programming language version 1.5.2 book - Part 29 of 181The Ring programming language version 1.5.2 book - Part 29 of 181
The Ring programming language version 1.5.2 book - Part 29 of 181
 
Property-based testing
Property-based testingProperty-based testing
Property-based testing
 
The Ring programming language version 1.9 book - Part 53 of 210
The Ring programming language version 1.9 book - Part 53 of 210The Ring programming language version 1.9 book - Part 53 of 210
The Ring programming language version 1.9 book - Part 53 of 210
 
Stamps - a better way to object composition
Stamps - a better way to object compositionStamps - a better way to object composition
Stamps - a better way to object composition
 
The Ring programming language version 1.5.1 book - Part 31 of 180
The Ring programming language version 1.5.1 book - Part 31 of 180The Ring programming language version 1.5.1 book - Part 31 of 180
The Ring programming language version 1.5.1 book - Part 31 of 180
 
The Ring programming language version 1.10 book - Part 47 of 212
The Ring programming language version 1.10 book - Part 47 of 212The Ring programming language version 1.10 book - Part 47 of 212
The Ring programming language version 1.10 book - Part 47 of 212
 
2020 Droid Knights CustomLint 적용기
2020 Droid Knights CustomLint 적용기2020 Droid Knights CustomLint 적용기
2020 Droid Knights CustomLint 적용기
 
Scala best practices
Scala best practicesScala best practices
Scala best practices
 
The Ring programming language version 1.3 book - Part 21 of 88
The Ring programming language version 1.3 book - Part 21 of 88The Ring programming language version 1.3 book - Part 21 of 88
The Ring programming language version 1.3 book - Part 21 of 88
 
Exploring ZIO Prelude: The game changer for typeclasses in Scala
Exploring ZIO Prelude: The game changer for typeclasses in ScalaExploring ZIO Prelude: The game changer for typeclasses in Scala
Exploring ZIO Prelude: The game changer for typeclasses in Scala
 

Viewers also liked

Annonce Formateur Grc.F S 0607
Annonce Formateur Grc.F S 0607Annonce Formateur Grc.F S 0607
Annonce Formateur Grc.F S 0607guest7a18c3
 
Weekly 2
Weekly 2Weekly 2
Weekly 2thee
 
Laura Sandino
Laura SandinoLaura Sandino
Laura SandinoNetsky
 
Biblioterapija PrezentāCija
Biblioterapija PrezentāCijaBiblioterapija PrezentāCija
Biblioterapija PrezentāCijaguest60b892
 
EL CANASTO - CECY.
EL CANASTO - CECY.EL CANASTO - CECY.
EL CANASTO - CECY.cecymariposa
 
Palestra GestãO Call Center Aulavox
Palestra GestãO Call Center AulavoxPalestra GestãO Call Center Aulavox
Palestra GestãO Call Center AulavoxConsultcom
 

Viewers also liked (10)

Ng
NgNg
Ng
 
Asfalistiko
AsfalistikoAsfalistiko
Asfalistiko
 
7miracles
7miracles7miracles
7miracles
 
Annonce Formateur Grc.F S 0607
Annonce Formateur Grc.F S 0607Annonce Formateur Grc.F S 0607
Annonce Formateur Grc.F S 0607
 
Weekly 2
Weekly 2Weekly 2
Weekly 2
 
Laura Sandino
Laura SandinoLaura Sandino
Laura Sandino
 
Biblioterapija PrezentāCija
Biblioterapija PrezentāCijaBiblioterapija PrezentāCija
Biblioterapija PrezentāCija
 
Bonito Ms Brasil
Bonito Ms BrasilBonito Ms Brasil
Bonito Ms Brasil
 
EL CANASTO - CECY.
EL CANASTO - CECY.EL CANASTO - CECY.
EL CANASTO - CECY.
 
Palestra GestãO Call Center Aulavox
Palestra GestãO Call Center AulavoxPalestra GestãO Call Center Aulavox
Palestra GestãO Call Center Aulavox
 

Similar to Solving Quadratic Equations

public class TrequeT extends AbstractListT { .pdf
  public class TrequeT extends AbstractListT {  .pdf  public class TrequeT extends AbstractListT {  .pdf
public class TrequeT extends AbstractListT { .pdfinfo30292
 
Python-3-compiled-Cheat-Sheet-version-3.pdf
Python-3-compiled-Cheat-Sheet-version-3.pdfPython-3-compiled-Cheat-Sheet-version-3.pdf
Python-3-compiled-Cheat-Sheet-version-3.pdfletsdism
 
「Frama-Cによるソースコード検証」 (mzp)
「Frama-Cによるソースコード検証」 (mzp)「Frama-Cによるソースコード検証」 (mzp)
「Frama-Cによるソースコード検証」 (mzp)Hiroki Mizuno
 
Ch01 basic concepts_nosoluiton
Ch01 basic concepts_nosoluitonCh01 basic concepts_nosoluiton
Ch01 basic concepts_nosoluitonshin
 
On Beyond (PostgreSQL) Data Types
On Beyond (PostgreSQL) Data TypesOn Beyond (PostgreSQL) Data Types
On Beyond (PostgreSQL) Data TypesJonathan Katz
 
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)MongoSF
 
Brief intro to clojure
Brief intro to clojureBrief intro to clojure
Brief intro to clojureRoy Rutto
 
Java Simple Programs
Java Simple ProgramsJava Simple Programs
Java Simple ProgramsUpender Upr
 
Compose Async with RxJS
Compose Async with RxJSCompose Async with RxJS
Compose Async with RxJSKyung Yeol Kim
 

Similar to Solving Quadratic Equations (13)

Java Week1(A) Notepad
Java Week1(A)   NotepadJava Week1(A)   Notepad
Java Week1(A) Notepad
 
public class TrequeT extends AbstractListT { .pdf
  public class TrequeT extends AbstractListT {  .pdf  public class TrequeT extends AbstractListT {  .pdf
public class TrequeT extends AbstractListT { .pdf
 
Python-3-compiled-Cheat-Sheet-version-3.pdf
Python-3-compiled-Cheat-Sheet-version-3.pdfPython-3-compiled-Cheat-Sheet-version-3.pdf
Python-3-compiled-Cheat-Sheet-version-3.pdf
 
「Frama-Cによるソースコード検証」 (mzp)
「Frama-Cによるソースコード検証」 (mzp)「Frama-Cによるソースコード検証」 (mzp)
「Frama-Cによるソースコード検証」 (mzp)
 
Integral table
Integral tableIntegral table
Integral table
 
Cpl
CplCpl
Cpl
 
Ch01 basic concepts_nosoluiton
Ch01 basic concepts_nosoluitonCh01 basic concepts_nosoluiton
Ch01 basic concepts_nosoluiton
 
On Beyond (PostgreSQL) Data Types
On Beyond (PostgreSQL) Data TypesOn Beyond (PostgreSQL) Data Types
On Beyond (PostgreSQL) Data Types
 
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
 
Brief intro to clojure
Brief intro to clojureBrief intro to clojure
Brief intro to clojure
 
Java Simple Programs
Java Simple ProgramsJava Simple Programs
Java Simple Programs
 
Compose Async with RxJS
Compose Async with RxJSCompose Async with RxJS
Compose Async with RxJS
 
C++11
C++11C++11
C++11
 

More from Emmanuel Fuchs

Distributed Object Systems
Distributed Object SystemsDistributed Object Systems
Distributed Object SystemsEmmanuel Fuchs
 
CARDAMOM_CCM_Tutorial_Draft 2004
CARDAMOM_CCM_Tutorial_Draft 2004CARDAMOM_CCM_Tutorial_Draft 2004
CARDAMOM_CCM_Tutorial_Draft 2004Emmanuel Fuchs
 
Anootations IEEE 42010 : A Conceptual Model of Architecture Description
Anootations IEEE 42010 : A Conceptual Model of Architecture DescriptionAnootations IEEE 42010 : A Conceptual Model of Architecture Description
Anootations IEEE 42010 : A Conceptual Model of Architecture DescriptionEmmanuel Fuchs
 
PLUG : Presentation Layer Universal Generator
 PLUG : Presentation Layer Universal Generator PLUG : Presentation Layer Universal Generator
PLUG : Presentation Layer Universal GeneratorEmmanuel Fuchs
 
PLUG : Presentation Layer Universal Generator
PLUG : Presentation Layer Universal GeneratorPLUG : Presentation Layer Universal Generator
PLUG : Presentation Layer Universal GeneratorEmmanuel Fuchs
 
PLUG : Presentation Layer Universal Generator
 PLUG : Presentation Layer Universal Generator PLUG : Presentation Layer Universal Generator
PLUG : Presentation Layer Universal GeneratorEmmanuel Fuchs
 
PLUG : Presentation Layer Universal Generator
PLUG : Presentation Layer Universal GeneratorPLUG : Presentation Layer Universal Generator
PLUG : Presentation Layer Universal GeneratorEmmanuel Fuchs
 
UBSS : Unix Based System Software
UBSS : Unix Based System SoftwareUBSS : Unix Based System Software
UBSS : Unix Based System SoftwareEmmanuel Fuchs
 
Object-Oriented Real-Time Distributed Computing, 1999. (ISORC '99)
Object-Oriented Real-Time Distributed Computing, 1999. (ISORC '99)Object-Oriented Real-Time Distributed Computing, 1999. (ISORC '99)
Object-Oriented Real-Time Distributed Computing, 1999. (ISORC '99)Emmanuel Fuchs
 
Distributed Object Computing
Distributed Object ComputingDistributed Object Computing
Distributed Object ComputingEmmanuel Fuchs
 
Executive Summary ITEA Roadmap 2
Executive Summary ITEA Roadmap 2Executive Summary ITEA Roadmap 2
Executive Summary ITEA Roadmap 2Emmanuel Fuchs
 

More from Emmanuel Fuchs (20)

Distributed Object Systems
Distributed Object SystemsDistributed Object Systems
Distributed Object Systems
 
CARDAMOM_CCM_Tutorial_Draft 2004
CARDAMOM_CCM_Tutorial_Draft 2004CARDAMOM_CCM_Tutorial_Draft 2004
CARDAMOM_CCM_Tutorial_Draft 2004
 
Anootations IEEE 42010 : A Conceptual Model of Architecture Description
Anootations IEEE 42010 : A Conceptual Model of Architecture DescriptionAnootations IEEE 42010 : A Conceptual Model of Architecture Description
Anootations IEEE 42010 : A Conceptual Model of Architecture Description
 
Book Recommendations
 Book Recommendations Book Recommendations
Book Recommendations
 
PLUG : Presentation Layer Universal Generator
 PLUG : Presentation Layer Universal Generator PLUG : Presentation Layer Universal Generator
PLUG : Presentation Layer Universal Generator
 
PLUG : Presentation Layer Universal Generator
PLUG : Presentation Layer Universal GeneratorPLUG : Presentation Layer Universal Generator
PLUG : Presentation Layer Universal Generator
 
PLUG : Presentation Layer Universal Generator
 PLUG : Presentation Layer Universal Generator PLUG : Presentation Layer Universal Generator
PLUG : Presentation Layer Universal Generator
 
PLUG : Presentation Layer Universal Generator
PLUG : Presentation Layer Universal GeneratorPLUG : Presentation Layer Universal Generator
PLUG : Presentation Layer Universal Generator
 
UBSS2
UBSS2UBSS2
UBSS2
 
UBSS : Unix Based System Software
UBSS : Unix Based System SoftwareUBSS : Unix Based System Software
UBSS : Unix Based System Software
 
ISORC 1999 Panel III
ISORC 1999 Panel IIIISORC 1999 Panel III
ISORC 1999 Panel III
 
ISORC’99
ISORC’99ISORC’99
ISORC’99
 
Object-Oriented Real-Time Distributed Computing, 1999. (ISORC '99)
Object-Oriented Real-Time Distributed Computing, 1999. (ISORC '99)Object-Oriented Real-Time Distributed Computing, 1999. (ISORC '99)
Object-Oriented Real-Time Distributed Computing, 1999. (ISORC '99)
 
Distributed Object Computing
Distributed Object ComputingDistributed Object Computing
Distributed Object Computing
 
Hash map
Hash mapHash map
Hash map
 
ATM system history
ATM system historyATM system history
ATM system history
 
Middleware
MiddlewareMiddleware
Middleware
 
photoISEN 1987
photoISEN 1987photoISEN 1987
photoISEN 1987
 
EUROCAT
EUROCATEUROCAT
EUROCAT
 
Executive Summary ITEA Roadmap 2
Executive Summary ITEA Roadmap 2Executive Summary ITEA Roadmap 2
Executive Summary ITEA Roadmap 2
 

Recently uploaded

mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 

Recently uploaded (20)

mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 

Solving Quadratic Equations

  • 1. ! quot;# ( $ %' &
  • 2. 1 3
  • 3. ax + bx + c = 0 2 4
  • 4. ) − b ± b − 4ac 2 x= 2a 5
  • 5. ) ∆ = b − 4ac 2 6
  • 6. )quot; * y X1 X2 x 7
  • 7. & * ) quot;( Initial Request 1 Day After 1 Week After 8
  • 8. & * ) quot;( Initial Request Evolution Request 1 Day After Few Weeks Later 1 Day 1 Week After After 9
  • 10. )quot; & j X1 X2 x 11
  • 11. & * ) quot;( Initial Request 1 Day After 1 Week After 12
  • 12. & * ) quot;( Initial Request Evolution Request 1 Day Few Weeks Later After 1 Day 1 Week After After 13
  • 13. 1 14
  • 14. )& +* , y X1 X2 x X X X 15
  • 15. & * ) quot;( Initial Request 1 Day After 1 Week After 16
  • 16. & * ) quot;( Initial Request Evolution Request 1 Day After Few Weeks Later ? 1 Day 1 Week After After 17
  • 17. 1 18
  • 18. Start Input coefficients a,b,c Computes discriminant Delta = b * b – 4 * a * c <0 >0 Discriminant Sign =0 Computes roots Computes single root print roots print root print no roots End 19
  • 19. 1 20
  • 20. delta = (b*b) - (4*a*c); // discrimant computation if (delta < 0.0) { System.out.println (quot; No rootsquot;); } else if (delta > 0.0) { System.out.println (quot; Two roots :quot;); System.out.println (quot; x1 = quot; + (-b + Math.sqrt(delta))/ (2.0 * a)); System.out.println (quot; x2 = quot; + (-b - Math.sqrt(delta))/ (2.0 * a)); } else { System.out.println (“ Single root: quot;); System.out.println (quot; x = quot; + (-b / (2.0 * a))); } 21
  • 21. 1 22
  • 22. Start Input coefficients a,b,c Computes discriminant Delta = b * b – 4 * a * c <0 >0 Discriminant Sign =0 Computes roots Computes single root print roots print root print no roots End 23
  • 23. & ( Start Input coefficients a,b,c Computes discriminant Delta = b * b – 4 * a * c <0 >0 Discriminant Sign =0 Computes Complex roots Computes roots Computes double root print roots print root print roots End 24
  • 24. delta = (b*b) - (4*a*c); // discrimant computation if (delta < 0.0) { System.out.println (quot; No rootsquot;); } else if (delta > 0.0) { System.out.println (quot; Two roots :quot;); System.out.println (quot; x1 = quot; + (-b + Math.sqrt(delta))/ (2.0 * a)); System.out.println (quot; x2 = quot; + (-b - Math.sqrt(delta))/ (2.0 * a)); } else { System.out.println (“ Single root: quot;); System.out.println (quot; x = quot; + (-b / (2.0 * a))); } 25
  • 25. quot; quot; delta = (b*b) - (4*a*c); // discrimant computation if (delta < 0.0) { System.out.println (quot; No rootsquot;); } else if (delta > 0.0) { System.out.println (quot; Two roots :quot;); System.out.println (quot; x1 = quot; + (-b + Math.sqrt(delta))/ (2.0 * a)); System.out.println (quot; x2 = quot; + (-b - Math.sqrt(delta))/ (2.0 * a)); System.out.println (quot; Complex rootsquot;); System.out.println (quot; x1 real part = quot; + (-b / (2.0*a))); System.out.println (quot; x2 imaginary part = quot; + (-b - Math.sqrt(-delta))/ (2.0*a)+ quot;iquot;); System.out.println (quot; x2 real part = quot; + (-b / (2.0*a))); System.out.println (quot; x2 imaginary part= quot; + (-b - Math.sqrt(-delta))/ (2.0*a)+ quot;iquot;); } else { System.out.println (“ Single root: quot;); System.out.println (quot; x = quot; + (-b / (2.0 * a))); } 26
  • 26. 1 27
  • 27. , )& +* , y X1 X2 x X X X 28
  • 28. & +* ,) Discriminat Sign <0 >0 =0 Computes root case 1 Computes roots case 2 2 T F T F ( /X1/ <= X & X <= X == X1 /X2/ ) Return True Return False Return True Return False Return False End 29
  • 29. & * ) quot;( Initial Request 1 Day After 1 Week After 30
  • 30. & * ) quot;( Initial Request Evolution Request 1 Day After Few Weeks Later ? 1 Day 1 Week After After 31
  • 31. & static boolean isInBetweenRoots(double x,double a,double b, double c) { double delta, x1, x2; delta = (b*b) - (4*a*c); if (delta < 0.0) return false; else if (delta > 0.0) { System.out.print(quot;delta > 0quot;); x1 = (-b + Math.sqrt(delta))/ (2.0*a); x2 = (-b - Math.sqrt(delta))/ (2.0*a); return (Math.abs(x1) <= Math.abs(x)) && (Math.abs(x) <= Math.abs(x2)); } else { x1 = -b / (2.0 * a); return (x == x1); } } 32
  • 32. 1 33
  • 33. - ) - 6HFRQG 2UGHU 3 RO QRP L D O 6L QJ O H 5 RRW 7 Z R 5 RRW V 1 R 5 RRW 6HFRQG 2UGHU 6HFRQG 2UGHU 6HFRQG 2UGHU 3 RO QRP L D O 3 RO QRP L D O 3 RO QRP L D O 34
  • 34. - ) - 6HFRQG 2UGHU 3 RO QRP L D O ' L V FUL P L QD QW 6L QJ O H 5 RRW 7 Z R 5 RRW V 1 R 5 RRW 6HFRQG 2UGHU 6HFRQG 2UGHU 6HFRQG 2UGHU 3 RO QRP L D O 3 RO QRP L D O 3 RO QRP L D O 35
  • 35. - # 6HFRQG 2UGHU 3 RO QRP L D O ' L V FUL P L QD QW Double a Double b Double c computeRoots() 6L QJ O H 5 RRW 7 Z R 5 RRW V 1 R 5 RRW 6HFRQG 2UGHU 6HFRQG 2UGHU 6HFRQG 2UGHU 3 RO QRP L D O 3 RO QRP L D O 3 RO QRP L D O computeRoots() computeRoots() computeRoots() 36
  • 36. - & # 6HFRQG 2UGHU 3 RO QRP L D O computeRoots() create() 6L QJ O H 5 RRW 7 Z R 5 RRW V 1 R 5 RRW 6HFRQG 2UGHU 6HFRQG 2UGHU 6HFRQG 2UGHU 3 RO QRP L D O 3 RO QRP L D O 3 RO QRP L D O computeRoots() computeRoots() computeRoots() 37
  • 37. 1 38
  • 38. - ' L V FUL P L QD QW 6HFRQG 2UGHU 3 RO QRP L D O 39
  • 39. - ) 6HFRQG 2UGHU 3 RO QRP L D O 6HFRQG 2UGHU 3 RO QRP L D O ) D FW RU ' L V FUL P L QD QW 40
  • 40. - ) 6HFRQG 2UGHU 3 RO QRP L D O 6HFRQG 2UGHU 3 RO QRP L D O ) D FW RU ' L V FUL P L QD QW 41
  • 41. - # 6HFRQG 2UGHU 3 RO QRP L D O ' L V FUL P L QD QW Double a Double b Double c computeRoots() 6L QJ O H 5 RRW 7 Z R 5 RRW V 1 R 5 RRW 6HFRQG 2UGHU 6HFRQG 2UGHU 6HFRQG 2UGHU 3 RO QRP L D O 3 RO QRP L D O 3 RO QRP L D O computeRoots() computeRoots() computeRoots() 42
  • 42. class Discriminant { private double delta; public Discriminant (double a, double b, double c) { delta = (b * b) - (4.0 * a * c); } public double value () { return delta; } } 43
  • 43. ) * static Polynome create( double a, double b, double c) { Discriminant theDiscriminant = new Discriminant(a,b,c); double delta = theDiscriminant.value(); Polynome polynome; if (delta == 0.0) { return polynome = new SingleRootPolynome(a,b,c,theDiscriminant) ; } else if (delta > 0.0) { return polynome = new TwoRootsPolynome(a,b,c,theDiscriminant) ; } else { return polynome = new NoRootPolynome(a,b,c,theDiscriminant); } } 44
  • 44. * & static Polynome create( double a, double b, double c) { Discriminant theDiscriminant = new Discriminant(a,b,c); double delta = theDiscriminant.value(); Polynome polynome; if (delta == 0.0) { return polynome = new SingleRootPolynome(a,b,c,theDiscriminant) ; } else if (delta > 0.0) { return polynome = new TwoRootsPolynome(a,b,c,theDiscriminant) ; } else { return polynome = new ComplexRootsPolynome(a,b,c,theDiscriminant); } } 45
  • 45. 1 46
  • 46. - # 6HFRQG 2UGHU 3 RO QRP L D O ' L V FUL P L QD QW Double a Double b Double c computeRoots() 6L QJ O H 5 RRW 7 Z R 5 RRW V 1 R 5 RRW 6HFRQG 2UGHU 6HFRQG 2UGHU 6HFRQG 2UGHU 3 RO QRP L D O 3 RO QRP L D O 3 RO QRP L D O computeRoots() computeRoots() computeRoots() 47
  • 47. & ) * void computesRoots() { System.out.println (quot; Single root: quot;); System.out.println (quot; x = quot; + (-b / (2.0*a))); } 48
  • 48. - # 6HFRQG 2UGHU 3 RO QRP L D O ' L V FUL P L QD QW Double a Double b Double c computeRoots() 6L QJ O H 5 RRW 7 Z R 5 RRW V 1 R 5 RRW 6HFRQG 2UGHU 6HFRQG 2UGHU 6HFRQG 2UGHU 3 RO QRP L D O 3 RO QRP L D O 3 RO QRP L D O computeRoots() computeRoots() computeRoots() 49
  • 49. & ) #* void computesRoots() { System.out.println (quot; Two roots :quot;); System.out.println (quot; x1 = quot; + (-b + Math.sqrt(discriminant.value()))/ (2.0*a)); System.out.println (quot; x2 = quot; + (-b - Math.sqrt(discriminant.value()))/ (2.0*a)); } 50
  • 50. - # 6HFRQG 2UGHU 3 RO QRP L D O ' L V FUL P L QD QW Double a Double b Double c computeRoots() 6L QJ O H 5 RRW 7 Z R 5 RRW V 1 R 5 RRW 6HFRQG 2UGHU 6HFRQG 2UGHU 6HFRQG 2UGHU 3 RO QRP L D O 3 RO QRP L D O 3 RO QRP L D O computeRoots() computeRoots() computeRoots() 51
  • 51. & ). * void computesRoots() { System.out.println (quot; No rootsquot;); } 52
  • 52. 1 53
  • 53. - # 6HFRQG 2UGHU 3 RO QRP L D O ' L V FUL P L QD QW Double a Double b Double c computeRoots() 6L QJ O H 5 RRW 7 Z R 5 RRW V 1 R 5 RRW 6HFRQG 2UGHU 6HFRQG 2UGHU 6HFRQG 2UGHU 3 RO QRP L D O 3 RO QRP L D O 3 RO QRP L D O computeRoots() computeRoots() computeRoots() 54
  • 54. - # 6HFRQG 2UGHU 3 RO QRP L D O ' L V FUL P L QD QW Double a Double b Double c computeRoots() 6L QJ O H 5 RRW 7 Z R 5 RRW V & RP S O H[ 5 RRW V 6HFRQG 2UGHU 6HFRQG 2UGHU 6HFRQG 2UGHU 3 RO QRP L D O 3 RO QRP L D O 3 RO QRP L D O computeRoots() computeRoots() computeRoots() 55
  • 55. & )& (* void computesRoots() { System.out.println (quot; Complex rootsquot;); System.out.println (quot; x1 real part = quot; + (-b / (2.0*a))); System.out.println (quot; x1 imaginary part = “ + (-b + Math.sqrt(-discriminant.value()))/ (2.0*a)+ quot;iquot;); System.out.println (quot; x2 real part = quot; + (-b / (2.0*a))); System.out.println (quot; x2 imaginary part = “ + (-b - Math.sqrt(-discriminant.value()))/ (2.0*a)+ quot;iquot;); } 56
  • 56. 1 57
  • 57. - 6HFRQG 2UGHU 3 RO QRP L D O computeRoots() isInBetweenRoots() 6L QJ O H 5 RRW 7 Z R 5 RRW V 1 R 5 RRW 6HFRQG 2UGHU 6HFRQG 2UGHU 6HFRQG 2UGHU 3 RO QRP L D O 3 RO QRP L D O 3 RO QRP L D O computeRoots() computeRoots() computeRoots() isInBetweenRoots() isInBetweenRoots() isInBetweenRoots() 58
  • 58. /+ ) boolean isInBetweenRoots(double x) { return (x == x1); } 59
  • 59. - 6HFRQG 2UGHU 3 RO QRP L D O computeRoots() isInBetweenRoots() 6L QJ O H 5 RRW 7 Z R 5 RRW V 1 R 5 RRW 6HFRQG 2UGHU 6HFRQG 2UGHU 6HFRQG 2UGHU 3 RO QRP L D O 3 RO QRP L D O 3 RO QRP L D O computeRoots() computeRoots() computeRoots() isInBetweenRoots() isInBetweenRoots() isInBetweenRoots() 60
  • 60. /+ )# boolean isInBetweenRoots(double x) { return (Math.abs(x1) <= Math.abs(x)) && (Math.abs(x) <= Math.abs(x2)); } 61
  • 61. - 6HFRQG 2UGHU 3 RO QRP L D O computeRoots() isInBetweenRoots() 6L QJ O H 5 RRW 7 Z R 5 RRW V 1 R 5 RRW 6HFRQG 2UGHU 6HFRQG 2UGHU 6HFRQG 2UGHU 3 RO QRP L D O 3 RO QRP L D O 3 RO QRP L D O computeRoots() computeRoots() computeRoots() isInBetweenRoots() isInBetweenRoots() isInBetweenRoots() 62
  • 62. /+ ) boolean isInBetweenRoots(double x) { return false; } 63
  • 63. 01 11 64