UI MATH 2850 - Second-Order Polynomial Approximation

Unformatted text preview:

> with(plots):Warning, the name changecoords has been redefined22M:28Spring 07J. SimonSecond-Order Polynomial ApproximationIn Calc I or II, you studied Taylor polynomial approximations. If y=f(x) is some function, and the function f is smooth, we can write polynomials P(x) that approximate f near a given point x=a with high accuracy. The idea is to find a polynomial P(x) such thatP(a) = f(a) There is a 0-degree polynomial, namely P(x) = f(a) for all x, that does this.P'(a) = f'(a) There is a 1st degree polynomial that has P(a)=f(a) and P'(a)=f'(a), namely P(x) = f(a) + f'(a)(x-a)P''(a) = f''(a) There is a 2nd degree polynomial that has P(a)=f(a) AND P'(a)=f'(a) AND P''(a) = f''(a), namely P(x) = f(a) + f'(a)(x-a) + (1/2) f''(a)(x-a)^2.etc.For any given n (assuming f is smooth enough around x=a that all the needed derivatives exist), we can write a polynomialP_n(x) = f(a) + f'(a)(x-a) + (1/2) f''(a)(x-a)^2 + (1/3!) f'''(a) (x-a)^3 + ... + (1/n!) f^(n)(a) (x-a)^n where f^(n)(a) denotes the nth derivative of f at point x=a.There are (at least) two important uses for Taylor polynomial approximations:1. In computers and calculators, we need to have algorithms for computing values of functions such as exp(x), sin(x), log(x) --- how can a machine that only knows how to add, subtract, multiply, and divide numbers ever know how to calculate sin(1)?? The actual algorithms may be fancier, but you could write a 23rd degree polynomial approximation of the sine function, using your knowledge of sine and cosine at x=0, and get an estimate for sin(1).> p8:=series(sin(x), x=0, 8);p8 := x - 16 x3 + 1120 x5 - 15040 x7 + O x8( )> P8:=convert(p8,polynom);P8 := x - 16 x3 + 1120 x5 - 15040 x7> subs(x=1,P8);evalf(%);424150400.8414682540> sin(1);evalf(%);sin 1( )0.8414709848 2. In theoretical analysis of max/min problems, you developed the "second derivative test" for deciding (in many situations) whether a critical point of a function f represents a local maximum vs. local minimum vs. saddle point. The key here is that the second-order Taylor polynomial approximation of f(x) near x=critical point "a" will capture BOTH phenomena of having "a" be a critical point and will have the same max vs min behavior as f.Examples:> f:=cos(x);f := cos x( )> f0:=subs(x=0,f);f0 := cos 0( )> dfx:=diff(f,x);dfx := -sin x( )> df0:=subs(x=0,dfx);df0:=value(df0);df0 := -sin 0( )df0 := 0> d2fx:=diff(dfx,x);d2fx := -cos x( )> d2f0:=subs(x=0,d2fx);d2f0:=value(d2f0);d2f0 := -cos 0( )d2f0 := -1> p2:=f0+df0*x + d2f0*x^2/2;p2 := 1 - 12 x2> plot({f, p2}, x=-4..4, thickness=2, view=[-4..4, -1.5..1.3], scaling=constrained);0-0.5-1-1.5x420-2-410.5 (Remark: In the case of a saddle-point, the second derivative will be 0, and the quadratic Taylor polynomial will be the same as the 1st degree polynomial, just a line tangent to the graph of f .##########################################There is a similar theory of Taylor polynomials for functions of several variables. Consider the following function, near the point (x,y)=(1,2)> f:=cos(x)*ln(1+y);f := cos x( ) ln 1 + y( )> plot3d(f, x=-2..3, y=0..3, axes=boxed, orientation=[54,75]);00.51y1.522.53-2-10x123-1-0.500.51 > x0:=1;y0:=2;x0 := 1y0 := 2> f0:=subs(x=x0, y=y0,f);f0 := cos 1( ) ln 3( )> dfx:=diff(f,x);dfx := -sin x( ) ln 1 + y( )> dfx0:=subs(x=x0,y=y0,dfx);dfx0 := -sin 1( ) ln 3( )> dfy:=diff(f,y);dfy := cos x( )1 + y> dfy0:=subs(x=x0,y=y0,dfy);dfy0 := 13 cos 1( )> d2fx:=diff(dfx,x);d2fx := -cos x( ) ln 1 + y( )> d2fx0:=subs(x=x0,y=y0,d2fx);d2fx0 := -cos 1( ) ln 3( )> d2fy:=diff(dfy,y);d2fy := - cos x( )1 + y( )2> d2fy0:=subs(x=x0,y=y0,d2fy);d2fy0 := - 19 cos 1( )> d2fxy:=diff(dfx,y);d2fxy := - sin x( )1 + y> d2fyx:=diff(dfy,x);d2fyx := - sin x( )1 + yNotice these last two are equal, which we expect; but it is nice to have the reassuring calculation.> d2fxy0:=subs(x=x0,y=y0,d2fxy);d2fxy0 := - 13 sin 1( )> P2:=f0+dfx0*(x-1)+dfy0*(y-2)+(1/2)*d2fx0*(x-1)^2 + d2fxy0*(x-1)*(y-2)+(1/2)*d2fy0*(y-2)^2;P2:=evalf(P2);P2:=evalf(expand(P2));P2 := cos 1( ) ln 3( ) - sin 1( ) ln 3( ) x - 1( ) + 13 cos 1( ) y - 2( ) - 12 cos 1( ) ln 3( ) x - 1( )2 - 13 sin 1( ) x - 1( ) y - 2( ) - 118 cos 1( ) y - 2( )2P2 := 1.157831581 - 0.9244503647 x + 0.1801007686 y - 0.2967913765 x - 1.( )2 - 0.2804903282 x - 1.( ) y - 2.( ) - 0.03001679477 y - 2.( )2P2 := 0.1799923690 + 0.2301130447 x + 0.5806582759 y - 0.2967913765 x2 - 0.2804903282 x y - 0.03001679477 y2> plot3d(P2, x=-2..3, y=0..3, axes=boxed, orientation=[54,75]);00.51y1.522.53-2-10x123-2-1012 The function P2 is "just" a quadratic in x and y, so the graph should be recognizable as a paraboloid or a saddle surface. To see the overall shape better, let's re-plot the graph with a larger range of values of x and y.> plot3d(P2, x=-15..15, y=-15..15, axes=boxed, orientation=[54,75], color=proc(x,y) abs(x) end proc);-15-10-5y051015-15-10-5x051015-120-80-400 So we see the graph is a saddle surface.Now let's see how the graph of P2 fits with the graph of f.> plot3d([f, P2], x=-2..3, y=0..3, axes=boxed, orientation=[54,75], color=[blue, pink]);00.51y1.522.53-2-10x123-2-1012 It is hard to see how the two surfaces relate near the point (1,2). So let's redraw the graphs, with ranges of x and y limited to near (1,2).> plot3d([f, P2], x=0.5..1.5, y=1.5..2.5, axes=boxed, orientation=[54,75], color=[blue, pink]);1.61.8y22.22.40.60.8x11.21.40.20.40.60.81 Now we can see that near the point (1,2), the graph z=f(x,y) and the graph z=P2(x,y) are nearly identical.####################################################################################Here is a second example.Consider the following function, near the point (x,y)=(1,2)> f:=sin(x)+cos(x+y);f := sin x( ) + cos x + y( )> plot3d(f, x=0..5, y=2..7, axes=boxed, orientation=[81,83]);234y567012x345-2-1012 We will select the point (x0, y0) to be where we think the graph has a local maximum (more on this later in the chapter...)> dfx:=diff(f,x);dfx := cos x( ) - sin x + y( )> dfy:=diff(f,y);dfy := -sin x + y( )We want to find where both partial derivatives are zero; from the picture, we think there is such a "critical point" near x=2, y=5. The command "fsolve" tells Maple to numerically solve one or more equations, and we can tell it roughly were to look (in case there are other solutions far away from where we want to look).> fsolve({dfx=0,dfy=0}, {x=2,y=5});x = 1.570796327, y = 4.712388980{ }Actually, we can solve these equations exactly. The second equation says


View Full Document

UI MATH 2850 - Second-Order Polynomial Approximation

Download Second-Order Polynomial Approximation
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Second-Order Polynomial Approximation and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Second-Order Polynomial Approximation 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?