Homework 7 Bob

Homework 7 Bob - 28.1) > syms x > expand(x-2)^9) ans = x^9...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
28.1) >> syms x >> expand((x-2)^9) ans = x^9 - 18*x^8 + 144*x^7 - 672*x^6 + 2016*x^5 - 4032*x^4 + 5376*x^3 - 4608*x^2 + 2304*x - 512 >> clear >> f1 = inline('(x-2).^9','x') f1 = Inline function: f1(x) = (x-2).^9 >> x=1.92:.001:2.08; >> y1=f1(x); >> plot(x,y1,'blue') >> f2 = inline('x.^9 - 18.*x.^8 + 144.*x.^7 - 672.*x.^6 + 2016.*x.^5 - 4032.*x.^4 + 5376.*x.^3 - 4608.*x.^2 + 2304.*x - 512','x') f2 = Inline function: f2(x) = x.^9 - 18.*x.^8 + 144.*x.^7 - 672.*x.^6 + 2016.*x.^5 - 4032.*x.^4 + 5376.*x.^3 - 4608.*x.^2 + 2304.*x - 512 >> y2=f2(x); >> hold on >> plot(x,y2,'red') In theory the graphs should be the same however in practice errors arise as the topic of the chapter implies. A comparison of the output for y1 and y2 can be found in the lists on the following pages. Y1 is in the left column and y2 is in the right. An examination of the two columns will indicate that y1 follows a smooth progression while y2 has fluctuations both positive and negative in respect to y1. Both methods of the calculation return 0 for f(2) >> f1(2) ans = 0 >> f2(2) ans = 0 Output of the two methods of calculations
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
>> y1 y1 = 1.0e-009 * Columns 1 through 7 -0.1342 -0.1199 -0.1069 -0.0952 -0.0846 -0.0751 -0.0665 Columns 8 through 14 -0.0589 -0.0520 -0.0458 -0.0404 -0.0355 -0.0311 -0.0272 Columns 15 through 21 -0.0238 -0.0207 -0.0180 -0.0156 -0.0135 -0.0117 -0.0101 Columns 22 through 28 -0.0087 -0.0074 -0.0064 -0.0054 -0.0046 -0.0039 -0.0033 Columns 29 through 35
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/15/2011 for the course MATH 345 taught by Professor Staff during the Spring '08 term at Ohio State.

Page1 / 5

Homework 7 Bob - 28.1) > syms x > expand(x-2)^9) ans = x^9...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online