Supplement for Lab 2: Taylor Series and Complex Arithmeticrestart;This worksheet will help you become familiar with commands you need for this week's lab.Functions:First, you need to know how to define a function. I mentioned this briefly last week, but here it is again. Suppose you want to work with the function f(x) = sin(x^2) and g(x) = cos(x^2). You could sayf:=sin(x^2);g(x) := cos(x^2);That's good enough for some purposes. For instance, you can plot the two functions:plot([f,g(x)],x=-5..5);But there are some situations where it's not good enough. For instance, you cannot easily tell Maple to evaluate this function at any individual point. We'd like to be able to type f(3) or g(3) and have it tell us the value of the function at x=3, but we can't:f(3);g(3);in fact, "f" and "g(x)" are just being treated internally as the names of expressions. We need to express things differently if we want Maple to understand that f(x) and g(x) are functions of the variable x Here's how we do it:f := x -> sin(x^2);g := x -> cos(x^2);This tells Maple that f is a function that converts anything we like to put in for x into the sine of that thing squared.f(x); g(x);f(t); g(t);f(pistachio);f(3); g(3);f(3.); g(3.);By the way, now there are two different ways we can plot f and g:plot([f,g],-5..5);plot([f(x),g(x)],x=-5..5);The "unapply" command is another way to define a function. It ends up doing the same thing as the arrow notation we used above, but sometimes it's more convenient. Here's an example:a := 3*sin(x)+exp(-2*x)+17;Right now, a is just an expression, not a function. In other words, you can't say a(3) and expect Maple to substitute 3 in for x. But if you use the unapply function,h := unapply(a,x);you do end up with a function:h(5);Taylor Series:Let's take that function f and expand it in a Taylor series:q:=taylor(f(x),x=0,15);That last term means that the series only goes up to 15th order in x, so terms with powers of x^15 or higher are not included. It's actually a bit annoying to have that term in there. You can get rid of it using the convert function:qq := convert(q,polynom);Now we can plot this function qq (We can't plot q, because the plot function doesn't know what to do with that O term.).plot(qq,x=0..2);I can overlap the original f(x) function and the Taylor's series fit on one plot:plot([f(x),qq],x=0..2);Complex arithmetic:Here are a few useful things to know for manipulating complex numbers in Maple.First, evalc is a function that tells Maple to try as hard as it can to write any complex number in standard x + iy form. For instance,z := (5+I)^(2*I);evalc(z);The first term is the real part, and the second is the imaginary part. The functions Re and Im give you the two parts:Re(z);Im(z);The functions conjugate, abs, and argument are also useful. By now, you should be able to guess what they all do:z2 := -17+32*I;z2bar:=conjugate(z2);r:=abs(z2);theta:=argument(z2);We can check that r exp(i theta) is the original number:evalc(r*exp(I*theta));By the way, in order to make Re and Im give you what you want, you often have to use the assume function:z := x + I*y;Re(z);That didn't work because Maple didn't know that x and y were real. (If y were imaginary, for instance, then I y would be real.) An assume statement solves the problem:assume(x,real);assume(y,real);Re(z);Im(z);