File: integrate.rb

package info (click to toggle)
jas 2.7.200-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 15,732 kB
  • sloc: java: 164,370; python: 14,882; ruby: 14,509; xml: 583; makefile: 545; sh: 349
file content (50 lines) | stat: -rw-r--r-- 885 bytes parent folder | download
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#
# jruby examples for jas.
# $Id$
#

require "examples/jas"

# elementary integration

r = PolyRing.new( QQ(), "x", PolyRing.lex );
puts "Ring: " + str(r);
puts
rf = RF(r);
puts "Ring: " + str(rf.factory());
puts

one,x = rf.gens();

#f = 1 / ( 1 + x**2 );
#f = x**2 / ( x**2 + 1 );

#f = 1 / ( x**2 - 2 );
#f = 1 / ( x**3 - 2 );

#f = ( x + 3 ) / ( x**2- 3 * x - 40 );

f = ( x**7 - 24 * x**4 - 4 * x**2 + 8 * x - 8 ) / ( x**8 + 6 * x**6 + 12 * x**4 + 8 * x**2 );


puts "f = " + str(f);
puts;

startLog();

t = System.currentTimeMillis();
e1 = r.integrate(f);
t = System.currentTimeMillis() - t;
puts "e1 = " + str(e1);
puts "integration time = " + str(t) + " milliseconds";
puts;

t = System.currentTimeMillis();
e2 = f.integrate();
t = System.currentTimeMillis() - t;
puts "e2 = " + str(e2);
puts "integration time = " + str(t) + " milliseconds";
puts;

#startLog();
terminate();