Overview
Comment:Read fix_c.r before ese.r and explicitly overload ** operator with pow().
These changes are required for the Codemist version of Reduce.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 1955d6934394a9b72d23f682ed1177d3e6cd5b40ffaa3a966cb3257ca98d0318
User & Date: geraint@users.sourceforge.net on 2002-08-30 15:39:04
Other Links: branch diff | manifest | tags
Context
2002-09-03
19:34:15
Write EdX regardless - csex is needed to create ode when not optimised. check-in: 30895e1289 user: geraint@users.sourceforge.net tags: origin/master, trunk
2002-08-30
15:39:04
Read fix_c.r before ese.r and explicitly overload ** operator with pow().
These changes are required for the Codemist version of Reduce.
check-in: 1955d69343 user: geraint@users.sourceforge.net tags: origin/master, trunk
2002-08-29
15:45:20
Tests for existence of matrix before entering shell loop.
Tests for existence of expression before attempting to write or optimise.
check-in: 45a1825412 user: geraint@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/ese2rdae_r from [3c6373acf2] to [863b78c116].

10
11
12
13
14
15
16



17
18
19
20
21
22
23
# Copyright (c) P.J.Gawthrop, 1991, 1994, 1996

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$



## Revision 1.12.2.2  2002/06/05 17:28:00  geraint
## Cosmetic change.
##
## Revision 1.12.2.1  2002/06/05 11:14:51  geraint
## ae.r now generated using def2write_r like cse?.r
## fix_c.r called at ese2rdae stage so that pow gets fixed in ae.r.
##







>
>
>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Copyright (c) P.J.Gawthrop, 1991, 1994, 1996

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.13  2002/06/28 10:13:40  geraint
## Includes fix_c.r in ese2rdae and def2write_r to eliminate occurrances of x**y.
##
## Revision 1.12.2.2  2002/06/05 17:28:00  geraint
## Cosmetic change.
##
## Revision 1.12.2.1  2002/06/05 11:14:51  geraint
## ae.r now generated using def2write_r like cse?.r
## fix_c.r called at ese2rdae stage so that pow gets fixed in ae.r.
##
169
170
171
172
173
174
175



176
177
178
179
180
181
182
183
184
185
186
187
188
189
$load_subs_comm

%Read the formatting function
in "$MTTPATH/trans/reduce_matrix.r";

% Definitions
in "$defname";




% Elementary system equations
in "$esename";

% Fix c code if required
$include

OFF Echo;
OFF Nat;

%Create the output file
OUT "$daename";

write "in ""$defname""";







>
>
>




<
<
<







172
173
174
175
176
177
178
179
180
181
182
183
184
185



186
187
188
189
190
191
192
$load_subs_comm

%Read the formatting function
in "$MTTPATH/trans/reduce_matrix.r";

% Definitions
in "$defname";

% Fix c code if required
$include

% Elementary system equations
in "$esename";




OFF Echo;
OFF Nat;

%Create the output file
OUT "$daename";

write "in ""$defname""";

Modified mttroot/mtt/lib/reduce/fix_c.r from [551406cfe8] to [4c2ca104c3].

1
2
3
4
5
6
7
8
9
10
11

12
13
14
15
16
17
18
%% Fixes for c-code generation

%% Set PI explicitly here to avoid later conflict with cc headers
%% if PI is not already a number (i.e. on rounded has not been set)
IF NOT NUMBERP (pi) THEN LET PI = 3.14159$

ON ROUNDED$ % No integer output

%% Changes x^y to pow(x,y)
 OPERATOR pow$
 FOR ALL x,y LET x^y = pow(x,y)$ % Use the pow function

 
 %% Derivatives
 FOR ALL f,g,x LET df(pow(f,g),x)=
 	   pow(f,g-1) * (df(f,x)*g + df(g,x)*f*log(f))$

 %% Special cases
 FOR ALL x LET pow(x,0) = 1$











>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
%% Fixes for c-code generation

%% Set PI explicitly here to avoid later conflict with cc headers
%% if PI is not already a number (i.e. on rounded has not been set)
IF NOT NUMBERP (pi) THEN LET PI = 3.14159$

ON ROUNDED$ % No integer output

%% Changes x^y to pow(x,y)
 OPERATOR pow$
 FOR ALL x,y LET x^y = pow(x,y)$ % Use the pow function
 FOR ALL x,y LET x**y = pow(x,y)$ % Use the pow function
 
 %% Derivatives
 FOR ALL f,g,x LET df(pow(f,g),x)=
 	   pow(f,g-1) * (df(f,x)*g + df(g,x)*f*log(f))$

 %% Special cases
 FOR ALL x LET pow(x,0) = 1$


MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]