Question: Defining a function that does Taylor series expansion


I am trying to define a funciton I'd like to call approx3f that calculates the taylor expansion of a function f(x) around a point "a" up to 3 terms.  So i want this function to be able to recieve a funciton f(x) and a parameter "a" as its input.

I wrote this:

approx5f :=(f,a)-> f(a)+f'(a)*(x-a)+1/2*f''(a)*(x-a)^2

but i think my definition is wrong cuz it doesn't work.  How can i make maple understand f is a function and then input "a" in it and its derivatives.

Ideally i want to be able to define a function, say called taylorexp that not only receives a function f(x) and a parameter "a" as its inputs, but also a number "n" that determines the number of the terms in the series expansion.

so taylorexp(sin(x),a,5) would give taylor series expansion of sin(x) around "a" up to 5 terms. How could I have such a definition for this funciton where the number of terms in it can change??? is it possible at all in maple?

Thank you so much in advance


Please Wait...