Mathematical Functions in Java जावा में गणितीय क्रियाएं

In Java, mathematical functions are provided by the Math class which belongs to the java.lang package. This class includes many useful methods like min(), max(), pow(), sqrt(), abs(), sin(), cos(), and tan(), which make complex mathematical operations easier. As Math is part of the java.lang package, there is no need to import it explicitly. These methods can be directly accessed in any Java program for performing arithmetic, trigonometric, logarithmic, and rounding calculations.

जावा में गणितीय क्रियाएं करने के लिए Math क्लास प्रदान की गई है, जो java.lang पैकेज का हिस्सा है। इस क्लास में min(), max(), pow(), sqrt(), abs(), sin(), cos(), और tan() जैसे कई महत्वपूर्ण मेथड्स होते हैं, जो जटिल गणितीय संचालन को आसान बनाते हैं। चूंकि यह java.lang पैकेज में आता है, इसलिए इसे विशेष रूप से इम्पोर्ट करने की आवश्यकता नहीं होती। इन मेथड्स का प्रयोग अंकगणित, त्रिकोणमिति, लॉगरिदमिक और राउंडिंग कार्यों को करने में किया जाता है।


📊 Common Math Methods in Java — सामान्य मैथ मेथड्स

 S.No. Method Purpose (English) उद्देश्य (हिंदी)
1 pow(x, y) Returns x raised to the power y x की घात y निकालता है
2 abs(x) Returns the absolute value (positive) of x x का परिमाण (positive मान) देता है
3 min(a, b) Returns the smaller of two values दो मानों में से छोटा मान देता है
4 max(a, b) Returns the greater of two values दो मानों में से बड़ा मान देता है
5 round(x) Rounds the number to the nearest integer संख्या को निकटतम पूर्णांक में बदलता है
6 sqrt(x) Returns the square root of x x का वर्गमूल देता है
7 log(x) Returns the natural logarithm (base e) of x x का लॉगरिदम (प्राकृतिक) निकालता है
8 sin(x) Returns sine value of angle x (in radians) कोण x (रेडियन) का sine मान देता है
9 cos(x) Returns cosine value of angle x कोण x का cosine मान देता है
10 tan(x) Returns tangent value of angle x कोण x का tangent मान देता है
11 sinh(x) Returns hyperbolic sine of x x का हाइपरबोलिक sine मान देता है
12 cosh(x) Returns hyperbolic cosine of x x का हाइपरबोलिक cosine मान देता है
13 tanh(x) Returns hyperbolic tangent of x x का हाइपरबोलिक tangent मान देता है
14 toDegrees(x) Converts angle in radians to degrees रेडियन को डिग्री में बदलता है
15 toRadians(x) Converts angle in degrees to radians डिग्री को रेडियन में बदलता है

💡 Java Program Example

import java.lang.Math;

public class Test {
  public static void main(String[] args) {
    double x = 10, y = 5;

    System.out.println("Power of x and y is: " + Math.pow(x, y));
    System.out.println("Square root of y is: " + Math.sqrt(y));
    System.out.println("Maximum of x and y is: " + Math.max(x, y));
    System.out.println("Logarithm of x is: " + Math.log(x));
  }
}

Program Output (संभावित आउटपुट):

Power of x and y is: 100000.0  
Square root of y is: 2.23606797749979  
Maximum of x and y is: 10.0  
Logarithm of x is: 2.302585092994046  

Comments

Popular posts from this blog

What is a Web Browser? वेब ब्राउज़र क्या है?

Java's Support System जावा का सहयोगी तंत्र

The Internet and Java इंटरनेट और जावा का सम्बन्ध