Python assignment作业代写，计算机作业高分包过！

1. Write a Python program script to compute f(x) and f’(x) for the given decaying sine function on the domain interval x∈[0,6π] , where a = 0.25, and b = 1. Use arrays and NumPy functions to do the calculations.
• The program will write a comma separated values (CSV) data file with three columns of comma separated data consisting of the domain values, function values, and the derivative values: x, f(x), and f’(x) respectively. File extension is csv. You may use savetxt from numpy.
• Use scientific notation when writing your floating point values into the data file: as in %16.8e rather than %16.8f.
• Use 201 equally spaced data points on the specified domain interval x∈[0,6π].
• Use NumPy to compute the function values; use the supplied num_deriv UDF (user defined function) to compute the first derivative.

``````该程序将写一个逗号分隔值（CSV）数据文件，其中有三列逗号分隔的数据，分别是域值、函数值和导数值：x、f(x)和f'(x)。文件扩展名是csv。你可以使用numpy的savetxt。

NumPy有创建和操作数组的函数。使用NumPy来计算函数值；使用提供的num_deriv UDF（用户定义的函数）来计算一阶导数。``````

2. Write a Python script to read the data file from the previous problem.

• Read the data values from the file into three NumPy arrays. You may use loadtxt from numpy and array slicing.
• Plot the function and its derivative. Use different colors for each function curve.
• this plot title: f(x) = exp(-0.25*x)*sin(x) and f’(x)
• Include a legend labeling the color for f(x) and f’(x).
• Label the horizontal axis as the Time.
• ·    Label the vertical axis as the Amplitude.

• 绘制函数和它的导数。对每个函数曲线使用不同的颜色。
• 提供这个绘图标题：f(x)=exp(-0.25x)sin(x)和f'(x)
• 包括一个图例，标注f(x)和f'(x)的颜色。
• 将横轴标记为时间。
• 在纵轴上标明振幅。

4. Write a Python program script to:

• Read all the data generated for the Gaussian Normal distribution into NumPy arrays.
• plot the domain and f(x), f’(x), and f”(x).
• Annotate the plot with a title, legend, and labels for both the vertical and horizontal axes. Label the vertical axis as the Range, and the Horizontal axis as the Domain.

5. Modify the previous program to make three separate Figures for the: (1) function, (2) derivative, and (3) 2nd derivative. Label the plots and axes. For example, plt.figure(1) creates a new figure 1.

6. Submit your plots, script and data files to Harvey-Blackboard for grading. PDF screenshots are acceptable for plots.

``````# Add this UDF to the beginning of your code
import numpy as np

def num_deriv(yvec,dx):
# input: array of y values on domain of uniformly spaced points
# input: dx spacing between x domain point
# return: array of numerical first derivative values
npts = len(yvec)
ypr = np.zeros(xvec.shape)       # intialize all 0
ypr[0] = (yvec[1]-yvec[0])/dx    # ypr of leftmost point, forward deriv

for i in range(1,npts-1):        # ypr of middle points, central deriv
ypr[i]=(yvec[i+1] - yvec[i-1])/(2*dx)

ypr[-1]= (yvec[-1]-yvec[-2])/dx  # ypr of rightmost point, backwards deriv

return(ypr)
``````

Recent Case

盘点留学生常用5 种最佳笔记方法，哪一种适合您

SCI期刊论文的发表过程是一项复杂而细致的工作，涉

轻松掌握万能Essay模板，撰写一篇合格的英文论文

Python可谓是当下最火的编程语言，同时，Pyt