Simplifying Units in Ezunits Package
"Mateusz M." <[email protected]> Thu, 7 May 2026 13:04:50 +0200
| Newsgroups | gmane.comp.mathematics.maxima.general |
|---|---|
| Message-ID | <CAOJ_3NFkOXoGS9L52_964hEiRM5LHdP9r3u=UDsjG=w4dBw=aQ@mail.gmail.com> |
Hello everyone
I am very impressed with the capabilities of Maxima with the ezunits
package when it comes to practical engineering tasks. However, I still
encounter certain problems that I am unable to solve satisfactorily on my
own.
Please take a look:
(%i4) C_2: 10 `nF;
C_1: 100 `pF;
R_1: 10 `kOhm;
(C_2) 10 ` nF
(C_1) 100 ` pF
(R_1) 10 ` kOhm
Function fundamental_units returns proper unit value, but Maxima can't
simplify the fraction using ``.
(%i7) 1/(R_1*(C_2 + C_1));
fundamental_units(%);
1/(R_1*(C_2 + C_1)) ``%;
(%o5) (1/10 ` 1/kOhm)/(100 ` pF+10 ` nF)
(%o6) 1/s
(%o7) (1/10 ` 1/kOhm)/(100 ` pF+10 ` nF) `` 1/s
I can solve this using some manipulations: force denominator to be
converted first or use subst to convert capacitance units to be the same:
(%i10) 1/(R_1*(C_2 + C_1)) `` kHz;
1/((R_1*(C_2 + C_1)) ``s) `` kHz;
subst(nF = 1000 * pF, 1/(R_1*(C_2 + C_1))) ``kHz;
(%o8) (1/10 ` 1/kOhm)/(100 ` pF+10 ` nF) `` kHz
(%o9) 1000/101 ` kHz
(%o10) 1000/101 ` kHz
The problem is that these aren't very versatile and clean solutions, and
this example is very simple.
Here is another one I have a problem with:
(%i15) H(s, C, R_1, R_2) := (1/(s * C)) / (R_1 + R_2 + 1/(s * C));
H(s, 18`nF, 1`kOhm, 1`kOhm);
f: dimensionally(subst(%i*2*%pi*50`Hz, s, %));
fundamental_units(f);
f ``%;
(%o11) H(s,C,R_1,R_2):=(1/(s*C))/(R_1+R_2+1/(s*C))
(%o12) (s^(-1)/18 ` 1/nF)/(s^(-1)/18 ` 1/nF+2 ` kOhm)
(f) (-(%i/(1800*%pi)) ` 1/(Hz*nF))/(-(%i/(1800*%pi)) ` 1/(Hz*nF)+2 `
kOhm)
(%o14) 1
(%o15) (-(%i/(1800*%pi)) ` 1/(Hz*nF))/(-(%i/(1800*%pi)) ` 1/(Hz*nF)+2 `
kOhm) `` 1
Is there perhaps a simple and universal way to simplify units like in
MathCad or other engineering tools? I would appreciate any help.
Best regards,
Mateusz Mróz
_______________________________________________
Maxima-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/maxima-discuss