~ubuntu-branches/ubuntu/lucid/pdl/lucid

« back to all changes in this revision

Viewing changes to t/poly.t

  • Committer: Bazaar Package Importer
  • Author(s): Ben Gertzfield
  • Date: 2002-04-08 18:47:16 UTC
  • Revision ID: james.westby@ubuntu.com-20020408184716-0hf64dc96kin3htp
Tags: upstream-2.3.2
ImportĀ upstreamĀ versionĀ 2.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
use PDL::LiteF;
 
2
BEGIN {
 
3
        eval " use PDL::Fit::Polynomial; ";
 
4
        $loaded = ($@ ? 0 : 1);
 
5
}
 
6
 
 
7
 
 
8
kill INT,$$ if $ENV{UNDER_DEBUGGER}; # Useful for debugging.
 
9
print "1..1\n";
 
10
 
 
11
unless ($loaded) {
 
12
        for (1..1) {
 
13
                print "ok $_ # Skipped: probably PDL::Slatec not available.\n";
 
14
        }
 
15
        exit;
 
16
}
 
17
 
 
18
sub ok {
 
19
        my $no = shift ;
 
20
        my $result = shift ;
 
21
        print "not " unless $result ;
 
22
        print "ok $no\n" ;
 
23
}
 
24
 
 
25
$x = sequence(20)-10;
 
26
$y = 30-2*$x+3*$x**2-2*$x**3;
 
27
 
 
28
srand(42);
 
29
$y += grandom($y)*100;
 
30
 
 
31
#points $x,$y;
 
32
 
 
33
$yfit = fitpoly1d($x,$y,4);
 
34
 
 
35
#hold; line $x, $yfit;
 
36
 
 
37
ok(1, max(abs($y-$yfit)) < 220); # need to add 10 for windows