Math Operators in PERL

Document Sample
Math Operators in PERL Powered By Docstoc
					Math Operators in PERL
       Math Operators in PERL:
             Addition +
Code


                                 Output
       Math Operators in PERL:
           Subtraction -
Code


                                 Output
       Math Operators in PERL:
          Multiplication *
Code


                                 Output
       Math Operators in PERL:
             Division /
Code


                                 Output
      Math Operators in PERL:
Modulus % (remainder after division)
  Code


                              Output
       Math Operators in PERL:
         Exponentiation **
Code


                                 Output
       Math Operators in PERL:
        Square Root sqrt(x)
Code




                          Output
       Math Operators in PERL:
        Square Root sqrt(x)
Code


                                 Output
       Math Operators in PERL:
       Square Root: another way
Code


                                  Output
       Math Operators in PERL:
        Natural Log (ln) log(x)
Code


                                  Output
       Math Operators in PERL:
  Logarithms using bases other than e
• The only built in function for log’s in Perl is for
  natural log’s (base e) often written as ln
• Many other applications prefer to use base 10
• Microarray data are often in base 2
• Conversion:
       log(x) base y = ln(x) / ln(y)
       Math Operators in PERL:
            Log base 10
Code


                             Output
       Math Operators in PERL:
         Scientific Notation
Code




                             Output
         Math Operators in PERL:
           Complex Equations
• PERL recognizes the use of parentheses for
  complex equations

• For example: the quadratic equation to solve
      ax2 + bx + c = 0
       Math Operators in PERL:
         Complex Equations
Code


                             Output