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

/* First load the necessary file: */
LOAD("dimen.mc")$
/* It is conjectured that for thermistors there is a physical
relationship between the voltage drop, current, ambient temperature,
roomtemperature resistance, convective heat transfer coefficient, and
a constant, BETA, having the dimension of temperature. First, to see
if the dimension of BETA is already known: */
GET(BETA, 'DIMENSION);
/* It is not. To establish it: */
DIMENSION(BETA=TEMPERATURE);
/* To automatically determine a set of dimensionless variables
sufficient to characterize the physical relation: */
NONDIMENSIONALIZE([VOLTAGE, CURRENT, TEMPERATURE, RESISTANCE,
HEATTRANSFERCOEFFICIENT, BETA]);
/* We learn that the relation may be expressed as a function of
only the above 3 variables rather than a function of the six physical
quantities. Evidently dimensions were preestablished for all but the
last of these particular input quantities, but an appropriate error
message would have informed us if this were not so. An extensive
set of dimensions have been prestablished, as may be seen from the
listing of DIMEN >.
As another example, there is thought to be a relation between the
viscosity, average velocity, molecular mass, and repulsion
coefficient of a gas. The repulsive force between two molecules is
believed to be of the form K/DISTANCE^N, with unknown N, so K must
have the following dimensions: */
DIMENSION(K=MASS*LENGTH^(N+1)/TIME^2) $
/* To get the computation time in milliseconds to be printed
automatically: */
CPUTIME: TRUE $
/* To do a dimensional analysis of the gas viscosity problem: */
NONDIMENSIONALIZE([VISCOSITY, K, MASS, VELOCITY]);
/* The physical relation must be expressible as a function of
this one dimensionless variable, or equivalently, this variable must
equal a constant. Consequently, physical measurements may be used
to determine N. It turns out to be in the range 7 to 12 for common
gases.
As a final example, suppose that we conjecture a relation between the
deflection angle of a light ray, the mass of a point mass, the speed
of light, and the distance from the mass to the point of closest
approach: */
NONDIMENSIONALIZE([ANGLE, MASS, LENGTH, SPEEDOFLIGHT]);
/* We learn that there cannot be a dimensionless relation
connecting all of these quantities and no others. Let us also try
including the constant that enters the inversesquare law of
gravitation: */
NONDIMENSIONALIZE([ANGLE, MASS, LENGTH, SPEEDOFLIGHT,
GRAVITYCONSTANT]);
/* Altermatively, for astrophysics problems such as this,we may
prefer to use a dimensional basis in which the gravity constant is
taken as a pure number, eliminating one member from our dimensional
basis: */
%PURE: CONS(GRAVITYCONSTANT, %PURE);
/* Note that the latter two of the above constants are pure
numbers by default, respectively eliminating TEMPERATURE and CHARGE
from the basis, but the user may include all five of TEMPERATURE,
CHARGE, MASS, LENGTH, and TIME in the basis by resetting %PURE to [].
Altermatively, the user may wish to include SPEEDOFLIGHT in %PURE for
relativistic problems or PLANCKSCONSTANT for quantum problems. For
dimensional analysis it doesn't really matter which basis member is
eliminated by each pure constant, but in fact the latter two
respectively eliminate LENGTH and TIME, whereas GRAVITYCONSTANT
eliminates MASS.
To proceed with our analysis: */
NONDIMENSIONALIZE([ANGLE, MASS, LENGTH, SPEEDOFLIGHT]);
