Re: ezunits tellsimpafter rules in user code
Michael Soegtrop via Maxima-discuss <[email protected]> Thu, 18 Jun 2026 11:26:42 +0200
| Newsgroups | gmane.comp.mathematics.maxima.general |
|---|---|
| Message-ID | <[email protected]> |
Dear Robert, > The problem you've encountered is that aa% is declared with different > matchdeclare properties in different places in the ezunits code, and > so you are essentially wanting a previous declaration (namely that aa% > and bb% match anything). thanks . this was a silly error on my side > with (all (aa%), all (bb%), integerp (nn%)) define ((aa% ` bb%)^nn% > --> (aa%^nn%) ` (bb%^nn%)); I think I would prefer simply using pairs of variables and predicates in the match similar to the way Mathematica does it, but with a more obvious syntax. > If you are working with variables declared dimensional, maybe that's useful. Thanks for the reminder of this feature. I usually don't use it, but maybe I should. I frequently use something like (t`s) e.g. to coonvert a dimensional term to something I can plot or numerically integrate. I should try dimensional variables for this. > Thanks for the hints. Can you give a few examples of how you are using > signum with dimensional quantities? My current use case is from fluid dynamics. I computed the temperature drop in a temperature gradient heat exchanger used as recuperator dependent on flow speed. There is a linear signed dependency (the temperature drop is in first approximation proportional to flow speed, including the sign) and the non-linear dependency of the surface heat conductance (Nusselt number) on absolute flow speed. The problem is that in the end I get v/|v|^m which does not work for v=0. I need to simplify this to v^(1-m) and to make this happen I am using signum(v)*abs(v)/abs(v)^m. The unit is compensated by other terms with the same fractional exponent, so what is under the the fraction exponent has unit 1, but the simplifier does not keep terms together to get units of one so that the final term looks something like signum(v)*abs(v)^(1-m) / v0^(1-m) - which eventually evaluates fine as long as m is a fraction (not a float - m is 0.6 in my case, so I am using 6/10). But the term which genuinely brings in the sign is v and if I need to combine this with non linear terms in v, using the absolute value and signum on v is an adequate choice. I guess this mostly happens when one uses experimentally derived corrections to some first order behavior. In theory based physics the units work out more nicely. Best regards, Michael