File: cdfbet.dia.ref

package info (click to toggle)
scilab 5.2.2-9
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 334,832 kB
  • ctags: 52,586
  • sloc: xml: 526,945; ansic: 223,590; fortran: 163,080; java: 56,934; cpp: 33,840; tcl: 27,936; sh: 20,397; makefile: 9,908; ml: 9,451; perl: 1,323; cs: 614; lisp: 30
file content (33 lines) | stat: -rw-r--r-- 898 bytes parent folder | download | duplicates (2)
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
28
29
30
31
32
33
// =============================================================================
// Tests for beta distribution
//
// Scilab Team
// Copyright INRIA
//
// =============================================================================
prec = 1.e-5;
A  = 2;
B  = 3;
bn = 1;
deff('[y]=Beta(x)','y=bn*(x^(A-1) * (1-x)^(B-1))');
bn = intg(0,1,Beta);
bn = 1/bn;
if norm(intg(0,1,Beta)-1)> prec then bugmes();quit;end
x  = 0:0.1:1;
y  = 1-x;
p1 = [];
for k=x
	p1=[p1,intg(0,k,Beta)];
end
A = 2*ones(x);
B = 3*ones(x);
[p,q]=cdfbet('PQ',x,y,A,B);
if norm(p-p1) > prec then bugmes();quit;end
[x1,y1]=cdfbet('XY',A,B,p,q);
if norm(x-x1) > prec then bugmes();quit;end
if norm(y-y1) > prec then bugmes();quit;end
A1 = cdfbet('A',B,p,q,x,y);
// x=0 or x=1 do not work
if norm(A1(2:$-1)-A(2:$-1)) > prec then bugmes();quit;end
B1 = cdfbet('B',p,q,x,y,A);
if norm(B1(2:$-1)-B(2:$-1)) > prec then bugmes();quit;end