fb_dim - mkraska/meclib GitHub Wiki

Check of dimensions for physical quantities

This performs a dimensional check of a result. The user has to provide a list of variables and a list of the corresponding dimensions. The test is based on a proposal by Leo Butler (forum discussion, Github issue).

In order to ensure reasonable results, the test should only be applied to expressions with the correct set of variables (use fb_vars first).

fb_dim(sans, vars, dims)

  • sans symbolic expression to be checked for the dimension
  • vars list of expected variables in the expression
  • dims list of dimensions for the variables. Use any variable names, which don't interfere with the actual variables in the expression

Returns the dimension of sans.

To use the function, insert the following command in the question variables:

stack_include("https://raw.githubusercontent.com/mkraska/meclib/main/Maxima/fb_value.mac");

Example

Get the dimension of the expression N*l/(E*A), which is the extension of a rod of cross section A (dimension length²), length l and Young's modulus E(dimension force divided by length²) subjected to a force F. The force dimension is expressed in base dimensions.

We use the names LE (Längeneinheit, length unit) for length, ME for mass, and TE for time (Zeit).

vars: [N, l, A, E];
FE: ME*LE/ZE^2;
dims: [FE, LE, LE^2, FE/LE^2];
D: fb_dim( N*l/(E*A), vars, dims);

results in D equal to LE.

If the result is free of any of the variables in vars, then the dimensions of the expression are consistent.

Used in question TM2 01 T05.