2 dimension(w) := block(/* w is an equation or a list of
3 equations with an indeterminate on the left and a product of
4 powers of mass, length, tyme, temperature, and charge on
5 the right. globally establishes corresponding row(s) for
6 exponent matrices, returning done. */
8 valid: '[mass, length, tyme, charge, temperature],
12 actual: listofvars(v),
13 for ac in actual do if not member(ac,valid) then print(
14 "warning:", ac, "not member of", valid),
15 put(u,v,'dimension))) $
17 listify(w) := if listp(w) then w else [w] $
19 %pure: '[boltzmannsconstant, electricpermittivityofavacuum] $
21 nondimensionalize(u) := block(/* u is a list of indeterminates
22 representing classes of physical quantities such as velocity or
23 length, for which dimensions have previously been established
24 by the dimension function. returns a list of nondimensional
25 combinations of the physical quantities in u. */
26 /* ratmx:false in doe macsyma */
27 [b, c, v, w, m, n, i, r, basis, logexpand, ratmx:false, scalarmatrixp],
30 /* determine basis: */
32 basis:[length, tyme, mass, temperature, charge],
33 if member('boltzmannsconstant, %pure) then (m:m+1,
34 basis:delete('temperature,basis)),
35 if member('electricpermittivityofavacuum,%pure) then (m:m+1,
36 basis:delete('charge,basis)),
37 if member('gravityconstant,%pure) then (n:n+1,
38 basis:delete('mass,basis)),
39 if member('plancksconstant,%pure) then (n:n+1,
40 basis:delete('tyme,basis)),
41 if member('speedoflight,%pure) then (n:n+1,
42 basis:delete('length,basis)),
43 if basis=[] then return(u),
44 if n>0 and m<2 then error("invalid to include gravityconstant",
45 "plancksconstant or speedoflight without also including",
46 "boltzmannsconstant & electricpermittivityofavacuum"),
48 /* ratmx:false in doe macsyma */
49 logexpand:/* ratmx: */true, scalarmatrixp:false,
52 /* construct matrix of exponents: */
53 for uu in u do (b: get(uu, 'dimension),
54 if b=false then error("first do an appropriate dimension(",''uu,
55 "= term with powers of mass, length, tyme, temperature & charge"
57 if member('boltzmannsconstant, %pure) then
58 b: subst(temperature=mass*length^2/tyme^2, b),
59 if member(electricpermittivityofavacuum,%pure) then
60 b: subst(charge=length^(3/2)*mass^(1/2)/tyme, b),
61 if member(speedoflight,%pure) then
62 if member(plancksconstant,%pure) then
63 b: subst([length=1/mass,tyme=1/mass], b)
64 else if member(gravityconstant,%pure) then
65 b: subst([mass=tyme,length=tyme], b)
66 else b: subst(length=tyme, b)
67 else if member(plancksconstant,%pure) then
68 if member(gravityconstant,%pure) then
69 b: subst([mass=length^(-1/3), tyme=length^(-5/3)], b)
70 else b: subst(tyme=mass*length^2, b)
71 else if member(gravityconstant,%pure) then
72 b: subst(mass=length^3/tyme^2, b),
74 for uu in basis do r:cons(coeff(b,log(uu)), r),
75 c:cons(r,c), w:cons(uu,w), n:n+1),
76 c:substinpart('matrix,c,0),
78 if r=0 then return(u),
79 if r=n then return([]),
81 /* delete dependent columns: */
83 while r<m do (b:submatrix(c,i),
84 while rank(b)<r do (i:i+1,
89 /* partition into a nonsingular part and the other rows: */
90 c:substinpart("[",c,0), b:[],
93 while rank(substinpart('matrix,b,0))<j do(
94 c:endcons(first(c),rest(c)),
95 b:cons(first(c),rest(b)),
96 w:endcons(first(w),rest(w))),
97 c:rest(c), v:cons(first(w),v), w:rest(w)),
98 c:substinpart('matrix,c,0), b:substinpart('matrix,b,0),
100 /* form the matrix of physical-quantity exponents and the
101 corresponding dimensionless products: */
104 b: cons(w[l]/product(v[k]^c[l,k],k,1,r), b),
108 acceleration = length/tyme^2,
110 angularacceleration = 1/tyme^2,
111 angularmomentum = mass*length^2/tyme^2,
112 angularvelocity = 1/tyme,
114 boltzmannsconstant = mass*length^2/tyme^2/temperature,
115 capacitance = tyme^2*charge^2/mass/length^2,
117 current = charge/tyme,
118 currentdensity = charge/tyme/length^2,
119 density = mass/length^3,
121 electricfield = mass*length/tyme^2/charge,
122 electricpermittivity = tyme^2*charge^2/mass/length^3,
123 electricpermittivityofavacuum = tyme^2*charge^2/mass/length^3,
124 energy = mass*length^2/tyme^2,
125 enthalpy = length^2/tyme^2,
127 filmcoefficient = mass/tyme^3/temperature,
128 flow = length^3/tyme,
129 gravityconstant = length^3/mass/tyme^2,
130 heat = mass*length^2/tyme^2,
131 heatcapacity = mass*length^2/tyme^2/temperature,
132 heattransfercoefficient = 1/tyme,
133 inductance = mass*length^2/charge^2,
134 internalenergy = length^2/tyme^2,
135 kinematicviscosity = length^2/tyme,
138 moment = mass*length^2/tyme^2,
139 momentum = mass*length/tyme,
140 magneticinduction = mass/tyme/charge,
141 magneticpermittivity = mass*length/charge^2,
142 plancksconstant = mass*length^2/tyme,
144 power = mass*length^2/tyme^3,
145 pressure = mass/length/tyme^2,
146 resistance = mass*length^2/tyme/charge^2,
147 specificheat = length^2/tyme^2/temperature,
148 speedoflight = length/tyme,
149 shearmodulus = mass/length/tyme^2,
150 surfacetension = mass/tyme^2,
151 stefanboltzmannconstant = mass/tyme^3/temperature^4,
152 stress = mass/length/tyme^2,
154 temperature = temperature,
155 thermalconductivity = mass*length/tyme^3/temperature,
156 thermalexpansioncoefficient = 1/temperature,
157 thermaldiffusivity = length^2/tyme,
159 velocity = length/tyme,
161 voltage = mass*length^2/tyme^2/charge,
162 viscosity = mass/tyme/length,
163 work = mass*length^2/tyme^2,
164 youngsmodulus = mass/length/tyme^2]) $
165 alias(time,tyme,cputime,time)$