ഗണിതം#
ആമുഖം#
മാത്തിൽ ബിൽറ്റ്-ഇൻ പൈത്തൺ ഫംഗ്ഷനുകളും പൂർണ്ണമായ math മൊഡ്യൂളും ഉൾപ്പെടുന്നു, ഇത് VEXcode VR-ൽ യാന്ത്രികമായി ലഭ്യമാണ്. അടിസ്ഥാന ഗണിതം മുതൽ വിപുലമായ ത്രികോണമിതി, റൗണ്ടിംഗ്, ലോഗരിഥമിക് പ്രവർത്തനങ്ങൾ വരെ എല്ലാം ചെയ്യാൻ ഈ ഉപകരണങ്ങൾ നിങ്ങളെ അനുവദിക്കുന്നു.
നിങ്ങളുടെ റോബോട്ടിന്റെ സ്ഥാനങ്ങൾ, കോണുകൾ, ദൂരങ്ങൾ, മറ്റ് സംഖ്യാ മൂല്യങ്ങൾ എന്നിവ കണക്കാക്കാൻ ഈ ഫംഗ്ഷനുകളും സ്ഥിരാങ്കങ്ങളും ഉപയോഗിക്കുക. നിങ്ങൾക്ക് ഡിഗ്രികൾക്കും റേഡിയനുമിടയിൽ പരിവർത്തനം ചെയ്യാനും എക്സ്പ്രഷനുകൾ വിലയിരുത്താനും ഇൻഫിനിറ്റി, NaN പോലുള്ള പ്രത്യേക മൂല്യങ്ങളുമായി പ്രവർത്തിക്കാനും കഴിയും.
ലഭ്യമായ ഗണിത ഫംഗ്ഷനുകൾ, സ്ഥിരാങ്കങ്ങൾ, യൂട്ടിലിറ്റികൾ എന്നിവയുടെ ഒരു ലിസ്റ്റ് താഴെ കൊടുക്കുന്നു:
ബിൽറ്റ്-ഇൻ ഫംഗ്ഷനുകൾ - പൈത്തണിൽ ഉൾപ്പെടുത്തിയിരിക്കുന്ന സാധാരണ ഗണിത ഉപകരണങ്ങൾ.
abs– ഒരു സംഖ്യയുടെ കേവല മൂല്യം നൽകുന്നു.round– ഒരു സംഖ്യയെ നിശ്ചിത ദശാംശ സ്ഥാനങ്ങളിലേക്ക് റൗണ്ട് ചെയ്യുന്നു.min– ഇൻപുട്ട് മൂല്യങ്ങളിൽ ഏറ്റവും ചെറിയത് നൽകുന്നു.max– ഇൻപുട്ട് മൂല്യങ്ങളിൽ ഏറ്റവും വലുത് നൽകുന്നു.sum– ഒരു ഇറ്ററബിളിലെ എല്ലാ മൂല്യങ്ങളും ചേർക്കുന്നു.divmod– ഘടകാംശവും ശിഷ്ടവും ഒരു ട്യൂപ്പിളായി നൽകുന്നു.pow– ഒരു സംഖ്യയെ ഒരു പവറിലേക്ക് ഉയർത്തുന്നു, ഓപ്ഷണലായി ഒരു മോഡുലസ് ഉപയോഗിച്ച്.int– ഒരു മൂല്യത്തെ ഒരു പൂർണ്ണസംഖ്യയിലേക്ക് പരിവർത്തനം ചെയ്യുന്നു.float– ഒരു മൂല്യത്തെ ഒരു ഫ്ലോട്ടിംഗ്-പോയിന്റ് സംഖ്യയിലേക്ക് പരിവർത്തനം ചെയ്യുന്നു.
സ്ഥിരാങ്കങ്ങൾ - math മൊഡ്യൂളിൽ നിന്നുള്ള മുൻനിശ്ചയിച്ച മൂല്യങ്ങൾ.
math.pi– സ്ഥിരാങ്കം π (പൈ).math.tau– സ്ഥിരാങ്കം ടൗ (2π).math.e– സ്വാഭാവിക ലോഗിന്റെ ബേസ്, യൂളർ സംഖ്യ.
ത്രികോണമിതി - വശങ്ങൾ തമ്മിലുള്ള കോണുകളും ബന്ധങ്ങളും കണക്കാക്കുക.
math.sin– റേഡിയനുകളിൽ ഒരു കോണിന്റെ സൈൻ.math.cos– റേഡിയനുകളിൽ ഒരു കോണിന്റെ കോസൈൻ.math.tan– റേഡിയനുകളിൽ ഒരു കോണിന്റെ ടാൻജെന്റ്.math.atan– റേഡിയനുകളിൽ ഒരു മൂല്യത്തിന്റെ ആർക്റ്റാൻജന്റ്.math.atan2– ക്വാഡ്രന്റ് കണക്കിലെടുക്കുമ്പോൾ, റേഡിയനുകളിൽ y/x ന്റെ ആർക്റ്റാൻജന്റ്.math.asin– റേഡിയനുകളിൽ ഒരു മൂല്യത്തിന്റെ ആർക്ക്സൈൻ.math.acos– റേഡിയനുകളിൽ ഒരു മൂല്യത്തിന്റെ ആർക്കോസിൻ.math.degrees– റേഡിയനുകളെ ഡിഗ്രികളാക്കി മാറ്റുന്നു.math.radians– ഡിഗ്രികളെ റേഡിയനുകളാക്കി മാറ്റുന്നു.
റൗണ്ടിംഗ് & കേവല മൂല്യം – കൃത്യതയോ ദിശയോ ക്രമീകരിക്കുക.
math.ceil– ഏറ്റവും അടുത്തുള്ള പൂർണ്ണസംഖ്യയിലേക്ക് റൗണ്ട് ചെയ്യുന്നു.math.floor– ഏറ്റവും അടുത്തുള്ള പൂർണ്ണസംഖ്യയിലേക്ക് റൗണ്ട് ചെയ്യുന്നു.math.trunc– ദശാംശ ഭാഗം നീക്കം ചെയ്യുന്നു.math.fabs– ഒരു ഫ്ലോട്ടായി കേവല മൂല്യം നൽകുന്നു.
എക്സ്പോണന്റുകളും ലോഗരിതങ്ങളും - പവർ, റൂട്ട്, ലോഗ് കണക്കുകൂട്ടലുകൾ.
math.pow– ഒരു സംഖ്യയെ ഒരു ശക്തിയിലേക്ക് ഉയർത്തുന്നു.math.sqrt– വർഗ്ഗമൂലത്തെ തിരികെ നൽകുന്നു.math.exp– x ന്റെ ശക്തിയിലേക്ക് e കണക്കാക്കുന്നു.math.log– സ്വാഭാവിക ലോഗരിതം (ബേസ് e).
ഫ്ലോട്ടിംഗ് പോയിന്റ് പ്രവർത്തനങ്ങൾ - ഫ്ലോട്ട് മൂല്യങ്ങൾ പരിശോധിക്കുക അല്ലെങ്കിൽ വിഘടിപ്പിക്കുക.
math.modf– ഒരു ഫ്ലോട്ടിന്റെ ഫ്രാക്ഷണൽ, ഇൻറിജർ ഭാഗങ്ങൾ തിരികെ നൽകുന്നു.math.frexp– ഒരു സംഖ്യയെ മാന്റിസ്സയായും ഘാതാംഗമായും വിഘടിപ്പിക്കുന്നു.math.fmod– ഡിവിഡന്റിന്റെ ചിഹ്നമുള്ള ശിഷ്ടം.math.copysign– മറ്റൊന്നിന്റെ ചിഹ്നമുള്ള ഒരു മൂല്യം നൽകുന്നു.math.ldexp–x * (2 ** exp)കണക്കാക്കുന്നു.
ബിൽറ്റ്-ഇൻ ഫംഗ്ഷനുകൾ#
നിങ്ങളുടെ പ്രോജക്റ്റിനുള്ളിൽ ഗണിത പ്രവർത്തനങ്ങൾ നടത്താൻ നിങ്ങളെ അനുവദിക്കുന്ന നിരവധി ബിൽറ്റ്-ഇൻ ഫംഗ്ഷനുകൾ പൈത്തൺ നൽകുന്നു.
abs#
abs ഒരു സംഖ്യയുടെ കേവല മൂല്യം നൽകുന്നു, ഏതെങ്കിലും നെഗറ്റീവ് ചിഹ്നം നീക്കം ചെയ്യുന്നു.
Usage:
abs(x)
പാരാമീറ്റർ |
വിവരണം |
|---|---|
|
ഒരു പൂർണ്ണസംഖ്യ അല്ലെങ്കിൽ ഫ്ലോട്ട്. |
def main():
# Get the absolute value of -10
abs_result = abs(-10)
brain.print(abs_result)
# abs_result = 10
# VR threads — Do not delete
vr_thread(main)
round#
round ഒരു സംഖ്യയെ നിശ്ചിത ദശാംശ സ്ഥാനങ്ങളിലേക്ക് റൗണ്ട് ചെയ്യുന്നു.
Usage:
round(x, ndigits)
പാരാമീറ്റർ |
വിവരണം |
|---|---|
|
ഒരു പൂർണ്ണസംഖ്യ അല്ലെങ്കിൽ ഫ്ലോട്ട്. |
|
ഓപ്ഷണൽ. റൗണ്ട് ചെയ്യേണ്ട ദശാംശ സ്ഥാനങ്ങളുടെ എണ്ണം. ഡിഫോൾട്ട് 0 ആണ്. |
def main():
# Round 5.7 to the nearest integer
round_int_result = round(5.7)
brain.print(round_int_result)
# round_int_result = 6
# VR threads — Do not delete
vr_thread(main)
def main():
# Round 3.14159 to 2 decimal places
round_result = round(3.14159, 2)
brain.print(round_result, precision=2)
# round_result = 3.14
# VR threads — Do not delete
vr_thread(main)
min#
min ഒന്നിലധികം ആർഗ്യുമെന്റുകളിൽ നിന്നോ ഒരു ഇറ്ററബിളിൽ നിന്നോ ഉള്ള ഏറ്റവും ചെറിയ മൂല്യം നൽകുന്നു.
Usage:
min(arg1, arg2, …) or min(sequence)
പാരാമീറ്റർ |
വിവരണം |
|---|---|
|
താരതമ്യം ചെയ്യേണ്ട സംഖ്യകൾ. |
|
ഒരു ലിസ്റ്റ്, ട്യൂപ്പിൾ അല്ലെങ്കിൽ അക്കങ്ങൾ അടങ്ങിയ മറ്റ് ശ്രേണി. |
def main():
# Get the smallest number from 3, 7, and 1
min_result = min(3, 7, 1)
brain.print(min_result)
# min_result = 1
# VR threads — Do not delete
vr_thread(main)
def main():
# Get the smallest value from a list
min_list_result = min([10, 4, 25, 1])
brain.print(min_list_result)
# min_list_result = 1
# VR threads — Do not delete
vr_thread(main)
max#
ഒന്നിലധികം ആർഗ്യുമെന്റുകളിൽ നിന്നോ ഒരു ഇറ്ററബിളിൽ നിന്നോ ഏറ്റവും വലിയ മൂല്യം max നൽകുന്നു.
Usage:
max(arg1, arg2, …) or max(sequence)
പാരാമീറ്റർ |
വിവരണം |
|---|---|
|
താരതമ്യം ചെയ്യേണ്ട സംഖ്യകൾ. |
|
ഒരു ലിസ്റ്റ്, ട്യൂപ്പിൾ അല്ലെങ്കിൽ അക്കങ്ങൾ അടങ്ങിയ മറ്റ് ശ്രേണി. |
def main():
# Get the largest number from 3, 7, and 1
max_result = max(3, 7, 1)
brain.print(max_result)
# max_result = 7
# VR threads — Do not delete
vr_thread(main)
def main():
# Get the largest value from a list
max_list_result = max([10, 4, 25, 1])
brain.print(max_list_result)
# max_list_result = 25
# VR threads — Do not delete
vr_thread(main)
sum#
sum എന്നത് ഒരു ഇറ്ററബിളിലെ എല്ലാ മൂല്യങ്ങളെയും ഒരു ഓപ്ഷണൽ ആരംഭ മൂല്യത്തോടെ കൂട്ടിച്ചേർക്കുന്നു.
Usage:
sum(sequence, start)
പാരാമീറ്റർ |
വിവരണം |
|---|---|
|
ഒരു ലിസ്റ്റ്, ട്യൂപ്പിൾ അല്ലെങ്കിൽ അക്കങ്ങൾ അടങ്ങിയ മറ്റ് ശ്രേണി. |
|
ഓപ്ഷണൽ. തുകയിലേക്ക് ചേർക്കേണ്ട ഒരു മൂല്യം. ഡിഫോൾട്ട് 0 ആണ്. |
def main():
# Calculate the sum of a list of numbers
sum_result = sum([1, 2, 3, 4, 5])
brain.print(sum_result)
# sum_result = 15
# VR threads — Do not delete
vr_thread(main)
def main():
# Calculate the sum of a list with a starting value of 10
sum_with_start = sum([1, 2, 3], 10)
brain.print(sum_with_start)
# sum_with_start = 16
# VR threads — Do not delete
vr_thread(main)
divmod#
divmod ഒരു ഹരണ പ്രവർത്തനത്തിന്റെ ഘടകവും ശിഷ്ടവും അടങ്ങിയ ഒരു ട്യൂപ്പിൾ നൽകുന്നു.
Usage:
divmod(a, b)
പാരാമീറ്റർ |
വിവരണം |
|---|---|
|
ലാഭവിഹിതം. |
|
ഹരിക്കൽ ഘടകം. |
def main():
# Perform integer division and remainder of 10 / 3
divmod_result = divmod(10, 3)
brain.print(divmod_result)
# divmod_result = (3, 1)
# VR threads — Do not delete
vr_thread(main)
pow#
pow ഒരു സംഖ്യയെ ഒരു പവറിലേക്ക് ഉയർത്തുകയും ഓപ്ഷണലായി ഒരു മോഡുലസ് പ്രവർത്തനം നടത്തുകയും ചെയ്യുന്നു.
Usage:
pow(x, y, mod)
പാരാമീറ്റർ |
വിവരണം |
|---|---|
|
അടിസ്ഥാന സംഖ്യ. |
|
ഘാതം. |
|
ഓപ്ഷണൽ. ഒരു മോഡുലസ് മൂല്യം. നൽകിയിട്ടുണ്ടെങ്കിൽ, |
def main():
# Calculate 2 raised to the power of 3
pow_result = pow(2, 3)
brain.print(pow_result)
# pow_result = 8
# VR threads — Do not delete
vr_thread(main)
int#
int ഒരു സംഖ്യയെയോ സ്ട്രിങ്ങിനെയോ പൂർണ്ണസംഖ്യയാക്കി മാറ്റുന്നു. ഒരു സ്ട്രിങ്ങിൽ നിന്ന് പരിവർത്തനം ചെയ്യുമ്പോൾ ഇത് അടിസ്ഥാന പരിവർത്തനത്തെയും പിന്തുണയ്ക്കുന്നു.
Usage:
int(x, base)
പാരാമീറ്റർ |
വിവരണം |
|---|---|
|
പരിവർത്തനം ചെയ്യാനുള്ള ഒരു നമ്പർ, സ്ട്രിംഗ് അല്ലെങ്കിൽ മറ്റ് വസ്തു. |
|
ഓപ്ഷണൽ. പരിവർത്തനത്തിനായി ഉപയോഗിക്കേണ്ട സംഖ്യാ അടിസ്ഥാനം. ഡിഫോൾട്ട് 10 ആണ്. |
def main():
# Convert a float to an integer to get rid of decimals
price = 19.99
price_int = int(price)
brain.print("{} coins".format(price_int))
# Output: 19 coins
# VR threads — Do not delete
vr_thread(main)
def main():
# Convert a string into an integer to use in calculations
user_input = "55"
user_number = int(user_input)
brain.print(user_number * 2)
# Output: 110
# VR threads — Do not delete
vr_thread(main)
float#
float ഒരു സംഖ്യയെയോ സ്ട്രിംഗിനെയോ ഒരു ഫ്ലോട്ടിംഗ്-പോയിന്റ് സംഖ്യയാക്കി മാറ്റുന്നു.
Usage:
float(x)
പാരാമീറ്റർ |
വിവരണം |
|---|---|
|
പരിവർത്തനം ചെയ്യാനുള്ള ഒരു നമ്പർ, സ്ട്രിംഗ് അല്ലെങ്കിൽ മറ്റ് വസ്തു. |
def main():
# Convert division result to a float
num_apples = 6
num_people = 2
apples_per_person = float(num_apples) / num_people
brain.print(apples_per_person)
# Output: 3.00
# VR threads — Do not delete
vr_thread(main)
def main():
# Convert a string into a float to use in calculations
user_input = "23.4"
user_number = float(user_input)
brain.print(user_number * 3)
# Output: 70.20
# VR threads — Do not delete
vr_thread(main)
ഗണിത മൊഡ്യൂൾ#
മൈക്രോപൈത്തണിലെ math മൊഡ്യൂൾ സാധാരണ ഗണിത കണക്കുകൂട്ടലുകൾ നടത്തുന്നതിനുള്ള അധിക രീതികൾ നൽകുന്നു. ഈ രീതികളിൽ ത്രികോണമിതി, ലോഗരിഥമിക്, മറ്റ് സംഖ്യാ പ്രവർത്തനങ്ങൾ എന്നിവ ഉൾപ്പെടുന്നു.
math മൊഡ്യൂൾ VEXcode-ൽ ഡിഫോൾട്ടായി ഇറക്കുമതി ചെയ്യപ്പെടുന്നു.
Constants#
ഒരു പ്രോജക്റ്റ് സമയത്ത് സ്ഥിരമായി നിലനിൽക്കുന്ന മുൻകൂട്ടി നിശ്ചയിച്ച മൂല്യങ്ങളാണ് സ്ഥിരാങ്കങ്ങൾ. നിർവചനമോ അസൈൻമെന്റോ ആവശ്യമില്ലാതെ തന്നെ കണക്കുകൂട്ടലുകളിൽ അവ ഉപയോഗിക്കാൻ കഴിയും.
പൈ#
pi എന്നത് ഗണിത സ്ഥിരാങ്കം π നൽകുന്നു, ഇത് ഒരു വൃത്തത്തിന്റെ ചുറ്റളവും വ്യാസവും തമ്മിലുള്ള അനുപാതമാണ്.
Usage:
math.pi
def main():
# Calculate the area of a circle with radius 5 using pi
circle_area = math.pi * 5 * 5
brain.print(circle_area, precision=2)
# circle_area = 78.54
# VR threads — Do not delete
vr_thread(main)
ടൗ#
tau 2π ന്റെ മൂല്യം നൽകുന്നു.
Usage:
math.tau
def main():
# Calculate the circumference of a circle with radius
circumference = math.tau * 5
brain.print(circumference, precision=2)
# circumference = 31.42
# VR threads — Do not delete
vr_thread(main)
ഇ#
e സ്വാഭാവിക ലോഗരിതത്തിന്റെ അടിസ്ഥാനം നൽകുന്നു.
Usage:
math.e
def main():
# Calculate e raised to the power of 2
e_power = math.pow(math.e, 2)
brain.print(e_power, precision=2)
# e_power = 7.39
# VR threads — Do not delete
vr_thread(main)
Trigonometry#
പാപം#
sin ഒരു കോണിന്റെ സൈൻ റേഡിയൻസിൽ കണക്കാക്കി ഒരു ഫ്ലോട്ട് തിരികെ നൽകുന്നു.
Usage:
math.sin(x)
പാരാമീറ്റർ |
വിവരണം |
|---|---|
|
റേഡിയനുകളിൽ ഒരു കോണിനെ പ്രതിനിധീകരിക്കുന്ന ഒരു ഫ്ലോട്ട് അല്ലെങ്കിൽ പൂർണ്ണസംഖ്യ. |
def main():
# Calculate the sine of
# 30 degrees in radians
result = math.sin(math.radians(30))
brain.print(result, precision=2)
# result = 0.50
# VR threads — Do not delete
vr_thread(main)
കാരണം#
cos റേഡിയൻസിൽ ഒരു കോണിന്റെ കോസൈൻ കണക്കാക്കുകയും ഒരു ഫ്ലോട്ട് തിരികെ നൽകുകയും ചെയ്യുന്നു.
Usage:
math.cos(x)
പാരാമീറ്റർ |
വിവരണം |
|---|---|
|
റേഡിയനുകളിൽ ഒരു കോണിനെ പ്രതിനിധീകരിക്കുന്ന ഒരു ഫ്ലോട്ട് അല്ലെങ്കിൽ പൂർണ്ണസംഖ്യ. |
def main():
# Calculate the cosine of
# 60 degrees in radians
result = math.cos(math.radians(60))
brain.print(result, precision=2)
# result = 0.50
# VR threads — Do not delete
vr_thread(main)
ടാൻ#
tan റേഡിയൻസിൽ ഒരു കോണിന്റെ ടാൻജെന്റ് കണക്കാക്കുകയും ഒരു ഫ്ലോട്ട് തിരികെ നൽകുകയും ചെയ്യുന്നു.
Usage:
math.tan(x)
പാരാമീറ്റർ |
വിവരണം |
|---|---|
|
റേഡിയനുകളിൽ ഒരു കോണിനെ പ്രതിനിധീകരിക്കുന്ന ഒരു ഫ്ലോട്ട് അല്ലെങ്കിൽ പൂർണ്ണസംഖ്യ. |
def main():
# Calculate the tangent of
# 45 degrees in radians
result = math.tan(math.radians(45))
brain.print(result, precision=2)
# result = 1.00
# VR threads — Do not delete
vr_thread(main)
ആതൻ#
atan ഒരു സംഖ്യയുടെ വിപരീത ടാൻജെന്റ് (ആർക്ക് ടാൻജെന്റ്) കണക്കാക്കുകയും റേഡിയനുകളിൽ കോണിനെ പ്രതിനിധീകരിക്കുന്ന ഒരു ഫ്ലോട്ട് തിരികെ നൽകുകയും ചെയ്യുന്നു.
Usage:
math.atan(x)
പാരാമീറ്റർ |
വിവരണം |
|---|---|
|
ഒരു ഫ്ലോട്ട് അല്ലെങ്കിൽ പൂർണ്ണസംഖ്യ. |
def main():
# Calculate the arc tangent
# of 1 in degrees
arc_tan = math.atan(1.0)
result = math.degrees(arc_tan)
brain.print(result, precision=2)
# result = 45.00
# VR threads — Do not delete
vr_thread(main)
അറ്റൻ2#
atan2 y/x ന്റെ വിപരീത ടാൻജെന്റിന്റെ പ്രിൻസിപ്പൽ മൂല്യം കണക്കാക്കുകയും റേഡിയനുകളിൽ കോണിനെ പ്രതിനിധീകരിക്കുന്ന ഒരു ഫ്ലോട്ട് തിരികെ നൽകുകയും ചെയ്യുന്നു.
Usage:
math.atan2(y, x)
പാരാമീറ്റർ |
വിവരണം |
|---|---|
|
y-കോർഡിനേറ്റിനെ പ്രതിനിധീകരിക്കുന്ന ഒരു ഫ്ലോട്ട് അല്ലെങ്കിൽ പൂർണ്ണസംഖ്യ. |
|
x-കോർഡിനേറ്റിനെ പ്രതിനിധീകരിക്കുന്ന ഒരു ഫ്ലോട്ട് അല്ലെങ്കിൽ പൂർണ്ണസംഖ്യ. |
def main():
# Calculate the inverse tangent
# of 1/1 in degrees
atan2 = math.atan2(1.0, 1.0)
result = math.degrees(atan2)
brain.print(result, precision=2)
# result = 45.00
# VR threads — Do not delete
vr_thread(main)
അസിൻ#
asin ഒരു സംഖ്യയുടെ വിപരീത സൈൻ (ആർക്ക് സൈൻ) കണക്കാക്കുകയും റേഡിയനുകളിൽ കോണിനെ പ്രതിനിധീകരിക്കുന്ന ഒരു ഫ്ലോട്ട് തിരികെ നൽകുകയും ചെയ്യുന്നു.
Usage:
math.asin(x)
പാരാമീറ്റർ |
വിവരണം |
|---|---|
|
-1 നും 1 നും ഇടയിലുള്ള ഒരു ഫ്ലോട്ട് അല്ലെങ്കിൽ പൂർണ്ണസംഖ്യ. |
def main():
# Calculate the arc sine
# of 0.5 in degrees
result = math.degrees(math.asin(0.5))
brain.print(result, precision=2)
# result = 30.00
# VR threads — Do not delete
vr_thread(main)
അക്കോസ്#
acos ഒരു സംഖ്യയുടെ വിപരീത കോസൈൻ (ആർക്ക് കോസൈൻ) കണക്കാക്കുകയും റേഡിയനുകളിൽ കോണിനെ പ്രതിനിധീകരിക്കുന്ന ഒരു ഫ്ലോട്ട് തിരികെ നൽകുകയും ചെയ്യുന്നു.
Usage:
math.acos(x)
പാരാമീറ്റർ |
വിവരണം |
|---|---|
|
-1 നും 1 നും ഇടയിലുള്ള ഒരു ഫ്ലോട്ട് അല്ലെങ്കിൽ പൂർണ്ണസംഖ്യ. |
def main():
# Calculate the arc cosine
# of 0.5 in degrees
result = math.degrees(math.acos(0.5))
brain.print(result, precision=2)
# result = 60.00
# VR threads — Do not delete
vr_thread(main)
ഡിഗ്രികൾ#
degrees ഒരു കോണിനെ റേഡിയനുകളിൽ നിന്ന് ഡിഗ്രികളാക്കി മാറ്റുന്നു.
Usage:
math.degrees(x)
പാരാമീറ്റർ |
വിവരണം |
|---|---|
|
റേഡിയനുകളിൽ ഒരു കോണിനെ പ്രതിനിധീകരിക്കുന്ന ഒരു ഫ്ലോട്ട് അല്ലെങ്കിൽ പൂർണ്ണസംഖ്യ. |
def main():
# Convert pi radians to degrees
degrees_result = math.degrees(math.pi)
brain.print(degrees_result, precision=2)
# degrees_result = 180.00
# VR threads — Do not delete
vr_thread(main)
റേഡിയനുകൾ#
radians ഒരു കോണിനെ ഡിഗ്രിയിൽ നിന്ന് റേഡിയൻസാക്കി മാറ്റുന്നു.
Usage:
math.radians(x)
പാരാമീറ്റർ |
വിവരണം |
|---|---|
|
ഡിഗ്രിയിൽ ഒരു കോണിനെ പ്രതിനിധീകരിക്കുന്ന ഒരു ഫ്ലോട്ട് അല്ലെങ്കിൽ പൂർണ്ണസംഖ്യ. |
def main():
# Convert 180 degrees to radians
radians_result = math.radians(180)
brain.print(radians_result, precision=2)
# radians_result = 3.14
# VR threads — Do not delete
vr_thread(main)
Rounding & Absolute Values#
സീൽ#
ceil ഒരു സംഖ്യയെ ഏറ്റവും അടുത്തുള്ള പൂർണ്ണസംഖ്യയിലേക്ക് റൗണ്ട് ചെയ്യുന്നു.
Usage:
math.ceil(x)
പാരാമീറ്റർ |
വിവരണം |
|---|---|
|
റൗണ്ട് അപ്പ് ചെയ്യേണ്ട ഒരു ഫ്ലോട്ട് അല്ലെങ്കിൽ പൂർണ്ണസംഖ്യ. |
def main():
# Round 3.7 up to the nearest integer
ceil_result = math.ceil(3.7)
brain.print(ceil_result)
# ceil_result = 4
# VR threads — Do not delete
vr_thread(main)
തറ#
floor ഒരു സംഖ്യയെ ഏറ്റവും അടുത്തുള്ള പൂർണ്ണസംഖ്യയിലേക്ക് റൗണ്ട് ചെയ്യുന്നു.
Usage:
math.floor(x)
പാരാമീറ്റർ |
വിവരണം |
|---|---|
|
റൗണ്ട് ഡൌൺ ചെയ്യേണ്ട ഒരു ഫ്ലോട്ട് അല്ലെങ്കിൽ പൂർണ്ണസംഖ്യ. |
def main():
# Round 3.7 down to the nearest integer
floor_result = math.floor(3.7)
brain.print(floor_result)
# floor_result = 3
# VR threads — Do not delete
vr_thread(main)
തുമ്പ്#
trunc ഒരു സംഖ്യയുടെ ദശാംശ ഭാഗം റൗണ്ടിംഗ് ഇല്ലാതെ നീക്കം ചെയ്യുന്നു.
Usage:
math.trunc(x)
പാരാമീറ്റർ |
വിവരണം |
|---|---|
|
വെട്ടിച്ചുരുക്കേണ്ട ഒരു ഫ്ലോട്ട്. |
def main():
# Remove the decimal part of 3.7
trunc_result = math.trunc(3.7)
brain.print(trunc_result)
# trunc_result = 3
# VR threads — Do not delete
vr_thread(main)
ഫാബ്സ്#
fabs ഒരു സംഖ്യയുടെ കേവല മൂല്യം ഫ്ലോട്ടായി നൽകുന്നു.
Usage:
math.fabs(x)
പാരാമീറ്റർ |
വിവരണം |
|---|---|
|
ഒരു ഫ്ലോട്ട് അല്ലെങ്കിൽ പൂർണ്ണസംഖ്യ. |
def main():
# Get the absolute value of -3.7
fabs_result = math.fabs(-3.7)
brain.print(fabs_result, precision=2)
# fabs_result = 3.70
# VR threads — Do not delete
vr_thread(main)
Exponents & Logarithms#
പവ്#
pow , x നെ y യുടെ ശക്തിയിലേക്ക് ഉയർത്തുകയും ഒരു ഫ്ലോട്ട് തിരികെ നൽകുകയും ചെയ്യുന്നു, രണ്ട് ഇൻപുട്ടുകളും പൂർണ്ണസംഖ്യകളാണെങ്കിൽ പോലും.
Usage:
math.pow(x, y)
പാരാമീറ്റർ |
വിവരണം |
|---|---|
|
ഒരു ഫ്ലോട്ട് അല്ലെങ്കിൽ പൂർണ്ണസംഖ്യാ ബേസ്. |
|
ഒരു ഫ്ലോട്ട് അല്ലെങ്കിൽ പൂർണ്ണസംഖ്യ എക്സ്പോണന്റ്. |
def main():
# Calculate 2 raised to the power of 3
power_result = math.pow(2, 3)
brain.print(power_result, precision=2)
# power_result = 8.00
# VR threads — Do not delete
vr_thread(main)
ചതുരശ്രം#
sqrt ഒരു സംഖ്യയുടെ വർഗ്ഗമൂലം കണക്കാക്കുകയും പൂർണ്ണ വർഗ്ഗങ്ങൾക്ക് പോലും ഒരു ഫ്ലോട്ട് തിരികെ നൽകുകയും ചെയ്യുന്നു.
Usage:
math.sqrt(x)
പാരാമീറ്റർ |
വിവരണം |
|---|---|
|
ഒരു നോൺ-നെഗറ്റീവ് ഫ്ലോട്ട് അല്ലെങ്കിൽ പൂർണ്ണസംഖ്യ. |
def main():
# Calculate the square root of 16
sqrt_result = math.sqrt(16)
brain.print(sqrt_result, precision=2)
# sqrt_result = 4.00
# VR threads — Do not delete
vr_thread(main)
എക്സ്പ്രഷൻ#
exp ഒരു സംഖ്യയുടെ എക്സ്പോണൻഷ്യൽ കണക്കാക്കുകയും ഒരു ഫ്ലോട്ട് തിരികെ നൽകുകയും ചെയ്യുന്നു.
Usage:
math.exp(x)
പാരാമീറ്റർ |
വിവരണം |
|---|---|
|
ഒരു ഫ്ലോട്ട് അല്ലെങ്കിൽ പൂർണ്ണസംഖ്യ. |
def main():
# Calculate e raised to the power of 1
exp_result = math.exp(1)
brain.print(exp_result, precision=2)
# exp_result = 2.72
# VR threads — Do not delete
vr_thread(main)
ലോഗ്#
log ഒരു സംഖ്യയുടെ സ്വാഭാവിക ലോഗരിതം കണക്കാക്കുകയും ഒരു ഫ്ലോട്ട് തിരികെ നൽകുകയും ചെയ്യുന്നു.
Usage:
math.log(x)
പാരാമീറ്റർ |
വിവരണം |
|---|---|
|
ഒരു പോസിറ്റീവ് ഫ്ലോട്ട് അല്ലെങ്കിൽ പൂർണ്ണസംഖ്യ. |
def main():
# Calculate the natural logarithm
# (base e) of 7.389056
log_result = math.log(7.389056)
brain.print(log_result, precision=2)
# log_result = 2.00
# VR threads — Do not delete
vr_thread(main)
ലോഗ്10#
log10 ഒരു സംഖ്യയുടെ ബേസ് 10 ലോഗരിതം കണക്കാക്കി ഒരു ഫ്ലോട്ട് തിരികെ നൽകുന്നു.
Usage:
math.log10(x)
പാരാമീറ്റർ |
വിവരണം |
|---|---|
|
ഒരു പോസിറ്റീവ് ഫ്ലോട്ട് അല്ലെങ്കിൽ പൂർണ്ണസംഖ്യ. |
def main():
# Calculate the log10 of 100
log_result = math.log10(100)
brain.print(log_result)
# log_result = 2
# VR threads — Do not delete
vr_thread(main)
Floating Point Operations#
പരിഷ്കരണം#
modf ഒരു സംഖ്യയെ അതിന്റെ ഭിന്നസംഖ്യ, പൂർണ്ണസംഖ്യ ഭാഗങ്ങളായി വിഘടിപ്പിച്ച് ഒരു ട്യൂപ്പിൾ (fractional part, integer part)എന്നിവ ഫ്ലോട്ടുകളായി നൽകുന്നു.
Usage:
math.modf(x)
പാരാമീറ്റർ |
വിവരണം |
|---|---|
|
വിഘടിപ്പിക്കാനുള്ള ഒരു ഫ്ലോട്ട് അല്ലെങ്കിൽ പൂർണ്ണസംഖ്യ. |
def main():
# Decompose 3.14159 into fractional and integer parts
fractional_part, integer_part = math.modf(3.14159)
brain.print(fractional_part, precision=2)
brain.new_line()
brain.print(integer_part, precision=2)
# fractional_part = 0.14
# integer_part = 3.00
# VR threads — Do not delete
vr_thread(main)
ഫ്രെക്സ്പ്#
frexp ഒരു സംഖ്യയെ അതിന്റെ മാന്റിസ്സയായും എക്സ്പോണന്റായും വിഘടിപ്പിച്ച് ഒരു ട്യൂപ്പിൾ (mantissa, exponent)നൽകുന്നു, ഇവിടെ മാന്റിസ്സ ഒരു ഫ്ലോട്ടും എക്സ്പോണന്റ് ഒരു പൂർണ്ണസംഖ്യയുമാണ്.
Usage:
math.frexp(x)
പാരാമീറ്റർ |
വിവരണം |
|---|---|
|
വിഘടിപ്പിക്കാനുള്ള ഒരു ഫ്ലോട്ട് അല്ലെങ്കിൽ പൂർണ്ണസംഖ്യ. |
def main():
# Decompose 16 into its mantissa and exponent
mantissa, exponent = math.frexp(16)
brain.print(mantissa, precision=2)
brain.new_line()
brain.print(exponent)
# mantissa = 0.50
# exponent = 5
# VR threads — Do not delete
vr_thread(main)
എഫ്എംഒഡി#
fmod , ഡിവിഡന്റിന്റെ (x) ചിഹ്നം നിലനിർത്തിക്കൊണ്ട് ഹരിച്ചലിന്റെ ബാക്കി ഭാഗം നൽകുന്നു.
Usage:
math.fmod(x, y)
പാരാമീറ്റർ |
വിവരണം |
|---|---|
|
ലാഭവിഹിതം. |
|
ഹരിക്കൽ ഘടകം. |
def main():
# Calculate remainder of 10 / 3
# that preserves the sign of 10
fmod_result = math.fmod(10, 3)
brain.print(fmod_result, precision=2)
# fmod_result = 1.00
# VR threads — Do not delete
vr_thread(main)
പകർപ്പ് ചിഹ്നം#
copysign y എന്ന ചിഹ്നത്തോടെ x തിരികെ നൽകുന്നു.
Usage:
math.copysign(x, y)
പാരാമീറ്റർ |
വിവരണം |
|---|---|
|
പരിഷ്ക്കരിക്കേണ്ട മൂല്യം. |
|
ചിഹ്നം പകർത്തേണ്ട മൂല്യം. |
def main():
# Return -10 with the sign of 3 (positive)
copysign_result = math.copysign(-10, 3)
brain.print(copysign_result, precision=2)
# copysign_result = 10.00
# VR threads — Do not delete
vr_thread(main)
ldexp GenericName#
ldexp x * (2 ** exp)കണക്കാക്കുന്നു, ഇത് x * 2exp{code} ന് തുല്യമാണ്.
Usage:
math.ldexp(x, exp)
പാരാമീറ്റർ |
വിവരണം |
|---|---|
|
അടിസ്ഥാന മൂല്യം. |
|
ഘാതം. |
def main():
# Compute 3 * (2 ** 4)
ldexp_result = math.ldexp(3, 4)
brain.print(ldexp_result, precision=2)
# ldexp_result = 48.00
# VR threads — Do not delete
vr_thread(main)