unit package has reached loadable state (woo hoo!)
Subject: unit package has reached loadable state (woo hoo!)
From: C Y
Date: Thu, 28 Apr 2005 20:00:24 -0700 (PDT)
--- C Y wrote:
> > Dimensional quantities (by
> > this I mean a dimensionless factor times a dimensional
> > unit) are universally written with the dimensionless
> > part separate from the dimensional part, with the
> > dimensionless part on the left and the dimensional
> > part on the right.
>
> OH, I see what you mean:
>
> (%i2) a*z*kg*m/s^2;
> a kg m z
> (%o2)/R/ --------
> 2
> s
>
> I'm not sure yet, but I think there might be a way to do this - it
> depends on where things are ordered according to the alphabet. I've
> been looking at including Barton's dimension package functionality,
> and some of the necessities that entails might also enable me to
> solve this problem.
Well, thanks to our own rtoy on #lisp, I have been pointed in the
correct direction. This may not be quite the solution you are looking
for, and it's not ready made from a Maxima standpoint (details below),
but to my eye at least this is close enough:
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) ordergreat(s,m,kg);
(%o1) done
(%i2) z*m/(a*s);
z m
(%o2) ---
a s
(%i3) a*z*kg*m/s^2;
a z kg m
(%o3) --------
2
s
It's not two different fractions, but otherwise everything is in the
correct order. Given a choice between this and having to use functions
for all my units, I personally would prefer to accept the above
limitation. I know of no way to prevent maxima from combining
b
a -
c
into
a b
---
c
without serious trouble, but if someone does that might provide either
an improvement to the above or even an alternate solution - stuff all
the non units in a and everything else in b/c. Also, depending on
mactex, it should be possible to have the full separation manifest
itself cleanly in tex output, which will be usable by most of the front
ends. (Note I haven't tested that).
The chief difficulty currently lies in what (I think) is a very
braindead implimentation of ordergreat (and orderless for that matter).
It does not take a list as an argument, and if I try a looping setup
it gives me an error which amounts to it only taking one assignment
operation at a time - I have to remove the old order setting before
entering anything new! This is crazy - I can't think of any reason why
order shouldn't be more flexible than this. Does anybody know the
reason for this implementation decision? I'm very tempted to change it
but since this involves a file in src/ it needs a second opinion by
someone more qualified than me.
(%i1) ordergreat(s);
(%o1) done
(%i2) ordergreat(a);
Reordering is not allowed.
-- an error. Quitting. To debug this try debugmode(true);
(%i3) unorder();
(%o3) [s]
(%i4) ordergreat([a,s]);
Atomic arg required:
[a, s]
-- an error. Quitting. To debug this try debugmode(true);
I suppose there may be a reason for this, but if so I can't figure out
what it would be.
CY
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com