Appendix B. Exercise Answers

Chapter 1

  1. 62.6738 is rational because it has a finite number of decimal places, and therefore can be expressed as a fraction 626738 / 10000.

  2. 10 7 10 -5 = 10 7+-5 = 10 2 = 100

  3. 81 1 2 = ( 81 ) = 9

  4. 25 3 2 = (25 1/2 ) 3 = 5 3 = 125

  5. The resulting amount would be $1,161.47. The Python script is as follows:

    from math import exp
    
    p = 1000
    r = .05
    t = 3
    n = 12
    
    a = p * (1 + (r/n))**(n * t)
    
    print(a) # prints 1161.4722313334678
  6. The resulting amount would be $1161.83. The Python script is as follows:

    from math import exp
    
    p = 1000 # principal, starting amount
    r = .05 # interest rate, by year
    t = 3.0 # time, number of years
    
    a = p * exp(r*t)
    
    print(a) # prints 1161.834242728283
  7. The derivative calculates to 6x, which would make the slope at x = 3 to be 18. The SymPy code is as follows:

    from sympy import *
    
    # Declare 'x' to SymPy
    x = symbols('x')
    
    # Now just use Python syntax to declare function
    f = 3*x**2 + 1
    
    # Calculate the derivative of the function
    dx_f = diff(f)
    print(dx_f) # prints 6*x
    print(dx_f.subs(x,3)) # 18
  8. The area under the curve between 0 and 2 is 10. The SymPy code is as follows:

    from sympy import *
    
    # Declare 'x' to SymPy
    x = symbols('x')
    
    # Now just use Python syntax to declare function
    f = 3*x**2 + 1
    
    # Calculate the integral of the function with respect to x
    # for the area between x = 0 and 2
    area = integrate(f, (x, 0, 2))
    
    print(area) # prints 10

Chapter 2

  1. 0.3 × 0.4 = 0.12; refer to “Joint Probabilities”

Get Essential Math for Data Science now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.