Maple Units package



On Friday 01 April 2005 01:04, C Y wrote:

> I guess what I could do is assign a unit prefix which can be
> appended to the unit definition arrays.  E.g. the program could go
> through and stick unit_ on all current unit names.  Something like
> :
>
> setunitprefix("unit_");

I find this simple and flexible. It makes me think about a simple 
solution for inclusion of substances in unit names: Copy the whole 
definitions and also add a suffix. Something like:

copyunitdefs("_H2O");

And then you could use:
unit_mol_H2O
You'd also have unit_N_H2O, unit_m_H2O ... but you don't have to use 
them; unit_l_H2O may be usefull. 
OK it is unelegant.

>
> I think this would make more sense as part of a chemistry package
> which makes use of the units package.  I could add all interesting
> periodic table information while I'm at it :-).

How do you want to provide the information? Many constants?

Very nice would be computing with chemical formulas. I could imagine 
this:

(%i10) chem_defsymbol(X, H*i1+O*i2);
(%o10)
(%i11) chem_solve( 2*H2+X->H2O, X );
(%o11)                       [ X=O2, i1=0, i2=2 ]

There should be a means to include a (partial) chemical analysis which 
is given in weight %, and to give product ratios in g/g. I have 
currently no vision of an elegant syntax for this.

I have already written a small program (for Maxima and Maple) that 
solves problems like this for a specific biochemical reaction.


> In essence, yes.  I will think about how to handle that.  It is not
> clear to me whether diff needs to know about this, although I
> suppose it might.  I get a cold chill or two when I think about

Thinking about it, with your approach there seems no change to diff() 
and int() necessary:

diff(10/2*u_m/u_s^2*t^2, t) = 10*u_m/u_s^2*t  
(like with pen and paper)

The need for changing int() and diff() seems to come from Maple's 
approach to insure correctness of the units.

> Maxima 5.9.1.1cvs http://maxima.sourceforge.net
> Using Lisp SBCL 0.8.20
> Distributed under the GNU Public License. See the file COPYING.
> Dedicated to the memory of William Schelter.
> This is a development version of Maxima. The function bug_report()
> provides bug reporting information.
> (%i1) load("./units.mac");
>
> (%o1)                              ./units.mac
> (%i2) 2*m/s +3*km/hr + v1;
>                                      10800002 m
> (%o2)                           v1 + ----------

What would happen if I had typed:
(%i3) N;
(%o3)         kg/m/s^2       /* ? */

If yes, I would prefer a separate conversion function, and not do much 
conversions automaticly. But who codes decides, offcourse.

>No problem.  I'm always amazed how subtle some of the issues
>surrounding units really are.  Hopefully Maxima will eventually be 
>able to do most of what you want.

I guess that will be fairly soon. Does conversion to arbitrary units 
work already?

I've also written a unit conversion package for Maxima, you can have 
it if you want. (Although you won't be much impressed.) 


Yours 
Eike.

-- 
Snail:                             Phone:
Eike Welk                          xx49-241-4127686
Stolberger Str. 72
52068 Aachen                       Mail:
Germany                            eike.welk@post.rwth-aachen.de