File: series.mpi

package info (click to toggle)
mathpiper 0.81f%2Bsvn4469%2Bdfsg3-4
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 36,576 kB
  • sloc: java: 57,479; lisp: 13,721; objc: 1,300; xml: 988; makefile: 114; awk: 95; sh: 38
file content (27 lines) | stat: -rw-r--r-- 573 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

/* Generate a polynomial base1 + base2*x + ....*/
ArbPoly(_base,n_IsPositiveInteger) <-- Sum(MakeVector(base,n)*x^(0 .. (n-1)));

/*
   SinTaylor and ExpTaylor: direct series for the taylor series expansions
   of Sin and Exp.
   Examples:
   
   In> Simplify(SinTaylor(10) - Taylor(x,0,10)Sin(x))
   Out> 0;
   In> Simplify(ExpTaylor(10) - Taylor(x,0,10)Exp(x))
   Out> 0;
*/

SinTaylor(n_IsPositiveInteger) <-- 
[
  Local(m);
  n:=((n-1)>>1);
  m:=(1+2*(0 .. n));
  Sum((-1)^(0 .. n)*x^m/(m!));
];

ExpTaylor(n_IsPositiveInteger) <-- 
[
  Sum(x^(0 .. n)/((0 .. n)!));
];