Need some help



Just off the top of my head, I think that what
you could try is explicit rule sets, rather than tellsimp.

The letsimp facility is quite separate from any other
simplification modification, and was a student project,
years ago, to emulate the similar facility in REDUCE.

RJF


C Y wrote:

>Based on Barton's example code, I have tried to set up some
>tellsimpafter rules to simplify units.  The problem arises from the
>need to treat derived and base units differently - the procedure SHOULD
>work as follows:
>
>1) expand all derived units into MKS definitions - letsimp with
>derivedruleset1.
>1a) *Might still need to add*  Simplify base units to MKS
>2) perform any and all cancelations between base units
>3) simplify from MKS to desired derived units
>4) convert all remaining base MKS units to desired base units.
>
>Are there any solutions to this problem that avoid infinite looping?  I
>need to have an "intermediate" result that does NOT recursively
>simplify its output before applying the next ruleset.  The behavior
>below, which results from the code below it and the letsimp expressions
>in processunits1 and processunits2, is not the desired behavior for my
>application - I need the routines to NOT work on subexpressions first. 
>Any ideas, anybody?  Apologies if I stated this poorly - I've been
>looking at it probably a bit too long ;-).
>
>(%i8) kg*m^2/s^2;
>
>                   2
>processunits1( kg m  ) 
>               2
>resultof1  kg m  
>                   2
>processunits2( kg m  ) 
>
>`rat' replaced 15.43235835294143 by 16883//1094 = 15.43235831809872
>                      2
>           84415000 cm  gr
>resultof2  --------------- 
>                 547
>                 2
>               cm  gr
>processunits1( ------ ) 
>                  2
>                 s
>             2
>           cm  gr
>resultof1  ------ 
>              2
>             s
>               1
>processunits2( -- ) 
>                2
>               s
>               1
>resultof2  ---------- 
>                    2
>           3600 %min
>                                          2
>                                 422075 cm  gr
>(%o8)                            -------------
>                                           2
>                                  9846 %min
>
>Ideally, this would have returned [whatever the factor is]*dyne
>instead.
>
>freeofunitspd([x]) := lfreeof(nonfinalunitlistd,x);
>notfreeofunitspd([x]) := not(freeofunitspd(x));
>freeofunitsp([x]) := lfreeof(nonfinalunitlist,x);
>notfreeofunitsp([x]) := not(freeofunitsp(x));
>matchdeclare(a,freeofunitspd(a),b,notfreeofunitspd(b));
>matchdeclare(c,freeofunitsp(c),d,notfreeofunitsp(d));
>tellsimpafter(a*b,a*processunits1(b));
>tellsimpafter(c*d,c*processunits2(d));
>
>CY
>
>
>		
>__________________________________ 
>Do you Yahoo!? 
>Yahoo! Small Business - Try our new resources site!
>http://smallbusiness.yahoo.com/resources/ 
>
>_______________________________________________
>Maxima mailing list
>Maxima@www.math.utexas.edu
>http://www.math.utexas.edu/mailman/listinfo/maxima
>  
>