Overview
Comment:Added a couple more simplification rules for pow.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/optimise-algebraic-equations | trunk
Files: files | file ages | folders
SHA3-256: 697e0dcbedcccb15906ba56dc92d2d2e1bfc9b34dccc8cec67537b67d7b6f736
User & Date: geraint@users.sourceforge.net on 2002-06-06 17:10:25
Other Links: branch diff | manifest | tags
Context
2002-06-18
16:56:51
Trying to get optimisation to work with maxima. check-in: 878c509228 user: geraint@users.sourceforge.net tags: origin/optimise-algebraic-equations, trunk
2002-06-06
17:10:25
Added a couple more simplification rules for pow. check-in: 697e0dcbed user: geraint@users.sourceforge.net tags: origin/optimise-algebraic-equations, trunk
16:28:45
Eliminated use of variable to pass rhs expression to optimise check-in: c355dc9a3f user: geraint@users.sourceforge.net tags: origin/optimise-algebraic-equations, trunk
Changes

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

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
%% 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$
 FOR ALL x LET pow(x,1) = x$



OPERATOR fabs$
FOR ALL x let abs(x) = fabs(x)$


END$











|







>
>






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
%% 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$
 FOR ALL x LET pow(x,1) = x$
 FOR ALL x,y,z LET pow(x,y)*pow(x,z) = pow(x,y+z)$ 
 FOR ALL x,y,z LET pow(pow(x,y),z) = pow(x,y*z)$

OPERATOR fabs$
FOR ALL x let abs(x) = fabs(x)$


END$


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