File: nummethods.mpt

package info (click to toggle)
mathpiper 0.81f%2Bsvn4469%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 36,572 kB
  • sloc: java: 57,479; lisp: 13,721; objc: 1,300; xml: 988; makefile: 114; awk: 95; sh: 38
file content (14 lines) | stat: -rw-r--r-- 611 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// test some numerical methods

// these examples are taken from the refman

Verify(IntPowerNum(3*10^100, 0, MultiplyN,1), 1);
Verify(IntPowerNum(3, 3, MultiplyN,1), 27);
Verify(IntPowerNum(HilbertMatrix(2), 4, *,  Identity(2)), {{289/144,29/27},{29/27,745/1296}});

Verify(IntPowerNum(3,100,{{x,y},Modulo(x*y,7)},1), 4);

BuiltinPrecisionSet(22);
NumericEqual(RoundTo(SumTaylorNum(1, {{k},1/k!}, {{k},1/k}, 21),21), 2.718281828459045235359,21);
NumericEqual(RoundTo(SumTaylorNum(1, {{k},1/k!}, 21),21), 2.718281828459045235359,21);
NumericEqual(NewtonNum({{x}, x+Sin(x)}, 3, 5, 3), 3.14159265358979323846,20);