<jupyter_start><jupyter_text>Data Science Mathematics Session 1 - Introduction In-Class Activity Read the documentation on the Python math library:https://docs.python.org/3.6/library/math.htmlAnswer each question below. 1) Import the math library.<jupyter_code>import math<jupyter_output><empty_output><jupyter_text>Calculate the following, using the apppropriate Python functions: 2) EXP(100)<jupyter_code># using math exp method
answer_exp = math.exp(100)
print( answer_exp )<jupyter_output>2.6881171418161356e+43<jupyter_text>3) 5!<jupyter_code>answer_fact = math.factorial(5)
print( answer_fact )<jupyter_output>120<jupyter_text>4) ln(0.5)<jupyter_code>answer_ln = math.log(0.5)
print( answer_ln )<jupyter_output>-0.6931471805599453<jupyter_text>5) log(0.5) Note: this is log base 10.<jupyter_code>answer_log = math.log(0.5, 10)
print( answer_log )<jupyter_output>-0.30102999566398114<jupyter_text>6) sqrt(121)<jupyter_code>answer_sqrt = math.sqrt(121)
print( answer_sqrt )<jupyter_output>11.0<jupyter_text>The print function is used to print a result.Example:print('Hello world!')>Hello world7) Print the value of the mathematical constant pi to the maximal precision allowed in Python.<jupyter_code>print( math.pi )<jupyter_output>3.141592653589793
{'fraction_non_alphanumeric': 0.10925039872408293, 'fraction_numerical': 0.08931419457735247, 'mean_word_length': 8.227941176470589, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 24, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '629202', 'license': 'MIT', 'n_tokens_mistral': 529, 'n_tokens_neox': 461, 'n_words': 97, 'path': 'Data_Science_Mathematics_Session_1.ipynb', 'repo_name': 'skunktail/mathematics', 'size': '1254'}