Mercurial > hg > octave-lojdl
changeset 3170:7050b5006ef9
[project @ 1998-04-23 06:29:49 by jwe]
author | jwe |
---|---|
date | Thu, 23 Apr 1998 06:29:55 +0000 |
parents | 6216bc89fb65 |
children | c925de13bb22 |
files | test/octave.test/arith/arith.exp test/octave.test/arith/beta-1.m test/octave.test/arith/beta-2.m test/octave.test/arith/beta-3.m test/octave.test/arith/betai-1.m test/octave.test/arith/betai-2.m test/octave.test/arith/betai-3.m test/octave.test/arith/betai-4.m test/octave.test/arith/erf-1.m test/octave.test/arith/erf-2.m test/octave.test/arith/erf-3.m test/octave.test/arith/gamma-1.m test/octave.test/arith/gamma-2.m test/octave.test/arith/gamma-3.m test/octave.test/arith/gammai-1.m test/octave.test/arith/pow2-1.m test/octave.test/arith/pow2-2.m test/octave.test/arith/pow2-3.m |
diffstat | 18 files changed, 114 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/test/octave.test/arith/arith.exp +++ b/test/octave.test/arith/arith.exp @@ -1,19 +1,41 @@ ## The following functions need to have tests written for them: -# nexpow2 -# pow2 -# beta -# betai -# erf +# nextpow2 # erfc # erfinv -# gamma -# gammai # lgamma # cross # commutation_matrix # duplication_matrix +set test beta-1 +set prog_output "ans = 1" +do_test beta-1.m + +set test beta-2 +set prog_output "error:.*" +do_test beta-2.m + +set test beta-3 +set prog_output "error:.*" +do_test beta-3.m + +set test betai-1 +set prog_output "ans = 1" +do_test betai-1.m + +set test betai-2 +set prog_output "error:.*" +do_test betai-2.m + +set test betai-3 +set prog_output "error:.*" +do_test betai-3.m + +set test betai-4 +set prog_output "error:.*" +do_test betai-4.m + set test ceil-1 set prog_output "ans = 1" do_test ceil-1.m @@ -30,6 +52,18 @@ set prog_output "error:.*" do_test ceil-4.m +set test erf-1 +set prog_output "ans = 1" +do_test erf-1.m + +set test erf-2 +set prog_output "error:.*" +do_test erf-2.m + +set test erf-3 +set prog_output "error:.*" +do_test erf-3.m + set test exp-1 set prog_output "ans = 1" do_test exp-1.m @@ -78,6 +112,22 @@ set prog_output "error:.*" do_test floor-4.m +set test gamma-1 +set prog_output "ans = 1" +do_test gamma-1.m + +set test gamma-2 +set prog_output "error:.*" +do_test gamma-2.m + +set test gamma-3 +set prog_output "error:.*" +do_test gamma-3.m + +set test gammai-1 +set prog_output "ans = 1" +do_test gammai-1.m + set test gcd-1 set prog_output "ans = 1" do_test gcd-1.m @@ -134,6 +184,18 @@ set prog_output "\n... min:.*" do_test min-4.m +set test pow2-1 +set prog_output "ans = 1" +do_test pow2-1.m + +set test pow2-2 +set prog_output "ans = 1" +do_test pow2-2.m + +set test pow2-3 +set prog_output "error:.*" +do_test pow2-3.m + set test rem-1 set prog_output "ans = 1" do_test rem-1.m
new file mode 100644 --- /dev/null +++ b/test/octave.test/arith/beta-1.m @@ -0,0 +1,6 @@ +a=[1, 1.5, 2, 3]; +b=[4, 3, 2, 1]; +v1=beta(a,b); +v2=beta(b,a); +v3=gamma(a).*gamma(b)./gamma(a+b); +all(abs(v1-v2)<sqrt(eps)) && all(abs(v2-v3)<sqrt(eps))
new file mode 100644 --- /dev/null +++ b/test/octave.test/arith/betai-1.m @@ -0,0 +1,8 @@ +a=[1, 1.5, 2, 3]; +b=[4, 3, 2, 1]; +v1=betai(a,b,1); +v2=[1,1,1,1]; +x = [.2, .4, .6, .8]; +v3=betai(a, b, x); +v4 = 1-betai(b, a, 1.-x); +all(abs(v1-v2)<sqrt(eps)) && all(abs(v3-v4)<sqrt(eps))
new file mode 100644 --- /dev/null +++ b/test/octave.test/arith/betai-4.m @@ -0,0 +1,1 @@ +betai(1,2)
new file mode 100644 --- /dev/null +++ b/test/octave.test/arith/erf-1.m @@ -0,0 +1,3 @@ +x=[0,.5,1]; +v=[0, .520499877813047, .842700792949715]; +all(abs(erf(x)-v)<1.e-10) && all(abs(erf(-x)+v)<1.e-10) && all(abs(erfc(x)+v-1)<1.e-10) && all(abs(erfinv(v)-x)<1.e-10)
new file mode 100644 --- /dev/null +++ b/test/octave.test/arith/gamma-1.m @@ -0,0 +1,4 @@ +x = [.5, 1, 1.5, 2, 3, 4, 5]; +v = [sqrt(pi), 1, .5*sqrt(pi), 1, 2, 6, 24]; +all(abs(gamma(x) - v) < sqrt(eps)) && all(abs(lgamma(x) - log(v)) < sqrt(eps)) +
new file mode 100644 --- /dev/null +++ b/test/octave.test/arith/gamma-3.m @@ -0,0 +1,1 @@ +gamma(1,2)
new file mode 100644 --- /dev/null +++ b/test/octave.test/arith/gammai-1.m @@ -0,0 +1,6 @@ +a = [.5 .5 .5 .5 .5]; +x = [0 1 2 3 4]; +v1 = sqrt(pi)*erf(x)./gamma(a); +v2 = gammai(a,x.*x); +v3 = gammainc(x.*x,a); +all (abs(v1 - v2) < sqrt(eps)) && all (abs(v2 - v3) < sqrt(eps))
new file mode 100644 --- /dev/null +++ b/test/octave.test/arith/pow2-1.m @@ -0,0 +1,3 @@ +x = [3, 0, -3]; +v = [8, 1, .125]; +all (abs (pow2 (x) - v) < sqrt (eps))