# Question: Summation procedure

January 01 2013 by
false
Maple 15

0

Hello,

I would like to do the following procedure from a basic concept, but I can't figure out what I'm doing wrong (sorry for that, I'm a beginner). I have tried to look up some more information about procedures on the Help menu with no success. Here you have what I'm planning to do:

Considering the following function (which approximates the cosine function):

I would like to create a procedure which gives the same results the function gives. Here you have one of my several attempts:

aprcos:=proc(x,n::nonnegint)local resp,i;resp:=0;if n>=0 thenfor i from 0 to n doresp:=resp+((-1)^i*(x^(2*i)/(2*i)!);end do;end if;resp;end proc;

However, Maple doesn't accept it, so I guess something must be wrong, even though I don't know what it is. I would be grateful if you could help me with this.

Thank  you very much for your attention.

Happy New Year 2013!