Posted By Naveen Singh on 02 May 2023
python-program
math module एक प्रकार का built-in module होता है इसमें standard library होती है जो हमें standard mathematical constant और functions provide करता है| math module में कुछ
सबसे important mathematical function को परिभाषित किया गया है। इनमें trigonometric function, representation functions, logarithmic functions, angle conversion
functions आदि शामिल हैं। इसके अलावा, इस module में दो mathematical constant भी परिभाषित किए गए हैं।
pi एक well-known mathematical constant है, जिसे एक वृत्त(circle) के व्यास(diameter) की परिधि(circumference) के अनुपात(ratio) के रूप में परिभाषित किया जाता है और इसका मान 3.141592653589793 है।
Example-:
import math
math.pi
Output-:
3.141592653589793
Math module में परिभाषित एक अन्य प्रसिद्ध mathematical constant "e" है। इसे Euler number कहा जाता है और यह प्राकृतिक logarithm का base है। इसका मान 2.718281828459045 है।
Example-:
import math
math.e
Output-:
2.718281828459045
math.log()function किसी दी गई संख्या का natural logarithm लौटाती है। natural logarithm की गणना base 'e' पर की जाती है।
Example-:
import math
math.log(10)
Output-:
2.302585092994046
math.log10() function दी गई संख्या का base-10 logarithm लौटाती है। इसे हम standard logarithmic कहते हैं।
Example-:
import math
math.log10(10)
Output-:
math.exp() दी गई संख्या की power'e' को ऊपर उठाने के बाद math.exp()function एक float संख्या लौटाती है। दूसरे शब्दों में, exp (x), e**x देता है।
Example-:
import math
math.exp(10)
Output-:
22026.465794806718
इसे हम exponent operator की through भी कर सकते हैं-
Example-:
import math
math
.e
**10
Output-:
22026.465794806703
math.pow() function दो float argument प्राप्त करती है, पहले को दूसरे से ऊपर उठाती है और परिणाम लौटाती है। दूसरे शब्दों में, pow (4,4), 4**4 के बराबर है।
Example-:
import math
math
.pow(2,4)
Output-:
16.0
math.sqrt()function किसी दी गई संख्या का square root लौटाती है।
Example-:
import math
math.sqrt(100)
Output-:
10.0