exercises exercise fit sines to straight line lot of technologyespecially most types of digital audio devices for processing soundis based on representing signal of time as sum of sine functions say the signal is some function ton the interval oe( more general interval oeabcan easily be treatedbut leads to slightly more complicated formulasinstead of working with tdirectlywe approximate by the sum sn td bn sin nt/( nd where the coefficients bn must be adjusted such that sn tis good approximation to twe shall in this exercise adjust bn by trial-and-error process amake function sinesum(tbthat returns sn /given the coefficients bn in an array and time coordinates in an array note that if is an arraythe return value is also an array bwrite function test_sinesum(that calls sinesum(tbin aand determines if the function computes test case correctly as test caselet be an array with values = and = choose and and compute sn tby hand to get reference values cmake function plot_compare(fnmthat plots the original function ttogether with the sum of sines sn /so that the quality of the approximation sn tcan be examined visually the argument is python function implementing / is the number of terms in the sum sn /and is the number of uniformly distributed coordinates used to plot and sn dwrite function error(bfmthat returns mathematical measure of the error in sn tas an approximation to /ed sx ti sn ti // where the ti values are uniformly distributed coordinates on oethe array holds the coefficients in sn and is python function implementing the mathematical function temake function trial(fnfor interactively giving bn values and getting plot on the screen where the resulting sn tis plotted together with tthe error in the approximation should also be computed as indicated in dthe argument is python function for tand is the number of terms in the sum sn tthe trial function can run loop where the user is asked for the bn values in each pass of the loop and the corresponding plot is shown you must find way to terminate the loop when the experiments are over use = in the calls to plot_compare and error hint to make this part of your program workyou may have to insert from matplotlib pylab import at the top and also add show(after the plot command in the loop