|
68 | 68 | },
|
69 | 69 | {
|
70 | 70 | "cell_type": "code",
|
71 |
| - "execution_count": null, |
| 71 | + "execution_count": 1, |
72 | 72 | "metadata": {},
|
73 |
| - "outputs": [], |
| 73 | + "outputs": [ |
| 74 | + { |
| 75 | + "name": "stdout", |
| 76 | + "output_type": "stream", |
| 77 | + "text": [ |
| 78 | + "pi is 3.141592653589793\n", |
| 79 | + "cos(pi) is -1.0\n" |
| 80 | + ] |
| 81 | + } |
| 82 | + ], |
74 | 83 | "source": [
|
75 | 84 | "import math\n",
|
76 | 85 | "\n",
|
|
89 | 98 | },
|
90 | 99 | {
|
91 | 100 | "cell_type": "code",
|
92 |
| - "execution_count": null, |
| 101 | + "execution_count": 2, |
93 | 102 | "metadata": {},
|
94 |
| - "outputs": [], |
| 103 | + "outputs": [ |
| 104 | + { |
| 105 | + "name": "stdout", |
| 106 | + "output_type": "stream", |
| 107 | + "text": [ |
| 108 | + "Help on module math:\n", |
| 109 | + "\n", |
| 110 | + "NAME\n", |
| 111 | + " math\n", |
| 112 | + "\n", |
| 113 | + "MODULE REFERENCE\n", |
| 114 | + " https://docs.python.org/3.7/library/math\n", |
| 115 | + " \n", |
| 116 | + " The following documentation is automatically generated from the Python\n", |
| 117 | + " source files. It may be incomplete, incorrect or include features that\n", |
| 118 | + " are considered implementation detail and may vary between Python\n", |
| 119 | + " implementations. When in doubt, consult the module reference at the\n", |
| 120 | + " location listed above.\n", |
| 121 | + "\n", |
| 122 | + "DESCRIPTION\n", |
| 123 | + " This module provides access to the mathematical functions\n", |
| 124 | + " defined by the C standard.\n", |
| 125 | + "\n", |
| 126 | + "FUNCTIONS\n", |
| 127 | + " acos(x, /)\n", |
| 128 | + " Return the arc cosine (measured in radians) of x.\n", |
| 129 | + " \n", |
| 130 | + " acosh(x, /)\n", |
| 131 | + " Return the inverse hyperbolic cosine of x.\n", |
| 132 | + " \n", |
| 133 | + " asin(x, /)\n", |
| 134 | + " Return the arc sine (measured in radians) of x.\n", |
| 135 | + " \n", |
| 136 | + " asinh(x, /)\n", |
| 137 | + " Return the inverse hyperbolic sine of x.\n", |
| 138 | + " \n", |
| 139 | + " atan(x, /)\n", |
| 140 | + " Return the arc tangent (measured in radians) of x.\n", |
| 141 | + " \n", |
| 142 | + " atan2(y, x, /)\n", |
| 143 | + " Return the arc tangent (measured in radians) of y/x.\n", |
| 144 | + " \n", |
| 145 | + " Unlike atan(y/x), the signs of both x and y are considered.\n", |
| 146 | + " \n", |
| 147 | + " atanh(x, /)\n", |
| 148 | + " Return the inverse hyperbolic tangent of x.\n", |
| 149 | + " \n", |
| 150 | + " ceil(x, /)\n", |
| 151 | + " Return the ceiling of x as an Integral.\n", |
| 152 | + " \n", |
| 153 | + " This is the smallest integer >= x.\n", |
| 154 | + " \n", |
| 155 | + " copysign(x, y, /)\n", |
| 156 | + " Return a float with the magnitude (absolute value) of x but the sign of y.\n", |
| 157 | + " \n", |
| 158 | + " On platforms that support signed zeros, copysign(1.0, -0.0)\n", |
| 159 | + " returns -1.0.\n", |
| 160 | + " \n", |
| 161 | + " cos(x, /)\n", |
| 162 | + " Return the cosine of x (measured in radians).\n", |
| 163 | + " \n", |
| 164 | + " cosh(x, /)\n", |
| 165 | + " Return the hyperbolic cosine of x.\n", |
| 166 | + " \n", |
| 167 | + " degrees(x, /)\n", |
| 168 | + " Convert angle x from radians to degrees.\n", |
| 169 | + " \n", |
| 170 | + " erf(x, /)\n", |
| 171 | + " Error function at x.\n", |
| 172 | + " \n", |
| 173 | + " erfc(x, /)\n", |
| 174 | + " Complementary error function at x.\n", |
| 175 | + " \n", |
| 176 | + " exp(x, /)\n", |
| 177 | + " Return e raised to the power of x.\n", |
| 178 | + " \n", |
| 179 | + " expm1(x, /)\n", |
| 180 | + " Return exp(x)-1.\n", |
| 181 | + " \n", |
| 182 | + " This function avoids the loss of precision involved in the direct evaluation of exp(x)-1 for small x.\n", |
| 183 | + " \n", |
| 184 | + " fabs(x, /)\n", |
| 185 | + " Return the absolute value of the float x.\n", |
| 186 | + " \n", |
| 187 | + " factorial(x, /)\n", |
| 188 | + " Find x!.\n", |
| 189 | + " \n", |
| 190 | + " Raise a ValueError if x is negative or non-integral.\n", |
| 191 | + " \n", |
| 192 | + " floor(x, /)\n", |
| 193 | + " Return the floor of x as an Integral.\n", |
| 194 | + " \n", |
| 195 | + " This is the largest integer <= x.\n", |
| 196 | + " \n", |
| 197 | + " fmod(x, y, /)\n", |
| 198 | + " Return fmod(x, y), according to platform C.\n", |
| 199 | + " \n", |
| 200 | + " x % y may differ.\n", |
| 201 | + " \n", |
| 202 | + " frexp(x, /)\n", |
| 203 | + " Return the mantissa and exponent of x, as pair (m, e).\n", |
| 204 | + " \n", |
| 205 | + " m is a float and e is an int, such that x = m * 2.**e.\n", |
| 206 | + " If x is 0, m and e are both 0. Else 0.5 <= abs(m) < 1.0.\n", |
| 207 | + " \n", |
| 208 | + " fsum(seq, /)\n", |
| 209 | + " Return an accurate floating point sum of values in the iterable seq.\n", |
| 210 | + " \n", |
| 211 | + " Assumes IEEE-754 floating point arithmetic.\n", |
| 212 | + " \n", |
| 213 | + " gamma(x, /)\n", |
| 214 | + " Gamma function at x.\n", |
| 215 | + " \n", |
| 216 | + " gcd(x, y, /)\n", |
| 217 | + " greatest common divisor of x and y\n", |
| 218 | + " \n", |
| 219 | + " hypot(x, y, /)\n", |
| 220 | + " Return the Euclidean distance, sqrt(x*x + y*y).\n", |
| 221 | + " \n", |
| 222 | + " isclose(a, b, *, rel_tol=1e-09, abs_tol=0.0)\n", |
| 223 | + " Determine whether two floating point numbers are close in value.\n", |
| 224 | + " \n", |
| 225 | + " rel_tol\n", |
| 226 | + " maximum difference for being considered \"close\", relative to the\n", |
| 227 | + " magnitude of the input values\n", |
| 228 | + " abs_tol\n", |
| 229 | + " maximum difference for being considered \"close\", regardless of the\n", |
| 230 | + " magnitude of the input values\n", |
| 231 | + " \n", |
| 232 | + " Return True if a is close in value to b, and False otherwise.\n", |
| 233 | + " \n", |
| 234 | + " For the values to be considered close, the difference between them\n", |
| 235 | + " must be smaller than at least one of the tolerances.\n", |
| 236 | + " \n", |
| 237 | + " -inf, inf and NaN behave similarly to the IEEE 754 Standard. That\n", |
| 238 | + " is, NaN is not close to anything, even itself. inf and -inf are\n", |
| 239 | + " only close to themselves.\n", |
| 240 | + " \n", |
| 241 | + " isfinite(x, /)\n", |
| 242 | + " Return True if x is neither an infinity nor a NaN, and False otherwise.\n", |
| 243 | + " \n", |
| 244 | + " isinf(x, /)\n", |
| 245 | + " Return True if x is a positive or negative infinity, and False otherwise.\n", |
| 246 | + " \n", |
| 247 | + " isnan(x, /)\n", |
| 248 | + " Return True if x is a NaN (not a number), and False otherwise.\n", |
| 249 | + " \n", |
| 250 | + " ldexp(x, i, /)\n", |
| 251 | + " Return x * (2**i).\n", |
| 252 | + " \n", |
| 253 | + " This is essentially the inverse of frexp().\n", |
| 254 | + " \n", |
| 255 | + " lgamma(x, /)\n", |
| 256 | + " Natural logarithm of absolute value of Gamma function at x.\n", |
| 257 | + " \n", |
| 258 | + " log(...)\n", |
| 259 | + " log(x, [base=math.e])\n", |
| 260 | + " Return the logarithm of x to the given base.\n", |
| 261 | + " \n", |
| 262 | + " If the base not specified, returns the natural logarithm (base e) of x.\n", |
| 263 | + " \n", |
| 264 | + " log10(x, /)\n", |
| 265 | + " Return the base 10 logarithm of x.\n", |
| 266 | + " \n", |
| 267 | + " log1p(x, /)\n", |
| 268 | + " Return the natural logarithm of 1+x (base e).\n", |
| 269 | + " \n", |
| 270 | + " The result is computed in a way which is accurate for x near zero.\n", |
| 271 | + " \n", |
| 272 | + " log2(x, /)\n", |
| 273 | + " Return the base 2 logarithm of x.\n", |
| 274 | + " \n", |
| 275 | + " modf(x, /)\n", |
| 276 | + " Return the fractional and integer parts of x.\n", |
| 277 | + " \n", |
| 278 | + " Both results carry the sign of x and are floats.\n", |
| 279 | + " \n", |
| 280 | + " pow(x, y, /)\n", |
| 281 | + " Return x**y (x to the power of y).\n", |
| 282 | + " \n", |
| 283 | + " radians(x, /)\n", |
| 284 | + " Convert angle x from degrees to radians.\n", |
| 285 | + " \n", |
| 286 | + " remainder(x, y, /)\n", |
| 287 | + " Difference between x and the closest integer multiple of y.\n", |
| 288 | + " \n", |
| 289 | + " Return x - n*y where n*y is the closest integer multiple of y.\n", |
| 290 | + " In the case where x is exactly halfway between two multiples of\n", |
| 291 | + " y, the nearest even value of n is used. The result is always exact.\n", |
| 292 | + " \n", |
| 293 | + " sin(x, /)\n", |
| 294 | + " Return the sine of x (measured in radians).\n", |
| 295 | + " \n", |
| 296 | + " sinh(x, /)\n", |
| 297 | + " Return the hyperbolic sine of x.\n", |
| 298 | + " \n", |
| 299 | + " sqrt(x, /)\n", |
| 300 | + " Return the square root of x.\n", |
| 301 | + " \n", |
| 302 | + " tan(x, /)\n", |
| 303 | + " Return the tangent of x (measured in radians).\n", |
| 304 | + " \n", |
| 305 | + " tanh(x, /)\n", |
| 306 | + " Return the hyperbolic tangent of x.\n", |
| 307 | + " \n", |
| 308 | + " trunc(x, /)\n", |
| 309 | + " Truncates the Real x to the nearest Integral toward 0.\n", |
| 310 | + " \n", |
| 311 | + " Uses the __trunc__ magic method.\n", |
| 312 | + "\n", |
| 313 | + "DATA\n", |
| 314 | + " e = 2.718281828459045\n", |
| 315 | + " inf = inf\n", |
| 316 | + " nan = nan\n", |
| 317 | + " pi = 3.141592653589793\n", |
| 318 | + " tau = 6.283185307179586\n", |
| 319 | + "\n", |
| 320 | + "FILE\n", |
| 321 | + " /Users/emilygrabowski/opt/anaconda3/lib/python3.7/lib-dynload/math.cpython-37m-darwin.so\n", |
| 322 | + "\n", |
| 323 | + "\n" |
| 324 | + ] |
| 325 | + } |
| 326 | + ], |
95 | 327 | "source": [
|
96 | 328 | "help(math)"
|
97 | 329 | ]
|
|
132 | 364 | },
|
133 | 365 | {
|
134 | 366 | "cell_type": "code",
|
135 |
| - "execution_count": null, |
| 367 | + "execution_count": 3, |
136 | 368 | "metadata": {},
|
137 |
| - "outputs": [], |
| 369 | + "outputs": [ |
| 370 | + { |
| 371 | + "name": "stdout", |
| 372 | + "output_type": "stream", |
| 373 | + "text": [ |
| 374 | + "3.141592653589793\n" |
| 375 | + ] |
| 376 | + } |
| 377 | + ], |
138 | 378 | "source": [
|
139 | 379 | "from math import *\n",
|
140 | 380 | "print(pi)"
|
|
202 | 442 | "* `pandas` -> `pd`\n",
|
203 | 443 | "* `numpy` -> `np`\n",
|
204 | 444 | "* `matplotlib` -> `mpl`.\n",
|
| 445 | + "* `statsmodels.api` -> `sm`\n", |
205 | 446 | "\n",
|
206 | 447 | "But sometimes aliases can make programs harder to understand, since readers must learn your program's aliases. Be very intentional about using aliases!"
|
207 | 448 | ]
|
|
221 | 462 | },
|
222 | 463 | {
|
223 | 464 | "cell_type": "code",
|
224 |
| - "execution_count": null, |
| 465 | + "execution_count": 4, |
225 | 466 | "metadata": {},
|
226 | 467 | "outputs": [],
|
227 | 468 | "source": [
|
|
240 | 481 | ],
|
241 | 482 | "metadata": {
|
242 | 483 | "kernelspec": {
|
243 |
| - "display_name": "Python 3 (ipykernel)", |
| 484 | + "display_name": "Python 3", |
244 | 485 | "language": "python",
|
245 | 486 | "name": "python3"
|
246 | 487 | },
|
|
254 | 495 | "name": "python",
|
255 | 496 | "nbconvert_exporter": "python",
|
256 | 497 | "pygments_lexer": "ipython3",
|
257 |
| - "version": "3.8.12" |
| 498 | + "version": "3.7.6" |
258 | 499 | },
|
259 | 500 | "toc": {
|
260 | 501 | "base_numbering": 1,
|
|
0 commit comments