You are on page 1of 4

MATH 2210 Mathematics Laboratory I

Assignment 10 Full marks: 29

Name:

Student No.:

Class:

Mark:

Instructions: 1. After you started MATLAB, you will automatically be in the directory H:\. Please enter >> diary only once to record all your work in H:\diary. No marks will be given if no diary is found. 2. Your results should be handwritten on this lab sheet. 3. Assignment should be handed in to the Lab Teaching Assistant in person before the end of your own lab session. Solutions will be posted onto the web right after the second lab session (i.e. after 6:30pm). Absolutely no late assignments will be accepted. 4. Please read and sign the following declaration before handing in your assignment. Otherwise, no marks will be given.

I declare that the assignment here submitted is original except for source material explicitly acknowledged. I also acknowledge that I am aware of University policy and regulations on honesty in academic work, and of the disciplinary guidelines and procedures applicable to breaches of such policy and regulations, as contained in the website http://www.cuhk.edu.hk/policy/academichonesty/

Signature

Date

MATH 2210 Mathematics Laboratory I

1. (12 Marks) Use MATLAB commands to do the following symbolic calculations. Please write down all the commands you use and also the results you get. (a) Write down the results of sqrt(2)2-2 and sym(sqrt(2))2-2. Explain the dierence. sqrt(2)^2-2: 4.4409e-016 sym(sqrt(2))^2-2: 0 sqrt(2)^2 is accurate to the tolerance of the machine precision. sym(sqrt(2))^2 is exactly accurate.

(b) Write down the results of 2525-sym(2525) and 2525-sym(2525). 25^25-sym(25^25): 0 25^25-sym(25^25): 6776596920136667815

(c) Find an expansion of tan( + ). syms alpha beta expand(tan(alpha+beta)) Result: -(tan(alpha) + tan(beta))/(tan(alpha)*tan(beta) - 1)

(d) Find the rst 20 digits of e, where e is the base of the natural logarithm. vpa(exp(1),20) Result: 2.7182818284590455349

(e) Find the simplest expression form of sin(x) cos(y ) cos(x) sin(y ). syms x y simple(sin(x)*cos(y)-cos(x)*sin(y)) Result: sin(x - y)

(f) Dene the polynomial


100

r=
i=0

i2 xi .

syms x; r=poly2sym([100:-1:0].^2,x)

MATH 2210 Mathematics Laboratory I

2. (4 Marks) Find the factor(s) of the polynomials xn y n where x, y are real numbers, n = 1, 2, , 8. You should dene the polynomials in a symbolic vector, without using any loop or inputting each polynomial explicitly. Write down the commands. And write down the result only for n = 6. syms x y factor(x.^(1:8)-y.^(1:8)) Result: n=6: (x - y)*(x + y)*(x^2 + x*y + y^2)*(x^2 - x*y + y^2)

3. (5 marks) Dene

f = (x2 + ey x3 y ) ( xy 2 + ey x)

Find f x, where f x is the function f with collected terms containing the variable x. Find f y where f y is the function f with collected terms containing the variable y . Find f ey where f ey is the function f with collected terms containing the variable ey . Write down the commands and the results. syms x y f=(x^2+exp(-y)*x^3-y)*(sqrt(x)*y^2+exp(-y)*x); fx=collect(f,x) fy=collect(f,y) fey=collect(f,exp(-y))

fx = x^4/exp(2*y) + (1/exp(y) + (x^(1/2)*y^2)/exp(y))*x^3 + (x^(1/2)*y^2)*x^2 + (-y/exp(y))*x - x^(1/2)*y^3

fy = (-x^(1/2))*y^3 + (x^(1/2)*(x^3/exp(y) + x^2))*y^2 + (-x/exp(y))*y + (x*(x^3/exp(y) + x^2))/exp(y)

fey = x^4/exp(2*y) + (x^(7/2)*y^2 - x*(- x^2 + y))/exp(y) - x^(1/2)*y^2*(- x^2 + y)

MATH 2210 Mathematics Laboratory I

4. (8 marks) Dene the polynomials p1 (x, y ) p2 (x, y ) = 12x4 y 3 + 2x3 y + 5x2 + 1 = 2x + y.

Let p(x, y ) = p1 (x, y ) p2 (x, y ). Do the following symbolic calculations with p, p1 , p2 . Expand p in powers in the variables. Assign this result to p3 . Find the value of p3 when x = 2, y = 3, by substituting the values of x, y into p3 . Assign the result to the variable pvalue. Show the value of pvalue to 10 digits of accuracy. Find the coecients of p3 , and their correspondences with the powers, with respect to y. Write down all the commands you used. And also the results. syms x y p1=12*x^4*y^3+2*x^3*y+5*x^2+1; p2=2*x+y; p=p1*p2; p3=expand(p) pvalue=subs(p3,{x,y},[2,3]) vpa(pvalue,10) [C,pw]=coeffs(p3,y)

Results: p3 = 24*x^5*y^3 + 12*x^4*y^4 + 4*x^4*y + 2*x^3*y^2 + 10*x^3 + 5*x^2*y + 2*x + y pvalue = 36771 ans = 36771.0 C = [

10*x^3+2*x, 5*x^2+1+4*x^4,

24*x^5,

12*x^4,

2*x^3]

pw = [ 1,

y, y^3, y^4, y^2]

MATH 2210 Mathematics Laboratory I

You might also like