首页 > > 详细

辅导 AM2060 Final Assignment 2024讲解 Prolog

AM2060 Final Assignment 2024

November 17, 2024

In this assignment you are required to produce C# code which solves a nonlinear boundary value problem.

Problem A

y'' = −(y0 ) 2 − y − ln x, for 1 ≤ x ≤ 2, where, y(1) = 0 and y(2) = ln 2.

Exact solution is y = ln x.

Problem B

y'' = y3 − yy', for 1 x 2, where, y(1) = 2/1 and y(2) = 3/1.

Exact solution is y = x+1/1.

Problem C

y'' = 2y3 − 6y − 2x3 , for 1  x 2, where, y(1) = 2 and y(2) = 2/5.

Exact solution is y = x + x/1.

Instructions

1. Create a class BVP which numerically solves second order nonlinear boundary problems of the form. y'' = f(x, y, y'), with boundary conditions y(a) = α and y(b) = β, for a x b. Use Newton’s method to find s in the related initial value problem y'' = f(x, y, y'), with initial conditions y(a) = α and y' (a) = s such that y(b) = β.

2. Use the delegate mechanism to allow users to specify (1) the function f, (2) dy/df , (3) dy'/df and (4) the exact solution. Note: you may need more than one type of delegate.

3.  Allow the user to specify the boundary conditions i.e.  they can give values for a,b,α , β . Users can also specify the tolerance for Newtons method, the default values is 0.0001. This ends the algorithm when the diference between successive approximations is less than the tolerance. The user is also able to specify the number of intervals on a ≤ x ≤ b, default value 10.

4.  Use Euler’s method to solve any associated initial value problems.  Please implement the version which makes use of vectors.

5.  After the user has set up the problem, provide a method named Solve which computes and stores the solution in an array with elements ((x0 , y0 ) , (x1 , y1 ) , ··· , (xn, yn )), where n is the number of intervals.

6.  Provide a method named Error which outputs a nicely formatted table consisting of xi, yi,yexact, (yi  − yexact )2  for 0  ≤ i ≤ n and where yexact  is the exact solution corre- sponding to yi.

7.  Provide code in main which solves one of the above problems and demonstrates that your solution works.

8.  Marks are also awarded for:

(a)  Does the code do what it is supposed to do?

(b)  Is the code well presented and readable?

(c)  Is the output correct and nicely formatted?

(d)  Are typical error situations identified and handled?




联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!