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 Polynomial

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 Polynomial (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

Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxAmita Gupta
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 

Recently uploaded (20)

Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 

Polynomial

  • 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