"Strong typing vs. strong testing"
vic.kelson at gmail.com
Mon Oct 11 19:02:01 CEST 2010
On Sep 28, 10:55 am, Tim Bradshaw <t... at tfeb.org> wrote:
> There's a large existing body of knowledge on dimensional analysis
> (it's a very important tool for physics, for instance), and obviously
> the answer is to do whatever it does. Raising to any power is fine, I
> think (but transcendental functions, for instance, are never fine,
> because they are equivalent to summing things with different
> dimensions, which is obvious if you think about the Taylor expansion of
> a transcendental function).
Umm.. Not so. The terms in the Taylor series are made of repeated
derivatives with respect to the same variable as the function's
argument. That is, in the vicinity of the value a,
f(x) = f(a) + f'(a)*(x-a)/1! + f''(a)*(x-a)^2/2! + f'''(a)(x-a)^3/3!
each of the derivatives has units that are the reciprocal of the units
of the (x-a)^n terms, e.g. the second term's "units" would be "units
of f per units of x" * "the units of x", which is simply "the units of
f". It had better be true that each of the terms in the series has the
same units. Otherwise, they could not be summed.
That said, I'm having a hard time thinking of a transcendental
function that doesn't take a dimensionless argument, e.g. what on
earth would be the units of ln(4.0 ft)?
More information about the Python-list