Class Math


  • public class Math
    extends java.lang.Object

    This class implements a subset of functions from class Math using power series expansions.

    • Constructor Summary

      Constructors 
      Constructor Description
      Math()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static double exp​(double x)
      Approximating the natural exponential function by a finite number of terms using power series expansion.
      static void setSeriesLimit​(int seriesLimit)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Math

        public Math()
    • Method Detail

      • setSeriesLimit

        public static void setSeriesLimit​(int seriesLimit)
        Parameters:
        seriesLimit - The last term's index of a power series to be included.
      • exp

        public static double exp​(double x)

        Approximating the natural exponential function by a finite number of terms using power series expansion.

        \[ \begin{aligned} e^x ={} & 1 + {x\over 1!} + {x^2\over 2!} + {x^3\over 3!} + \dots \\ ={} & \sum_{i = 0}^\infty {x^i\over i!} \end{aligned} \] A power series implementation has to be finite since an infinite number of terms requires infinite execution time. The number of terms to be considered can be set by setSeriesLimit(int)}
        Parameters:
        x - The exponential's argument as in \( e^x \)
        Returns:
        The value \( e^x \) itself.