Question: first one: def save_mass(file_path, mass): Given a valid file_path and a double precision floating point number, mass. Write the mass to a file in
first one: def save_mass(file_path, mass): """ Given a valid file_path and a double precision floating point number, mass. Write the mass to a file in little endian format. :param file_path: :return: Number of bytes written to file. """
2nd one: def numpy_time(x, amp, mean, sigma, c0, c1, c2): """ In this problem you will be asked to evaluate two functions using numpy. You will be given a numpy array x and six parameters that will be used to evaluate your two functions. First, given a numpy array x and amp, mean, and sigma for a gaussian distribution (AKA: Normal distribution/Bell curve). You will use the given x array as the x values for the gaussian functions. For reference see the note about gaussian distributions below. Second, given a numpy array x and coefficients c0, c1, and c2 the polynomial will follow this pattern: f2(x) = c0*x^0 + c1*x^1 + c2*x^2 You should return three numpy arrays of equal length to the input array x as a tuple. The three arrays should be as follows and in this order: -The gaussian function -polynomial f2(x) -The sum of the gaussian and polynomial functions Documentation: https://en.wikipedia.org/wiki/Gaussian_function (In the wiki version a=amplitude, b=mean, and c=sigma) Also, see the image in the README.md or the image located in the img folder: img/gaussian.png Note: Exponentials like e^x are really just like x^y where x is a constant number ~2.71828 In numpy there are useful functions like np.exp(x) which would be e^x. -https://docs.scipy.org/doc/numpy/reference/generated/numpy.exp.html In addition, you may find that it would be useful to use np.power() -https://docs.scipy.org/doc/numpy/reference/generated/numpy.power.html :param x: Numpy array of x values :param amp: a parameter for the gaussian function :param mean: a parameter for the gaussian function :param sigma: a parameter for the gaussian function :param c0: a parameter for the polynomial :param c1: a parameter for the polynomial :param c2: a parameter for the polynomial :return: tuple of three numpy arrays, the gaussian, polynomial, and the sum of the two. """
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
