2009-12-16

dimensions as types

7.29:
. how to mix dimensions with (data)typing?
dimensions are like vector operators:
. they give type to a literal;
you could type a variable to be a dimension,
and then any literal assignment imlicitely has that dimension;
[12.16: eg,
num * inch /sec .
. length and time are a dimension of type number`real;
{inch, sec} are subtypes
of {length, time}, respectively .
. the subtyping allows conversions between
measuring systems within the same dimension .
]

10.17: sci.adda/unifying dimensions and map`keys:
. I've been confused in my use of "(dimension):
. in the expression (x cup rice),
rice is the dimension
-- like the unit vector when giving imaginary as (x i),
. this has a meaning equivalent to named param'association;
eg, complex could be either (y+ x i) or (y, i: x) .
. how does adda have types declare dimensions?
eg, how should num declare i to be
an imaginary dimension of complex?
. by the currently designed syntax rules,
i is a postfix operator: (real)i.imaginary .
. another view is vector notation:
C.type`= <> = x + y i
. that is, R is already defined as the reals,
and any postfixed symbols in that
are taken as declaring dim's .
[10.18: = .(real.R, i.R) ? ]

10.12: adda/syntax/conversion:

. if a function call doesn't need to use parentheticals as arg,
how is the parser knowing when a function is being defined?
. the first use of the symbol
does need to use a parenthetical
along with the dot-extension
indicating the return`type or obj`type;
eg,
id(...).type .
. if it wasn't dotted to a datatype,
and the symbol wasn't defined yet,
then there would be the ambiguity of
{ function(arg), biop(right.side`arg)} .
. notice that there could be another ambiguity
unless you're careful with your spaces:
. if the syntax for type conversion
is (expression).[new type]
then ( f(x).t ) means I'm defining f now;
whereas ( f (x).t ) means f( (x).t )
ie,
f is already declared as a uniop,
and it's being applied to an arg whose type
is being either coerced or converted to t.type .

. it helps to remember that during a function decl',
the parenthetical expression is part of the name,
so a function's name must be immediately followed by
the parenthetical expression;
whereas, during use of a name declared to be function,
the arg is already expected,
so you don't need paren's to shovel one in .
. this helps both to minimize syntax
and to use args that are
variables rather than list`literals .
10.15:
. when considering how conversions should be expressed,
keep in mind not only the syntax for applying it,
but also how the type.mgt will be defining [it].
. the type.mgt of the object being converted
may not even have the conversion routine,
so then the syntax should not be object-oriented .
. it's also important to
express them the way english-math already does
unless there is some higher reason not to:
that way is applying a dimension name
as a postfixed operator .
. a similar syntax for operator definition would be:
(x)f.y;
eg,
phys`dimension.type`= number;
length.type`= phys`dimension;
ft.type`= length;
inch.type`= length;
(x)inch.ft`= x/12;
(x)ft.inch`= x*12 .


11.9: adda/oop/dimensions:

. unifying the subtype polymorphism syntax choice
with that of dimensions and measuring systems .
. how are dimensions being obj's of classes?
. obj's of dimension have numeric state
[11.14: eg, in the view of that language,
length is a dimension,
and a measurement of that is an object .
]
. one dimension can have several measuring std's
eg, length has sublcass {metric, english, ...} .
[11.14:
. numeric models of a dynamic object system
include a number of dimensions that can be multiplied or divided
in order to express numeric relations .
. each dimension can have a number of measuring systems
and more can be added later by describing them in terms of
currently recognized measures .
eg, physics.system is
foot.length: 0.3048 meters .
]

bk.chem:
mass, length, time, vol.type = length**3
liter.vol = meter **3/10
density = mass/vol
. temperature, like density, is an intensive property
(doesn't depend on qty or mass)
whereas, vol and mass are externsive properties
. signif digits refer to measurements actually being uncertain +- some error factor
so shorthand is to give all signif digits with one digit of uncertainty;
signif digits include exactly one uncertain digit .
. sci notation standardizes placement of decimal
in order to make zero idicate significance:
eg, 100 has an ambigous range of uncertainty:
significant digits ?
( 3: 99..101
, 2: 90.. 110
) but 1.00 * 10**2 means 3 signif digits unambiguously .
. one reason the metric system has a name for every factor of the base
is so that choosing the right one can have the same effect as sci'notation .
eg, 1000 m rephrased as 1.0000 km
will have unambiguous significance .
(however, many order names have fallen out of use .)
[11.14: . to refer to exact amounts, don't use decimal points,
refer to floats with fractions ]
. so by being able to shift magnitude
the decimal point is always free to indicate the precision
(otherwise for large numbers with uncertain numbers of units,
there's ambiguity)

. rounding is defined in terms of significant {digit, figures};
mult and div result has the minimum of the 2 arg's signif'digits;
also, rounding {up, down} for 5 depends on {even, odd};
eg,
.25 -> .2
.35 -> .4
todo:
(see numana`text for alt's and caveates) .

. for determining signif'digits of an {add, subtract},
convert args to have same order
eg, 1 km + 1m
-> 1 km + 0.001 km
then km has zero decimal places,
so result must also have zero places:
= 1 km .



adda/oop/dimensions/automatic dimensional analysis:
. must make dimensional analysis automatic
. I can type x.ft assign it mm
and have the sublcass system will find the conversion auto'ly .
. this system is user {definable extendable} too;
eg, for adding new currencies .
. a dimension type has atleast one subtype
then other subtypes define a conversion from the original sub
eg the original in pkg physics is metric,
then english `physics is subclassing metric .

11.11: adda/oop/theory of dimensions:
[11.11: needs to handle dimensions from the supertype,
but also exensible later ]
ratio (n.qua, d.qua).type
density.ratio(mass, vol),
subtype(supertype.type).type
qua.type.
-- quaality has been synon with dimension, as in dimensional analysis .
rct vs polar coord's


bk.adda/physics:

velocity.ratio(distance, time),
acceleration.ratio(velocity, time),
force = mass * acceleration
density.type = mass /vol
vol = length**3
area = length**2
mass is resistance to acceleration

. unlike types, a symbol can have multiple concrrent dim's
that are not subtypes of each other .

. dim's are part of the number class
since numeric operations may encounter them as factors;
ie,
a number value consists of a qty
times zero or more dim's or their inverses .

. part of root physics system is the dim'set:
{time length mass money charge} .
charge is coulomb (C) = joule /volt .
Joule = length**2 / time**2 * mass
capacitance = C/volt
amp= C/sec
volt = joule/C
but an electron volt is a fraction of a joule
. electric field = force /charge (newton/col) or (volt/meter),

No comments:

Post a Comment