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.

编写一个Python程序脚本,计算域间x∈[0,6π]上给定的衰减正弦函数的f(x)和f'(x),其中a = 0.25,b = 1。使用数组和NumPy函数来进行计算。

该程序将写一个逗号分隔值(CSV)数据文件,其中有三列逗号分隔的数据,分别是域值、函数值和导数值:x、f(x)和f'(x)。文件扩展名是csv。你可以使用numpy的savetxt。 
在将你的浮点值写入数据文件时,使用科学符号:如%16.8e而不是%16.8f。
在指定的域区间x∈[0,6π]上使用201个等间距的数据点。 
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.
Young caucasian female programmer in glasses writes program code on a laptop computer. home office. High quality photo

编写一个Python脚本来读取前面问题中的数据文件。

  • 将文件中的数据值读入三个NumPy数组。你可以使用numpy的loadtxt和数组切分法。
  • 绘制函数和它的导数。对每个函数曲线使用不同的颜色。
  • 提供这个绘图标题: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)  

contact

Assignment Exmaple

Recent Case

Service Scope

C|C++|Java|Python|Matlab|Android|Jsp|Prolo
g|MIPS|Haskell|R|Linux|C#|PHP|SQL|.Net|Hand
oop|Processing|JS|Ruby|Scala|Rust|Data Mining|数据库|Oracle|Mysql|Sqlite|IOS|Data Mining|网络编程|多线程编程|Linux编程操作系统|计算机网络|留学生|编程|程序|代写|加急|个人代写|作业代写|Assignment

Wechat:maxxuezhang

wechat