Develop a quadrature method for computing

Assignment Help MATLAB Programming
Reference no: EM132210171

In this assignment, we develop a quadrature method for computing -11 g(x) √(1 - x2)dx for a given g : [-1, 1] → R. You can use the built-in routines to compare your results and compute errors for use in §B.

A1. Show that p0(x) = 1 and p1(x) = 2x . By using a trigonometric identity, show that

pn(x) = 2xpn-1(x) - pn-2(x), n = 2, 3, .....

Hence, show that pn(x) is a polynomial of degree n and that p0,......, pn form a basis for pn.

A2. Let x1, ......., xn denote the roots of pn(x) . Show that the matrix

1810_Matrix.jpg

is non-singular. Hence, show that there exist w1, ..... wn, such that

147_figure.jpg

HINT: Suppose that there exists a c 2 Rn such that c TJn = 0 .

A3. By making a substitution, show that

-11 pn(x)pm(x)√(1 - x2)dx = 0, n ≠ m

A4. By using the basis {p0, .....}, for pn for pn and A3, prove that

-11 p(x)√(1 - x2)dx = Σi=1n p(xi)wi,  ∀p∈pn,

for the xi and wi defined above.

Now show that the relationship also holds for p∈p2n-1 to show the quadrature rule has degree of precision at least 2n - 1 and hence is a Gaussian quadrature rule.

A5. Let q0(x) := 1 and qn(x) := 2ndet(xl - An) for n = 1, 2, : : : , where An is the n × n matrix

237_Matrix.jpg

Show that qn = pn for n = 1, 2, : : : .

Hence, show that eigenvalues of An equal the quadrature nodes xi.

A6. Denote the ith column of Jn (from A2) by

vi = [p0(xi), p1(xi),........pn-1(xi)]T , i = 1.....n

Show that vi is an eigenvector of An corresponding to the eigenvalue xi. Hence, show that the quadrature weight

wi = A.(1/||vi||2) (vi1)2 , A :=  -11√(1 - x2)dx = 1/2Π

where v1i  is the first component of the ith eigenvector vi.

B Computing

B1. Write a MATLAB code to compute the quadrature nodes x1, ....... , xn and weights w1, ....., wn for the quadrature rule developed in §A.

Fill in
function [x,w]=getquad(n)%
% Return a vector of quadrature nodes x and weights w,
% of dimension n.
% ....

B2. Write a routine to evaluate the quadrature for a given function g . Fill in function out=myquad(g,x,w)%
% Evaluate sum_{i=1,...,n} w_i g(x_i)
assert (length(x)==length(w)) % error checking
%...
%...
out= % give return value

It should run with the call
myquad(@(x) x,x,w)
to evaluate -11x√(1 - x2)dx. Verify the degree of precision is 2n - 1 for n = 10 (using MATLAB).

B3. Use the built-in MATLAB routines to find reference values for

-11g(x)√(1 - x2)dx

in the case g1(x) = exp(x) and g2(x) = x sin(x) . We use these values in the next question to evaluate error. Note down the number of function evaluations, when using quad.

B4. Using the quadrature method developed in B2., evaluate

-11gi(x)√(1 - x2)dx,  for  i = 1,2

Give a plot of the error against n , taking care to use an appropriate range of n and plot (e.g., loglog vs plot vs semilogx etc).

Compare the number of function evaluations used by the MATLAB routine quad and the method of B2.

Reference no: EM132210171

Questions Cloud

Build and run your program on lauchpad : On Timer 1 interrupt, sample data from PD0, then output the same data to DAC through SSI0 (through which to the DAC chip).
What was dettwyler interaction like with agnes : Discuss the practice of female circumcision in Mali. What was Dettwyler's interaction like with Agnes? What are some of the reasons given for the practice.
How bullying experienced by one adolescent may change : Post a scenario that illustrates how bullying experienced by one adolescent may change the experience of another who witnesses it.
Define personal and professional social work values : Heterosexism is defined as "the discrimination or prejudice by heterosexuals against homosexuals" (merriam-webster.com) and is predicated on the belief.
Develop a quadrature method for computing : Develop a quadrature method for computing -1?1 g(x) v(1 - x2)dx for a given g : [-1, 1] ? R. You can use the built-in routines to compare your results
How a professional can proactively approach career changes : Explain how professional etiquette impacts workplace relationships. Explain how a professional can proactively approach career changes.
Discuss about the dysfunctional behaviors : Identify and discuss two to three dysfunctional behaviors that can result from intergenerational abuse. Keeping in mind the need to protect the welfare.
Discuss how social media has impacted your identity : According to the film, "the consumer is now the marketer". What does this mean? Please provide some examples. Is this a change from how advertising.
Write a program that estimates the temperature in a freezer : Write a program that estimates the temperature in a freezer in C degrees given the elapse time in hours since a power failure.

Reviews

Write a Review

MATLAB Programming Questions & Answers

  Finite difference method

Use the finite difference method to calculate the temperature at the point specified since it is easier.

  Determine the necessary shell temperature

In a shell-and-tube heat exchanger, one fluid passes through a central tube while another fluid flows through an outer shell in the opposite direction. The purpose is to heat the fluid passing through the central tube.

  Find the integral of a function at an arbitrary location

Write a Matlab function to perform numerical integration of a set of evenly spaced data points using the trapezoidal rule

  Compute the speed of single-stage planetary gear train

Write a MATLAB function [speed] = planetary (N, emesh, first, last, arm) that computes the speed of a given link in a single-stage planetary gear train.

  Calculate and plot the error in the numerical derivative

Write a program to calculate and plot the error in the numerical estimate of the derivative.

  Create the graph using matlab functions

Create the graph, which contains a piecewise function where a line exists in the first interval, a parabola in the second interval, and the sine function in the third interval.

  Develop a simulation program

Develop a simulation program

  Create a vector in matlab

Create a three dimensional diagram of function.

  Open a named pipe and to read data from the pipe

Open a named pipe and to read data from the pipe in matlab

  Write the commands that will create the matrix

Write the commands that will create the matrix.

  Lagrange interpolating polynomial of degree

Lagrange interpolating polynomial of degree

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd