当前位置:天才代写 > 作业代写,留学生作业代写-北美、澳洲、英国等靠谱代写 > 数值分析课业代做 数值分析作业代写

数值分析课业代做 数值分析作业代写

2023-12-03 10:50 星期日 所属: 作业代写,留学生作业代写-北美、澳洲、英国等靠谱代写 浏览:109

Programming assignment #4

In this homework, we’ll explore implementing the sine function, y = sin(x).

 

数值分析课业代做
数值分析课业代做

 

  • Use the fact that sin and cos are 2π-periodic.
  • Note the simple relationships among the derivatives of sin and cos.
  • You should be able to divide [0, 2π] into at least 8 equal subintervals. Dividing it into fewer subintervals might be dangerous.
  • Although Method I and Method II (see WHW#4) will work for low degree, you will run into trouble for higher degrees. Use the method of interpolation based on Newton’s interpolating polynomial (this will require you to learn and use generalized divided differences).
  • To make this clear: first you determine which subinterval x belongs to, then you apply Newton interpolation over that that subinterval…

 

Problem 2.   数值分析课业代做

Make plots of the errors of your interpolants and explain their behavior (include an extra short file with a written explanation—do not answer in your Python file using comments). Do this for varying p (you must choose the range yourself). When you plot the error, it is recommended to plot the absolute relative error using a semilogy plot. This will give a sense of the order of accuracy over the interval [0, 2π].

(Hint: when you make these plots, use x = np.linspace(0, 2*np.pi, N) to get the x values. When you make the plots, keep increasing N until the plots are sufficiently sampled— that is, increasing N further should not visibly alter the plots.).

 

Bonus problem.

Let hp(x) be the piecewise Hermite interpolant programmed in Problem

1.When evaluating the error, it is also helpful to estimate quantity:

 

数值分析课业代做
数值分析课业代做

 

It might be a little unclear how to evaluate these norms using Python. In this problem, you will learn how to do so in order to evaluate (1) for L1 and L2 norms.

(Note: Evaluating ||f|| is simple for the function f(x) = sin(x), and can be done by hand. The challenging part is dealing with the numerator, ||hp f||.)

For ||g||1,[0,2π] and ||g||2,[0,2π] , consider the following idea:

  1. Use the composite trapezoid rule with equally spaced nodes to evaluate the integrals in (2) or (3).
  2. Do this for N + 1 nodes and 2N + 1 nodes, getting two different approximate values of ||hpf||/ ||f||, call them EN and E2N .
  3. Check the value of |ENE2N|. If it is close to machine precision (approximately 1015 for double precision), then declare victory and use the value of EN as your approximation.
  4. Otherwise, increase the value of N and try again (e.g., set N 2N and start over from Step 2).

This “meta-algorithm” will work fine for the composite trapezoid rule, but you are free to experiment with other choices of numerical integration.

 

 

更多代写:cs澳大利亚Final exam代考  雅思保分  英国管理学代写   Tourism Management旅游管理essay代写  澳洲文学(Literature)网课代修  计算机网络课业代做

合作平台:essay代写 论文代写 写手招聘 英国留学生代写

 

天才代写-代写联系方式