%% int.sm1, Aug 16, 1995.
%% demo.int is a template file to get integral of D-modules.
%%
(int.sm1: Aug 26, 1995.) message
( New macros "integral" and "get0" are added.) message
( Type in demo.int to see a demo.) message
%% Usage, putUsages and showKeywords
%% The data should be automatically generated from int.txt
%% int.sm1 = int.sm + int.txt
[(integral)
[(ff n integral ffi )
( ff is a list of operators,)
( n is a number to specify the degree of approximation,)
( ffi is the result list that will be the input to the "groebner")
( to get the integral of the module ff.)
(Example: )
$ [(x) ring_of_differential_operators ( ) elimination_order 0] define_ring $
$ [(Dx h +e^2). (E h + 2 x e).] 3 integral /ffi set$
( [ffi] groebner 0 get get0 ::)
( )
(See also, groebner (option countdown) and get0.)
]] putUsages
[(get0)
[(ff get0 result)
( ff is a list of operators. The operators in ff that does not)
( contain "e" is stored in result.)
( Note that "E" is set to zero and "h" is set to 1.)
(See also integral)
(Example: )
$ [ (x h + 1). (e+x).] get0 :: $
( [ x + 1 ] )
]] putUsages
/demo.int {
%%%% Define the ring
[(x) ring_of_differential_operators ( ) elimination_order 0] define_ring
%%%% Give the equations here.
%%%% E e = e E + 1 and "e" and "E" will be eliminated.
[(Dx h +e^2).
(E h + 2 x e).
] /ff set
%%%% Give a number. If you can't get the integral, increase the number.
/nnn 3 def
%%% Let's compute
ff nnn integral /ffi set
%% Give the lower and the upper bound of the degree.
%% /from-degree 0 def /to-degree 5 def
%%[ffi [(from) from-degree (to) to-degree]]
[ffi]
groebner 0 get get0 /ans set
(Answer is in ans. ans = ) message
ans ::
} def
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%% Don't touch below %%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%% e-vectors, integral, get0 %%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% (Try [f1 f2 ...] nnn integral /ff set) message
%% ([ff] groebner 0 get get0) message
%% number e-vectors
/e-vectors {
/arg1 set
[/ans] pushVariables
[
/ans [(e).] def
1 1 << arg1 1 sub >>
{ pop
/ans
[(e).] ans {(e). mul} map join
def
} for
/arg1 ans def
] pop
popVariables
arg1
} def
%% [f1 f2 ...] nnn integral
/integral {
/arg2 set
/arg1 set
[/nnn /gens /m /ans /fff] pushVariables
[
/gens arg1 def
/nnn arg2 def
/m gens length def
/ans [ ] def
0 1 << m 1 sub >> {
gens 2 1 roll get /fff set
%%fff ::
/ans
ans [fff] join nnn e-vectors {fff mul} map join
def
%%ans ::
} for
/ans
ans nnn e-vectors {(E). 2 1 roll mul} map join
def
/ans ans {[[(h). (1).]] replace} map def
/ans ans {homogenize} map def
/arg1 ans def
] pop
popVariables
arg1
} def
% [g1 g2 g3 ...] get0
/get0 {
/arg1 set
[/gb /degs /ans /n /ff] pushVariables
[
/gb arg1 def
/degs gb {(e). degree} map def
/ans [
0 1 << gb length 1 sub >> {
/n set
<< degs n get >> 0 eq
{ gb n get [[(E). (0).] [(h). (1).]] replace /ff set
ff (0). eq
{ }
{ ff } ifelse
}
{ } ifelse
} for
] def
/arg1 ans def
] pop
popVariables
arg1
} def
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%