Using class Math
Math is yet another
class belonging to the core set of the Java™
programing language. We take a tour on selected methods:
| Code | Result | Math notation |
|---|---|---|
|
0.8939966636005579 == sin(90.0) |
|
No. 134
Common pitfall using trigonometric functions
|
Q: |
We reconsider Figure 427, “ |
|
A: |
The mathematically inclined reader may have expected a
result of This is a common misconception: At school you were probably using so called “degrees” ranging from 0° to 360° for describing angle values. In Mathematics however trigonometric functions are being defined as power series e.g.: As an immediate consequence describing a full circle of angle values the variable x here is ranging from 0 to rather than from 0° to 360°. This angle unit is called radians. If you still want to use degrees you will have to convert these to radians beforehand by multiplying with or simply : |
