3.14 & 3.15 Hacks
Procedure to help with my assignments
a. What is the derivative of 2x^5 - 6x^2 + 24x?
import numpy as np
# defining polynomial function
var = np.poly1d([2, 0, 0, 6, 24, 0])
print("Polynomial function, f(x):\n", var)
# calculating the derivative
derivative = var.deriv()
print("Derivative, f(x)'=\n", derivative)
# calculates the derivative of after
# given value of x
print("When x=9 f(x)'=", derivative(9))
b. What is the derivative of (13x^4 + 4x^2) / 2 when x = 9?
import numpy as np
# defining polynomial function
var = np.poly1d([13, 0, 4, 0, 0])/2
print("Polynomial function, f(x):\n", var)
# calculating the derivative
derivative = var.deriv()
print("Derivative, f(x)'=\n", derivative)
# calculates the derivative of after
# given value of x
print("When x=9 f(x)'=", derivative(9))
import random
dogs = ["Fido", "Rufus", "Spot", "Buddy", "Max", "Charlie", "Rocky", "Molly", "Roxy", "Tucker"]
cats = ["Fluffy", "Whiskers", "Mittens", "Socks", "Oliver", "Smokey", "Boots", "Lucy", "Princess", "Simba"]
random.shuffle(dogs)
random.shuffle(cats)
print(dogs)
print(cats)