Chapter 17. User -Defined Math FunctionsIn the previous chapter, we covered the built-in math capability of Java. The intrinsic math capability of Java is similar to that provided by C and C++. Among the methods Java defines are those that compute trigonometric, natural logarithm, power, square root, and exponential functions. There are some holes in the intrinsic Java math functionality ”there are no hyperbolic trigonometric functions for instance, and there is nothing exotic such as methods to compute gamma or Bessel functions. One of the great strengths of Java is that it is easily expandable. If the Java libraries don't provide certain functionality, it is a relatively simple matter to add that yourself. In this chapter, we will show you how to create user- defined math methods and how to package the methods so they are freely accessible anywhere on your computer. The basic process can be applied to any mathematical function. The examples in this chapter include creating logarithmic and hyperbolic trigonometric functions, but we will also write a method to compute a higher transcendental function, the gamma function. The specific topics covered in this chapter are ”
|