<div class="text-justify">  <center>[Image Source](https://levelup.gitconnected.com/learn-the-python-math-module-9c2c516ea37c)</center> In my last post, I wrote about the basic introduction of the math module in python programming and also discuss about some basic functions to perform certain mathematics operation. In this post, we will see about the some other functions in the same module. Lets use `dir()` function to see the list of funtions within our math module. We will use for loop to iterate over each loop. ``` for i in dir(math): print(i) ``` You can see the following output while executing the above code. These are the list of functions provided by the math module that you can use for performing certain operations. You can see a lot of other functions as well when you scroll down the output window.  We know lists, tuples and arrays are important data structures in python. One of the function that is provided by math module is `fsum()` that returns the sum of all items in these iterables. For example `print(math.fsum([4, 6, 8, 3]))` will return output as 21 as below:  In the same way you can use `prod()` to find the product of items in lists, tuples or arrays. For example you can use this syntax `print(math.prod([2, 4, 5]))` to find the product of all numbers in a list. The outuput should be 40 in this case and same can be seen below.  Also you can use this module for performing trigonometric operations. Lets try to find the value of cosπ which is -1. In python it can be done using the following syntax: `print(math.cos(math.pi))`. Following output can be seen in execution.  In the same way you can use `tan()` function to find the tangent value of any number. We know tan 45° is 1. In following code we will express 45° as (π/4) and see the same output. The code is: ``` a = math.pi/4 print(math.tan(a)) ``` The output is:  Apart from these stuffs, you can use math module to perform logarithmic operations, hyperbolic functions (trigonometric functions on hyperbolas), other special operations like finding Gaussian value, Euclidean distance and so on. </div>
author | leoumesh |
---|---|
permlink | working-with-python-math-module-9de51d73b9e7c |
category | hive-163521 |
json_metadata | {"links":["https://levelup.gitconnected.com/learn-the-python-math-module-9c2c516ea37c"],"image":["https://images.hive.blog/DQmQxuUaCNhiXAotqYVWSRHU7fjTyXj9ibgWnbQhKrSpGGm/image.png","https://images.hive.blog/DQmf6krscwLXFHP8AoJQTjiHDPu4B2AQ4b26eARGCqN4p7k/image.png","https://images.hive.blog/DQmQB2WM8JHMamkEotbtyfPXoW5WjuGdH4HnytbxMT5uXi4/image.png","https://images.hive.blog/DQmTMiRkbM5JFDc6DfreDzyyzWCUNbfSxreoBVKCUorMM4Q/image.png","https://images.hive.blog/DQmWf56j9LyKG4w1ecQ7xkKLvEcydF7w1ovVDb5AR3LnGJW/image.png","https://images.hive.blog/DQmReXDWNfwgnp6BTsLTGy8he59hgKWKXJ8ZpX5HiTbnFeA/image.png"],"tags":["hive-163521","stem","math","mathematics","python","coding","programming","tutorial","function"],"app":"ecency/3.0.23-mobile","format":"markdown+html"} |
created | 2021-12-12 03:25:30 |
last_update | 2021-12-12 03:25:30 |
depth | 0 |
children | 0 |
last_payout | 2021-12-19 03:25:30 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 17.964 HBD |
curator_payout_value | 17.883 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 2,698 |
author_reputation | 212,340,493,251,438 |
root_title | "Working With Python Math Module - Part 2" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 108,477,447 |
net_rshares | 18,262,548,902,607 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
pharesim | 0 | 104,871,772,294 | 9.28% | ||
drifter1 | 0 | 28,902,247,402 | 100% | ||
roelandp | 0 | 178,976,609,729 | 2.31% | ||
gikitiki | 0 | 2,652,056,589 | 4.64% | ||
arcange | 0 | 172,572,362,814 | 2% | ||
raphaelle | 0 | 1,316,040,310 | 2% | ||
logic | 0 | 235,285,893,769 | 100% | ||
abh12345 | 0 | 10,560,033,172 | 0.46% | ||
steemcleaners | 0 | 2,574,800,668,518 | 100% | ||
slider2990 | 0 | 2,144,587,268 | 20% | ||
walterjay | 0 | 5,942,115,072 | 0.35% | ||
voter | 0 | 2,177,208,954 | 100% | ||
steemitboard | 0 | 8,511,225,259 | 2% | ||
freebornsociety | 0 | 520,388,306 | 5% | ||
hemlal | 0 | 0 | 100% | ||
ewkaw | 0 | 342,725,688,106 | 20% | ||
jayna | 0 | 12,076,411,842 | 2.32% | ||
joeyarnoldvn | 0 | 505,742,220 | 1.47% | ||
diabolika | 0 | 3,161,862,675 | 4.64% | ||
diegoameerali | 0 | 589,699,730 | 2.78% | ||
spaminator | 0 | 2,807,461,168,221 | 100% | ||
markjason | 0 | 1,080,582,582 | 4.64% | ||
fatman | 0 | 7,405,112,002 | 2% | ||
votehero | 0 | 26,601,984,776 | 6.5% | ||
sharpshot | 0 | 219,003,213,543 | 40% | ||
jlsplatts | 0 | 17,199,824,735 | 2% | ||
investegg | 0 | 138,267,099,922 | 3.3% | ||
kph | 0 | 4,489,273,315 | 40% | ||
aamin | 0 | 1,033,881,482 | 4.64% | ||
sco | 0 | 1,696,894,699 | 5.56% | ||
ronpurteetv | 0 | 826,075,439 | 4.64% | ||
mmmmkkkk311 | 0 | 129,795,422,874 | 10% | ||
leoumesh | 0 | 10,281,499,531 | 100% | ||
steemflagrewards | 0 | 400,554,254,180 | 100% | ||
lemony-cricket | 0 | 20,976,381,947 | 4.64% | ||
bertrayo | 0 | 4,157,434,171 | 4.64% | ||
azircon | 0 | 1,443,309,817,385 | 7.88% | ||
louis88 | 0 | 52,660,176,888 | 2.78% | ||
mariuszkarowski | 0 | 4,660,389,518 | 10% | ||
obsesija | 0 | 507,957,271 | 1.85% | ||
informator | 0 | 517,022,447 | 5% | ||
tijntje | 0 | 1,005,160,970 | 4.64% | ||
taldor | 0 | 611,331,025 | 2.78% | ||
saboin | 0 | 31,699,269,458 | 3.08% | ||
romeskie | 0 | 78,809,300,264 | 20% | ||
coloneljethro | 0 | 2,267,067,554 | 4.64% | ||
gwilberiol | 0 | 17,762,021,433 | 8.35% | ||
ntowl | 0 | 515,328,756 | 10% | ||
enforcer48 | 0 | 113,788,445,918 | 15% | ||
jemzem | 0 | 6,199,383,159 | 80% | ||
bdmillergallery | 0 | 41,374,899,558 | 5% | ||
insaneworks | 0 | 7,094,616,038 | 5% | ||
manuelgil64 | 0 | 724,622,161 | 4.64% | ||
remotehorst23 | 0 | 5,558,567,536 | 9.28% | ||
aulia1993 | 0 | 973,596,273 | 3.08% | ||
cmplxty | 0 | 46,857,392,104 | 6.96% | ||
lifeskills-tv | 0 | 623,080,128 | 4.64% | ||
smartvote | 0 | 85,119,693,418 | 4% | ||
voxmortis | 0 | 1,648,154,446 | 0.92% | ||
thelittlebank | 0 | 16,372,327,786 | 4.64% | ||
pboulet | 0 | 557,309,466 | 0.7% | ||
admiralbot | 0 | 6,198,191,378 | 100% | ||
macoolette | 0 | 3,117,574,577 | 2.78% | ||
harpreetjanda | 0 | 545,025,716 | 2% | ||
thevil | 0 | 44,889,680,915 | 4.64% | ||
milky-concrete | 0 | 5,463,327,158 | 4.64% | ||
adalger | 0 | 7,822,835,578 | 0.92% | ||
robmojo | 0 | 2,148,316,742 | 2.78% | ||
shainemata | 0 | 531,455,974 | 1% | ||
ctime | 0 | 95,500,120,793 | 2.5% | ||
limka | 0 | 63,260,722 | 71.55% | ||
memehub | 0 | 86,794,204,704 | 100% | ||
epicdice | 0 | 2,910,367,566 | 2.78% | ||
aninsidejob | 0 | 6,424,129,559 | 100% | ||
gurseerat | 0 | 771,914,991 | 2% | ||
ssiena | 0 | 1,596,888,693 | 6.96% | ||
stemgeeks | 0 | 40,685,232,042 | 40% | ||
stemcuration | 0 | 729,121,941 | 40% | ||
babytarazkp | 0 | 3,527,314,181 | 40% | ||
abh12345.stem | 0 | 659,829,193 | 20% | ||
curangel | 0 | 6,572,346,435,361 | 9.28% | ||
mister.reatard | 0 | 605,331,981 | 4.64% | ||
yggdrasil.laguna | 0 | 141,330,709 | 20% | ||
dpend.active | 0 | 1,817,681,363 | 1.85% | ||
stuntman.mike | 0 | 1,860,170,385 | 20% | ||
fengchao | 0 | 4,749,917,475 | 2% | ||
hivewatchers | 0 | 201,749,625,844 | 55% | ||
laruche | 0 | 32,704,885,388 | 0.7% | ||
hivephilippines | 0 | 99,673,394,302 | 25% | ||
thepeakstudio | 0 | 4,057,342,316 | 100% | ||
shimozurdogames | 0 | 1,106,422,166 | 4.64% | ||
jwynqc | 0 | 16,523,028,127 | 100% | ||
kingfadino | 0 | 50,682,202,501 | 50% | ||
notak | 0 | 729,078,708,345 | 51.3% | ||
artistparthoroy | 0 | 45,274,658,779 | 100% | ||
rosilys20 | 0 | 530,782,495 | 4.64% | ||
jonalyn2020 | 0 | 692,657,809 | 10% | ||
altleft | 0 | 193,086,647,340 | 0.46% | ||
dorkpower | 0 | 614,516,354 | 20% | ||
wannderingsoul | 0 | 775,279,148 | 100% | ||
paolazun | 0 | 529,587,292 | 4.64% | ||
stemcur | 0 | 687,429,558 | 100% | ||
brofund-stem | 0 | 710,760,005 | 20% | ||
meritocracy | 0 | 521,506,177,651 | 4.64% | ||
rupinder | 0 | 138,675,260 | 2% | ||
stemline | 0 | 2,478,372,387 | 20% | ||
mundo.curioso | 0 | 383,175,536 | 100% | ||
krishu.stem | 0 | 720,272,596 | 100% | ||
tfranzini | 0 | 3,989,511,842 | 32% | ||
scholaris.stem | 0 | 1,702,875,000 | 100% | ||
robvector | 0 | 6,245,966,650 | 4.64% | ||
mrhoofman | 0 | 2,493,488,945 | 2.32% | ||
janettbrito76 | 0 | 596,283,206 | 1.85% | ||
holovision.stem | 0 | 86,035,012 | 50% | ||
lxsxl | 0 | 3,559,290,410 | 4.64% | ||
carminasalazarte | 0 | 1,355,206,831 | 9.28% | ||
star.stem | 0 | 1,580,998,534 | 50% | ||
wilfredocav | 0 | 2,006,371,437 | 9.28% | ||
migka | 0 | 2,514,972,837 | 100% | ||
saboin.stem | 0 | 254,661,917 | 40% | ||
bearbear.stem | 0 | 219,330,682 | 100% |