File: maxima_265.html

package info (click to toggle)
maxima 5.47.0-9
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 193,104 kB
  • sloc: lisp: 434,678; fortran: 14,665; tcl: 10,990; sh: 4,577; makefile: 2,763; ansic: 447; java: 328; python: 262; perl: 201; xml: 60; awk: 28; sed: 15; javascript: 2
file content (964 lines) | stat: -rw-r--r-- 39,201 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Maxima 5.47.0 Manual: Functions and Variables for ezunits</title>

<meta name="description" content="Maxima 5.47.0 Manual: Functions and Variables for ezunits">
<meta name="keywords" content="Maxima 5.47.0 Manual: Functions and Variables for ezunits">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="maxima_toc.html#Top" rel="start" title="Top">
<link href="maxima_423.html#Function-and-Variable-Index" rel="index" title="Function and Variable Index">
<link href="maxima_toc.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="maxima_262.html#ezunits_002dpkg" rel="up" title="ezunits-pkg">
<link href="maxima_266.html#f90_002dpkg" rel="next" title="f90-pkg">
<link href="maxima_264.html#Introduction-to-physical_005fconstants" rel="previous" title="Introduction to physical_constants">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
body {color: black; background: white;  margin-left: 8%; margin-right: 13%;
      font-family: "FreeSans", sans-serif}
h1 {font-size: 150%; font-family: "FreeSans", sans-serif}
h2 {font-size: 125%; font-family: "FreeSans", sans-serif}
h3 {font-size: 100%; font-family: "FreeSans", sans-serif}
a[href] {color: rgb(0,0,255); text-decoration: none;}
a[href]:hover {background: rgb(220,220,220);}
div.textbox {border: solid; border-width: thin; padding-top: 1em;
    padding-bottom: 1em; padding-left: 2em; padding-right: 2em}
div.titlebox {border: none; padding-top: 1em; padding-bottom: 1em;
    padding-left: 2em; padding-right: 2em; background: rgb(200,255,255);
    font-family: sans-serif}
div.synopsisbox {
    border: none; padding-top: 1em; padding-bottom: 1em; padding-left: 2em;
    padding-right: 2em; background: rgb(255,220,255);}
pre.example {border: 1px solid rgb(180,180,180); padding-top: 1em;
    padding-bottom: 1em; padding-left: 1em; padding-right: 1em;
    background-color: rgb(238,238,255)}
div.spacerbox {border: none; padding-top: 2em; padding-bottom: 2em}
div.image {margin: 0; padding: 1em; text-align: center}
div.categorybox {border: 1px solid gray; padding-top: 1em; padding-bottom: 1em;
    padding-left: 1em; padding-right: 1em; background: rgb(247,242,220)}
img {max-width:80%; max-height: 80%; display: block; margin-left: auto; margin-right: auto}

-->
</style>

<link rel="icon" href="figures/favicon.ico">
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6>"></script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
</head>

<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="Functions-and-Variables-for-ezunits"></a>
<div class="header">
<p>
Previous: <a href="maxima_264.html#Introduction-to-physical_005fconstants" accesskey="p" rel="previous">Introduction to physical_constants</a>, Up: <a href="maxima_262.html#ezunits_002dpkg" accesskey="u" rel="up">ezunits-pkg</a> &nbsp; [<a href="maxima_toc.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="maxima_423.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Functions-and-Variables-for-ezunits-1"></a>
<h3 class="section">57.3 Functions and Variables for ezunits</h3>

<a name="Item_003a-ezunits_002fdeffn_002f_0060"></a><dl>
<dt><a name="index-_0060"></a>Operator: <strong>`</strong></dt>
<dd>
<p>The dimensional quantity operator.
An expression <em>a ` b</em> represents a dimensional quantity,
with <code>a</code> indicating a nondimensional quantity and <code>b</code> indicating the dimensional units.
A symbol can be used as a unit without declaring it as such;
unit symbols need not have any special properties.
The quantity and unit of an expression <em>a ` b</em> can
be extracted by the <code>qty</code> and <code>units</code> functions, respectively.
</p>
<p>Arithmetic operations on dimensional quantities are carried out by
conventional rules for such operations.
</p>
<ul>
<li> <em>(x ` a) * (y ` b)</em> is equal to <em>(x * y) ` (a * b)</em>.
</li><li> <em>(x ` a) + (y ` a)</em> is equal to <em>(x + y) ` a</em>.
</li><li> <em>(x ` a)^y</em> is equal to <em>x^y ` a^y</em> when <code>y</code> is nondimensional.
</li></ul>

<p><code>ezunits</code> does not require that units in a sum have the same dimensions;
such terms are not added together, and no error is reported.
</p>
<p><code>load (&quot;ezunits&quot;)</code> enables this operator.
</p>
<p>Examples:
</p>
<p>SI (Systeme Internationale) units.
</p>
<div class="example">
<pre class="example">(%i1) load (&quot;ezunits&quot;)$
(%i2) foo : 10 ` m;
(%o2)                        10 ` m
(%i3) qty (foo);
(%o3)                          10
(%i4) units (foo);
(%o4)                           m
(%i5) dimensions (foo);
(%o5)                        length
</pre></div>

<p>&quot;Customary&quot; units.
</p>
<div class="example">
<pre class="example">(%i1) load (&quot;ezunits&quot;)$
(%i2) bar : x ` acre;
(%o2)                       x ` acre
(%i3) dimensions (bar);
                                   2
(%o3)                        length
(%i4) fundamental_units (bar);
                                2
(%o4)                          m
</pre></div>

<p>Units ad hoc.
</p>
<div class="example">
<pre class="example">(%i1) load (&quot;ezunits&quot;)$
(%i2) baz : 3 ` sheep + 8 ` goat + 1 ` horse;
(%o2)           8 ` goat + 3 ` sheep + 1 ` horse
(%i3) subst ([sheep = 3*goat, horse = 10*goat], baz);
(%o3)                       27 ` goat
(%i4) baz2 : 1000`gallon/fortnight;
                                gallon
(%o4)                   1000 ` ---------
                               fortnight
(%i5) subst (fortnight = 14*day, baz2);
                          500   gallon
(%o5)                     --- ` ------
                           7     day
</pre></div>

<p>Arithmetic operations on dimensional quantities.
</p>
<div class="example">
<pre class="example">(%i1) load (&quot;ezunits&quot;)$
(%i2) 100 ` kg + 200 ` kg;
(%o2)                       300 ` kg
(%i3) 100 ` m^3 - 100 ` m^3;
                                  3
(%o3)                        0 ` m
(%i4) (10 ` kg) * (17 ` m/s^2);
                                 kg m
(%o4)                      170 ` ----
                                   2
                                  s
(%i5) (x ` m) / (y ` s);
                              x   m
(%o5)                         - ` -
                              y   s
(%i6) (a ` m)^2;
                              2    2
(%o6)                        a  ` m
</pre></div>

<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Package-ezunits">Package ezunits</a>
&middot;</div>
</dd></dl>

<a name="Item_003a-ezunits_002fdeffn_002f_0060_0060"></a><dl>
<dt><a name="index-_0060-1"></a>Operator: <strong>`</strong> <em><!-- /@w -->`</em></dt>
<dd>
<p>The unit conversion operator.
An expression <em>a ` b `<!-- /@w -->` c</em> converts from unit <code>b</code> to unit <code>c</code>.
<code>ezunits</code> has built-in conversions for SI base units,
SI derived units, and some non-SI units.
Unit conversions not already known to <code>ezunits</code> can be declared.
The unit conversions known to <code>ezunits</code> are specified by the
global variable <code>known_unit_conversions</code>,
which comprises built-in and user-defined conversions.
Conversions for products, quotients, and powers of units are
derived from the set of known unit conversions.
</p>
<p>There is no preferred system for display of units;
input units are not converted to other units
unless conversion is explicitly indicated.
<code>ezunits</code> does not attempt to simplify units by prefixes
(milli-, centi-, deci-, etc)
unless such conversion is explicitly indicated.
</p>
<p><code>load (&quot;ezunits&quot;)</code> enables this operator.
</p>
<p>Examples:
</p>
<p>The set of known unit conversions.
</p>
<div class="example">
<pre class="example">(%i1) load (&quot;ezunits&quot;)$
(%i2) display2d : false$
(%i3) known_unit_conversions;
(%o3) {acre = 4840*yard^2,Btu = 1055*J,cfm = feet^3/minute,
       cm = m/100,day = 86400*s,feet = 381*m/1250,ft = feet,
       g = kg/1000,gallon = 757*l/200,GHz = 1000000000*Hz,
       GOhm = 1000000000*Ohm,GPa = 1000000000*Pa,
       GWb = 1000000000*Wb,Gg = 1000000*kg,Gm = 1000000000*m,
       Gmol = 1000000*mol,Gs = 1000000000*s,ha = hectare,
       hectare = 100*m^2,hour = 3600*s,Hz = 1/s,inch = feet/12,
       km = 1000*m,kmol = 1000*mol,ks = 1000*s,l = liter,
       lbf = pound_force,lbm = pound_mass,liter = m^3/1000,
       metric_ton = Mg,mg = kg/1000000,MHz = 1000000*Hz,
       microgram = kg/1000000000,micrometer = m/1000000,
       micron = micrometer,microsecond = s/1000000,
       mile = 5280*feet,minute = 60*s,mm = m/1000,
       mmol = mol/1000,month = 2629800*s,MOhm = 1000000*Ohm,
       MPa = 1000000*Pa,ms = s/1000,MWb = 1000000*Wb,
       Mg = 1000*kg,Mm = 1000000*m,Mmol = 1000000000*mol,
       Ms = 1000000*s,ns = s/1000000000,ounce = pound_mass/16,
       oz = ounce,Ohm = s*J/C^2,
       pound_force = 32*ft*pound_mass/s^2,
       pound_mass = 200*kg/441,psi = pound_force/inch^2,
       Pa = N/m^2,week = 604800*s,Wb = J/A,yard = 3*feet,
       year = 31557600*s,C = s*A,F = C^2/J,GA = 1000000000*A,
       GC = 1000000000*C,GF = 1000000000*F,GH = 1000000000*H,
       GJ = 1000000000*J,GK = 1000000000*K,GN = 1000000000*N,
       GS = 1000000000*S,GT = 1000000000*T,GV = 1000000000*V,
       GW = 1000000000*W,H = J/A^2,J = m*N,kA = 1000*A,
       kC = 1000*C,kF = 1000*F,kH = 1000*H,kHz = 1000*Hz,
       kJ = 1000*J,kK = 1000*K,kN = 1000*N,kOhm = 1000*Ohm,
       kPa = 1000*Pa,kS = 1000*S,kT = 1000*T,kV = 1000*V,
       kW = 1000*W,kWb = 1000*Wb,mA = A/1000,mC = C/1000,
       mF = F/1000,mH = H/1000,mHz = Hz/1000,mJ = J/1000,
       mK = K/1000,mN = N/1000,mOhm = Ohm/1000,mPa = Pa/1000,
       mS = S/1000,mT = T/1000,mV = V/1000,mW = W/1000,
       mWb = Wb/1000,MA = 1000000*A,MC = 1000000*C,
       MF = 1000000*F,MH = 1000000*H,MJ = 1000000*J,
       MK = 1000000*K,MN = 1000000*N,MS = 1000000*S,
       MT = 1000000*T,MV = 1000000*V,MW = 1000000*W,
       N = kg*m/s^2,R = 5*K/9,S = 1/Ohm,T = J/(m^2*A),V = J/C,
       W = J/s}
</pre></div>

<p>Elementary unit conversions.
</p>
<div class="example">
<pre class="example">(%i1) load (&quot;ezunits&quot;)$
(%i2) 1 ` ft `` m;
Computing conversions to base units; may take a moment. 
                            381
(%o2)                       ---- ` m
                            1250
(%i3) %, numer;
(%o3)                      0.3048 ` m
(%i4) 1 ` kg `` lbm;
                            441
(%o4)                       --- ` lbm
                            200
(%i5) %, numer;
(%o5)                      2.205 ` lbm
(%i6) 1 ` W `` Btu/hour;
                           720   Btu
(%o6)                      --- ` ----
                           211   hour
(%i7) %, numer;
                                        Btu
(%o7)               3.412322274881517 ` ----
                                        hour
(%i8) 100 ` degC `` degF;
(%o8)                      212 ` degF
(%i9) -40 ` degF `` degC;
(%o9)                     (- 40) ` degC
(%i10) 1 ` acre*ft `` m^3;
                        60228605349    3
(%o10)                  ----------- ` m
                         48828125
(%i11) %, numer;
                                          3
(%o11)                1233.48183754752 ` m
</pre></div>

<p>Coercing quantities in feet and meters to one or the other.
</p>
<div class="example">
<pre class="example">(%i1) load (&quot;ezunits&quot;)$
(%i2) 100 ` m + 100 ` ft;
(%o2)                  100 ` m + 100 ` ft
(%i3) (100 ` m + 100 ` ft) `` ft;
Computing conversions to base units; may take a moment. 
                           163100
(%o3)                      ------ ` ft
                            381
(%i4) %, numer;
(%o4)                428.0839895013123 ` ft
(%i5) (100 ` m + 100 ` ft) `` m;
                            3262
(%o5)                       ---- ` m
                             25
(%i6) %, numer;
(%o6)                      130.48 ` m
</pre></div>

<p>Dimensional analysis to find fundamental dimensions and fundamental units.
</p>
<div class="example">
<pre class="example">(%i1) load (&quot;ezunits&quot;)$
(%i2) foo : 1 ` acre * ft;
(%o2)                      1 ` acre ft
(%i3) dimensions (foo);
                                   3
(%o3)                        length
(%i4) fundamental_units (foo);
                                3
(%o4)                          m
(%i5) foo `` m^3;
Computing conversions to base units; may take a moment. 
                        60228605349    3
(%o5)                   ----------- ` m
                         48828125
(%i6) %, numer;
                                          3
(%o6)                 1233.48183754752 ` m
</pre></div>

<p>Declared unit conversions.
</p>
<div class="example">
<pre class="example">(%i1) load (&quot;ezunits&quot;)$
(%i2) declare_unit_conversion (MMBtu = 10^6*Btu, kW = 1000*W);
(%o2)                         done
(%i3) declare_unit_conversion (kWh = kW*hour, MWh = 1000*kWh,
                               bell = 1800*s);
(%o3)                         done
(%i4) 1 ` kW*s `` MWh;
Computing conversions to base units; may take a moment. 
                             1
(%o4)                     ------- ` MWh
                          3600000
(%i5) 1 ` kW/m^2 `` MMBtu/bell/ft^2;
                       1306449      MMBtu
(%o5)                 ---------- ` --------
                      8242187500          2
                                   bell ft
</pre></div>

<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Package-ezunits">Package ezunits</a>
&middot;</div>
</dd></dl>

<a name="constvalue"></a><a name="Item_003a-ezunits_002fdeffn_002fconstvalue"></a><dl>
<dt><a name="index-constvalue"></a>Function: <strong>constvalue</strong> <em>(<var>x</var>)</em></dt>
<dd>
<p>Shows the value and the units of one of the constants declared by package
<code>physical_constants</code>, which includes a list of physical constants, or
of a new constant declared in package <code>ezunits</code> (see
<code><a href="#declare_005fconstvalue">declare_constvalue</a></code>).
</p>
<p>Note that constant values as recognized by <code>constvalue</code>
are separate from values declared by <code>numerval</code> and
recognized by <code>constantp</code>.
</p>
<p>Example:
</p>
<div class="example">
<pre class="example">(%i1) load (&quot;physical_constants&quot;)$
(%i2) constvalue (%G);
                                     3
                                    m
(%o2)                    6.67428 ` -----
                                       2
                                   kg s
(%i3) get ('%G, 'description);
(%o3)           Newtonian constant of gravitation
</pre></div>

<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Package-ezunits">Package ezunits</a>
&middot;</div></dd></dl>

<a name="declare_005fconstvalue"></a><a name="Item_003a-ezunits_002fdeffn_002fdeclare_005fconstvalue"></a><dl>
<dt><a name="index-declare_005fconstvalue"></a>Function: <strong>declare_constvalue</strong> <em>(<var>a</var>, <var>x</var>)</em></dt>
<dd>
<p>Declares the value of a constant to be used in package <code>ezunits</code>. This
function should be loaded with <code>load (&quot;ezunits&quot;)</code>. 
</p>
<p>Example:
</p>
<div class="example">
<pre class="example">(%i1) load (&quot;ezunits&quot;)$
(%i2) declare_constvalue (FOO, 100 ` lbm / acre);
                                 lbm
(%o2)                      100 ` ----
                                 acre
(%i3) FOO * (50 ` acre);
(%o3)                     50 FOO ` acre
(%i4) constvalue (%);
(%o4)                      5000 ` lbm
</pre></div>

<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Package-ezunits">Package ezunits</a>
&middot;</div></dd></dl>

<a name="remove_005fconstvalue"></a><a name="Item_003a-ezunits_002fdeffn_002fremove_005fconstvalue"></a><dl>
<dt><a name="index-remove_005fconstvalue"></a>Function: <strong>remove_constvalue</strong> <em>(<var>a</var>)</em></dt>
<dd>
<p>Reverts the effect of <code><a href="#declare_005fconstvalue">declare_constvalue</a></code>. This function should be
loaded with <code>load (&quot;ezunits&quot;)</code>.
</p>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Package-ezunits">Package ezunits</a>
&middot;</div></dd></dl>

<a name="units"></a><a name="Item_003a-ezunits_002fdeffn_002funits"></a><dl>
<dt><a name="index-units"></a>Function: <strong>units</strong> <em>(<var>x</var>)</em></dt>
<dd>
<p>Returns the units of a dimensional quantity <var>x</var>,
or returns 1 if <var>x</var> is nondimensional.
</p>
<p><var>x</var> may be a literal dimensional expression <em>a ` b</em>,
a symbol with declared units via <code>declare_units</code>, 
or an expression containing either or both of those.
</p>
<p>This function should be loaded with <code>load (&quot;ezunits&quot;)</code>.
</p>
<p>Example:
</p>
<div class="example">
<pre class="example">(%i1) load (&quot;ezunits&quot;)$
(%i2) foo : 100 ` kg;
(%o2)                       100 ` kg
(%i3) bar : x ` m/s;
                                  m
(%o3)                         x ` -
                                  s
(%i4) units (foo);
(%o4)                          kg
(%i5) units (bar);
                                m
(%o5)                           -
                                s
(%i6) units (foo * bar);
                              kg m
(%o6)                         ----
                               s
(%i7) units (foo / bar);
                              kg s
(%o7)                         ----
                               m
(%i8) units (foo^2);
                                 2
(%o8)                          kg
</pre></div>

<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Package-ezunits">Package ezunits</a>
&middot;</div></dd></dl>

<a name="declare_005funits"></a><a name="Item_003a-ezunits_002fdeffn_002fdeclare_005funits"></a><dl>
<dt><a name="index-declare_005funits"></a>Function: <strong>declare_units</strong> <em>(<var>a</var>, <var>u</var>)</em></dt>
<dd>
<p>Declares that <code><a href="#units">units</a></code> should return units <var>u</var> for <var>a</var>,
where <var>u</var> is an expression. This function should be loaded with
<code>load (&quot;ezunits&quot;)</code>.
</p>
<p>Example:
</p>
<div class="example">
<pre class="example">(%i1) load (&quot;ezunits&quot;)$
(%i2) units (aa);
(%o2)                           1
(%i3) declare_units (aa, J);
(%o3)                           J
(%i4) units (aa);
(%o4)                           J
(%i5) units (aa^2);
                                2
(%o5)                          J
(%i6) foo : 100 ` kg;
(%o6)                       100 ` kg
(%i7) units (aa * foo);
(%o7)                         kg J
</pre></div>

<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Package-ezunits">Package ezunits</a>
&middot;</div></dd></dl>

<a name="qty"></a><a name="Item_003a-ezunits_002fdeffn_002fqty"></a><dl>
<dt><a name="index-qty"></a>Function: <strong>qty</strong> <em>(<var>x</var>)</em></dt>
<dd>
<p>Returns the nondimensional part of a dimensional quantity <var>x</var>,
or returns <var>x</var> if <var>x</var> is nondimensional.
<var>x</var> may be a literal dimensional expression <em>a ` b</em>,
a symbol with declared quantity, 
or an expression containing either or both of those.
</p>
<p>This function should be loaded with <code>load (&quot;ezunits&quot;)</code>.
</p>
<p>Example:
</p>
<div class="example">
<pre class="example">(%i1) load (&quot;ezunits&quot;)$
(%i2) foo : 100 ` kg;
(%o2)                       100 ` kg
(%i3) qty (foo);
(%o3)                          100
(%i4) bar : v ` m/s;
                                  m
(%o4)                         v ` -
                                  s
(%i5) foo * bar;
                                  kg m
(%o5)                     100 v ` ----
                                   s
(%i6) qty (foo * bar);
(%o6)                         100 v
</pre></div>

<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Package-ezunits">Package ezunits</a>
&middot;</div></dd></dl>

<a name="declare_005fqty"></a><a name="Item_003a-ezunits_002fdeffn_002fdeclare_005fqty"></a><dl>
<dt><a name="index-declare_005fqty"></a>Function: <strong>declare_qty</strong> <em>(<var>a</var>, <var>x</var>)</em></dt>
<dd>
<p>Declares that <code><a href="#qty">qty</a></code> should return <var>x</var> for symbol <var>a</var>, where
<var>x</var> is a nondimensional quantity. This function should be loaded
with <code>load (&quot;ezunits&quot;)</code>.
</p>
<p>Example:
</p>
<div class="example">
<pre class="example">(%i1) load (&quot;ezunits&quot;)$
(%i2) declare_qty (aa, xx);
(%o2)                          xx
(%i3) qty (aa);
(%o3)                          xx
(%i4) qty (aa^2);
                                 2
(%o4)                          xx
(%i5) foo : 100 ` kg;
(%o5)                       100 ` kg
(%i6) qty (aa * foo);
(%o6)                        100 xx
</pre></div>

<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Package-ezunits">Package ezunits</a>
&middot;</div></dd></dl>

<a name="unitp"></a><a name="Item_003a-ezunits_002fdeffn_002funitp"></a><dl>
<dt><a name="index-unitp"></a>Function: <strong>unitp</strong> <em>(<var>x</var>)</em></dt>
<dd>
<p>Returns <code>true</code> if <var>x</var> is a literal dimensional expression,
a symbol declared dimensional,
or an expression in which the main operator is declared dimensional.
<code>unitp</code> returns <code>false</code> otherwise.
</p>
<p><code>load (&quot;ezunits&quot;)</code> loads this function.
</p>
<p>Examples:
</p>
<p><code>unitp</code> applied to a literal dimensional expression.
</p>
<div class="example">
<pre class="example">(%i1) load (&quot;ezunits&quot;)$
(%i2) unitp (100 ` kg);
(%o2)                         true
</pre></div>

<p><code>unitp</code> applied to a symbol declared dimensional.
</p>
<div class="example">
<pre class="example">(%i1) load (&quot;ezunits&quot;)$
(%i2) unitp (foo);
(%o2)                         false
(%i3) declare (foo, dimensional);
(%o3)                         done
(%i4) unitp (foo);
(%o4)                         true
</pre></div>

<p><code>unitp</code> applied to an expression in which the main operator is declared dimensional.
</p>
<div class="example">
<pre class="example">(%i1) load (&quot;ezunits&quot;)$
(%i2) unitp (bar (x, y, z));
(%o2)                         false
(%i3) declare (bar, dimensional);
(%o3)                         done
(%i4) unitp (bar (x, y, z));
(%o4)                         true
</pre></div>

<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Package-ezunits">Package ezunits</a>
&middot;</div>
</dd></dl>

<a name="declare_005funit_005fconversion"></a><a name="Item_003a-ezunits_002fdeffn_002fdeclare_005funit_005fconversion"></a><dl>
<dt><a name="index-declare_005funit_005fconversion"></a>Function: <strong>declare_unit_conversion</strong> <em>(<var>u</var> = <var>v</var>, ...)</em></dt>
<dd>
<p>Appends equations <var>u</var> = <var>v</var>, ... to the list of unit conversions
known to the unit conversion operator <em>`<!-- /@w -->`</em>.
<var>u</var> and <var>v</var> are both multiplicative terms,
in which any variables are units,
or both literal dimensional expressions.
</p>
<p>At present, it is necessary to express conversions such that
the left-hand side of each equation is a simple unit
(not a multiplicative expression)
or a literal dimensional expression with the quantity equal to 1
and the unit being a simple unit.
This limitation might be relaxed in future versions.
</p>
<p><code>known_unit_conversions</code> is the list of known unit conversions.
</p>
<p>This function should be loaded with <code>load (&quot;ezunits&quot;)</code>.
</p>
<p>Examples:
</p>
<p>Unit conversions expressed by equations of multiplicative terms.
</p>
<div class="example">
<pre class="example">(%i1) load (&quot;ezunits&quot;)$
(%i2) declare_unit_conversion (nautical_mile = 1852 * m,
                               fortnight = 14 * day);
(%o2)                         done
(%i3) 100 ` nautical_mile / fortnight `` m/s;
Computing conversions to base units; may take a moment. 
                            463    m
(%o3)                       ---- ` -
                            3024   s
</pre></div>

<p>Unit conversions expressed by equations of literal dimensional expressions.
</p>
<div class="example">
<pre class="example">(%i1) load (&quot;ezunits&quot;)$
(%i2) declare_unit_conversion (1 ` fluid_ounce = 2 ` tablespoon);
(%o2)                         done
(%i3) declare_unit_conversion (1 ` tablespoon = 3 ` teaspoon);
(%o3)                         done
(%i4) 15 ` fluid_ounce `` teaspoon;
Computing conversions to base units; may take a moment. 
(%o4)                     90 ` teaspoon
</pre></div>

<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Package-ezunits">Package ezunits</a>
&middot;</div>
</dd></dl>

<a name="declare_005fdimensions"></a><a name="Item_003a-ezunits_002fdeffn_002fdeclare_005fdimensions"></a><dl>
<dt><a name="index-declare_005fdimensions"></a>Function: <strong>declare_dimensions</strong> <em>(<var>a_1</var>, <var>d_1</var>, ..., <var>a_n</var>, <var>d_n</var>)</em></dt>
<dd>
<p>Declares <var>a_1</var>, ..., <var>a_n</var> to have dimensions <var>d_1</var>, ...,
<var>d_n</var>, respectively.
</p>
<p>Each <var>a_k</var> is a symbol or a list of symbols.
If it is a list, then every symbol in <var>a_k</var> is declared to have dimension <var>d_k</var>.
</p>
<p><code>load (&quot;ezunits&quot;)</code> loads these functions.
</p>
<p>Examples:
</p>
<div class="example">
<pre class="example">(%i1) load (&quot;ezunits&quot;) $
(%i2) declare_dimensions ([x, y, z], length, [t, u], time);
(%o2)                         done
(%i3) dimensions (y^2/u);
                                   2
                             length
(%o3)                        -------
                              time
(%i4) fundamental_units (y^2/u);
0 errors, 0 warnings
                                2
                               m
(%o4)                          --
                               s
</pre></div>

<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Package-ezunits">Package ezunits</a>
&middot;</div></dd></dl>

<a name="remove_005fdimensions"></a><a name="Item_003a-ezunits_002fdeffn_002fremove_005fdimensions"></a><dl>
<dt><a name="index-remove_005fdimensions"></a>Function: <strong>remove_dimensions</strong> <em>(<var>a_1</var>, ..., <var>a_n</var>)</em></dt>
<dd>
<p>Reverts the effect of <code>declare_dimensions</code>. This function should be
loaded with <code>load (&quot;ezunits&quot;)</code>.
</p>

<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Package-ezunits">Package ezunits</a>
&middot;</div></dd></dl>

<a name="declare_005ffundamental_005fdimensions"></a><a name="Item_003a-ezunits_002fdeffn_002fdeclare_005ffundamental_005fdimensions"></a><dl>
<dt><a name="index-declare_005ffundamental_005fdimensions"></a>Function: <strong>declare_fundamental_dimensions</strong> <em>(<var>d_1</var>, <var>d_2</var>, <var>d_3</var>, ...)</em></dt>
<dd><a name="Item_003a-ezunits_002fdeffn_002fremove_005ffundamental_005fdimensions"></a></dd><dt><a name="index-remove_005ffundamental_005fdimensions"></a>Function: <strong>remove_fundamental_dimensions</strong> <em>(<var>d_1</var>, <var>d_2</var>, <var>d_3</var>, ...)</em></dt>
<dd><a name="Item_003a-ezunits_002fdeffn_002ffundamental_005fdimensions"></a></dd><dt><a name="index-fundamental_005fdimensions"></a>Global variable: <strong>fundamental_dimensions</strong></dt>
<dd>
<p><code>declare_fundamental_dimensions</code> declares fundamental dimensions.
Symbols <var>d_1</var>, <var>d_2</var>, <var>d_3</var>, ... are appended to the list of
fundamental dimensions, if they are not already on the list.
</p>
<p><code>remove_fundamental_dimensions</code> reverts the effect of <code>declare_fundamental_dimensions</code>.
</p>
<p><code>fundamental_dimensions</code> is the list of fundamental dimensions.
By default, the list comprises several physical dimensions.
</p>
<p><code>load (&quot;ezunits&quot;)</code> loads these functions.
</p>
<p>Examples:
</p>
<div class="example">
<pre class="example">(%i1) load (&quot;ezunits&quot;) $
(%i2) fundamental_dimensions;
(%o2) [length, mass, time, current, temperature, quantity]
(%i3) declare_fundamental_dimensions (money, cattle, happiness);
(%o3)                         done
(%i4) fundamental_dimensions;
(%o4) [length, mass, time, current, temperature, quantity, 
                                        money, cattle, happiness]
(%i5) remove_fundamental_dimensions (cattle, happiness);
(%o5)                         done
(%i6) fundamental_dimensions;
(%o6) [length, mass, time, current, temperature, quantity, money]
</pre></div>

<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Package-ezunits">Package ezunits</a>
&middot;</div>
</dd></dl>

<a name="declare_005ffundamental_005funits"></a><a name="Item_003a-ezunits_002fdeffn_002fdeclare_005ffundamental_005funits"></a><dl>
<dt><a name="index-declare_005ffundamental_005funits"></a>Function: <strong>declare_fundamental_units</strong> <em>(<var>u_1</var>, <var>d_1</var>, ..., <var>u_n</var>, <var>d_n</var>)</em></dt>
<dd><a name="Item_003a-ezunits_002fdeffn_002fremove_005ffundamental_005funits"></a></dd><dt><a name="index-remove_005ffundamental_005funits"></a>Function: <strong>remove_fundamental_units</strong> <em>(<var>u_1</var>, ..., <var>u_n</var>)</em></dt>
<dd>
<p><code>declare_fundamental_units</code> declares <var>u_1</var>, ..., <var>u_n</var>
to have dimensions <var>d_1</var>, ..., <var>d_n</var>, respectively.
All arguments must be symbols.
</p>
<p>After calling <code>declare_fundamental_units</code>,
<code>dimensions(<var>u_k</var>)</code> returns <var>d_k</var> for each argument <var>u_1</var>, ..., <var>u_n</var>,
and <code>fundamental_units(<var>d_k</var>)</code> returns <var>u_k</var> for each argument <var>d_1</var>, ..., <var>d_n</var>.
</p>
<p><code>remove_fundamental_units</code> reverts the effect of <code>declare_fundamental_units</code>.
</p>
<p><code>load (&quot;ezunits&quot;)</code> loads these functions.
</p>
<p>Examples:
</p>
<div class="example">
<pre class="example">(%i1) load (&quot;ezunits&quot;) $
(%i2) declare_fundamental_dimensions (money, cattle, happiness);
(%o2)                         done
(%i3) declare_fundamental_units (dollar, money, goat, cattle,
                                 smile, happiness);
(%o3)                 [dollar, goat, smile]
(%i4) dimensions (100 ` dollar/goat/km^2);
                             money
(%o4)                    --------------
                                      2
                         cattle length
(%i5) dimensions (x ` smile/kg);
                            happiness
(%o5)                       ---------
                              mass
(%i6) fundamental_units (money*cattle/happiness);
0 errors, 0 warnings
                           dollar goat
(%o6)                      -----------
                              smile
</pre></div>

<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Package-ezunits">Package ezunits</a>
&middot;</div>
</dd></dl>

<a name="dimensions"></a><a name="Item_003a-ezunits_002fdeffn_002fdimensions"></a><dl>
<dt><a name="index-dimensions"></a>Function: <strong>dimensions</strong> <em>(<var>x</var>)</em></dt>
<dd><a name="Item_003a-ezunits_002fdeffn_002fdimensions_005fas_005flist"></a></dd><dt><a name="index-dimensions_005fas_005flist"></a>Function: <strong>dimensions_as_list</strong> <em>(<var>x</var>)</em></dt>
<dd>
<p><code>dimensions</code> returns the dimensions of the dimensional quantity <var>x</var>
as an expression comprising products and powers of base dimensions.
</p>
<p><code>dimensions_as_list</code> returns the dimensions of the dimensional quantity <var>x</var>
as a list, in which each element is an integer which indicates the power of the
corresponding base dimension in the dimensions of <var>x</var>.
</p>
<p><code>load (&quot;ezunits&quot;)</code> loads these functions.
</p>
<p>Examples:
</p>
<div class="example">
<pre class="example">(%i1) load (&quot;ezunits&quot;)$
(%i2) dimensions (1000 ` kg*m^2/s^3);
                                2
                          length  mass
(%o2)                     ------------
                                 3
                             time
(%i3) declare_units (foo, acre*ft/hour);
                             acre ft
(%o3)                        -------
                              hour
(%i4) dimensions (foo);
                                   3
                             length
(%o4)                        -------
                              time
</pre></div>

<div class="example">
<pre class="example">(%i1) load (&quot;ezunits&quot;)$
(%i2) fundamental_dimensions;
(%o2)  [length, mass, time, charge, temperature, quantity]
(%i3) dimensions_as_list (1000 ` kg*m^2/s^3);
(%o3)                 [2, 1, - 3, 0, 0, 0]
(%i4) declare_units (foo, acre*ft/hour);
                             acre ft
(%o4)                        -------
                              hour
(%i5) dimensions_as_list (foo);
(%o5)                 [3, 0, - 1, 0, 0, 0]
</pre></div>

<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Package-ezunits">Package ezunits</a>
&middot;</div>
</dd></dl>

<a name="fundamental_005funits"></a><a name="Item_003a-ezunits_002fdeffn_002ffundamental_005funits"></a><dl>
<dt><a name="index-fundamental_005funits"></a>Function: <strong>fundamental_units</strong> <em><br>&nbsp;&nbsp;&nbsp;&nbsp;<tt>fundamental_units</tt> (<var>x</var>) <br>&nbsp;&nbsp;&nbsp;&nbsp;<tt>fundamental_units</tt> ()</em></dt>
<dd>
<p><code>fundamental_units(<var>x</var>)</code> returns the units
associated with the fundamental dimensions of <var>x</var>.
as determined by <code>dimensions(<var>x</var>)</code>.
</p>
<p><var>x</var> may be a literal dimensional expression <em>a ` b</em>,
a symbol with declared units via <code>declare_units</code>, 
or an expression containing either or both of those.
</p>
<p><code>fundamental_units()</code> returns the list of all known fundamental units,
as declared by <code>declare_fundamental_units</code>.
</p>
<p><code>load (&quot;ezunits&quot;)</code> loads this function.
</p>
<p>Examples:
</p>
<div class="example">
<pre class="example">(%i1) load (&quot;ezunits&quot;)$
(%i2) fundamental_units ();
(%o2)                 [m, kg, s, A, K, mol]
(%i3) fundamental_units (100 ` mile/hour);
                                m
(%o3)                           -
                                s
(%i4) declare_units (aa, g/foot^2);
                                g
(%o4)                         -----
                                  2
                              foot
(%i5) fundamental_units (aa);
                               kg
(%o5)                          --
                                2
                               m
</pre></div>

<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Package-ezunits">Package ezunits</a>
&middot;</div>
</dd></dl>

<a name="dimensionless"></a><a name="Item_003a-ezunits_002fdeffn_002fdimensionless"></a><dl>
<dt><a name="index-dimensionless"></a>Function: <strong>dimensionless</strong> <em>(<var>L</var>)</em></dt>
<dd>
<p>Returns a basis for the dimensionless quantities which can be formed
from a list <var>L</var> of dimensional quantities.
</p>
<p><code>load (&quot;ezunits&quot;)</code> loads this function.
</p>
<p>Examples:
</p>
<div class="example">
<pre class="example">(%i1) load (&quot;ezunits&quot;) $
(%i2) dimensionless ([x ` m, y ` m/s, z ` s]);
0 errors, 0 warnings
0 errors, 0 warnings
                               y z
(%o2)                         [---]
                                x
</pre></div>

<p>Dimensionless quantities derived from fundamental physical quantities.
Note that the first element on the list
is proportional to the fine-structure constant.
</p>
<div class="example">
<pre class="example">(%i1) load (&quot;ezunits&quot;) $
(%i2) load (&quot;physical_constants&quot;) $
(%i3) dimensionless([%h_bar, %m_e, %m_P, %%e, %c, %e_0]);
0 errors, 0 warnings
0 errors, 0 warnings
                              2
                           %%e        %m_e
(%o3)                [--------------, ----]
                      %c %e_0 %h_bar  %m_P
</pre></div>

<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Package-ezunits">Package ezunits</a>
&middot;</div>
</dd></dl>

<a name="natural_005funit"></a><a name="Item_003a-ezunits_002fdeffn_002fnatural_005funit"></a><dl>
<dt><a name="index-natural_005funit"></a>Function: <strong>natural_unit</strong> <em>(<var>expr</var>, [<var>v_1</var>, ..., <var>v_n</var>])</em></dt>
<dd>
<p>Finds exponents <var>e_1</var>, ..., <var>e_n</var> such that
<code>dimension(<var>expr</var>) = dimension(<var>v_1</var>^<var>e_1</var> ... <var>v_n</var>^<var>e_n</var>)</code>.
</p>
<p><code>load (&quot;ezunits&quot;)</code> loads this function.
</p>
<p>Examples:
</p>

<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Package-ezunits">Package ezunits</a>
&middot;</div>
</dd></dl>



<hr>
<div class="header">
<p>
Previous: <a href="maxima_264.html#Introduction-to-physical_005fconstants" accesskey="p" rel="previous">Introduction to physical_constants</a>, Up: <a href="maxima_262.html#ezunits_002dpkg" accesskey="u" rel="up">ezunits-pkg</a> &nbsp; [<a href="maxima_toc.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="maxima_423.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>