Quantity System Types Architecture
Today I am going to talk about the types that the Quantity System contains in its runtime
I should make a distinction between two labels now:
- Quantity System Framework: is the library responsible about Quantities and their units. It forms the required functionality that holds the necessary classes for embedding units and quantities in your application.
- Quantity System: is the runtime that is built over the framework, that is evolving with time and its main concern is a new vision to apply the mathematics as a unit aware expressions.
I admit that I am learning mathematics again while programming this marvelous library, I learnt the compiler theory, parsing techniques, object oriented, and how can I apply it to physical applications.
I will try also to shorten my posts and increasing them to indicate the features that I’ve implemented so far. Also you (Dear reader) may encounter a lot of my thinking during the writings in this blog.
However let’s avoid my philosophy view of what I am doing and dive directly into the architecture.
Qs Types
There is a complex type that called QsScalar which serve the basic calculation type in Qs.
The architecture of types that is calculated is illustrated on the next diagram
Figure 1: Logical Relation between Qs Scalar and Tensor
QsScalar
The scalar in quantity is a single quantity that holds a defined set of fields beside the unit of that field.
Field
The field is simply a Ring (Mathematical Point of View) or (Entity if I am talking from a programmer point of view)
Integer Numbers are a field, Real Numbers are a field, Rational Numbers are a field, Irrational Numbers are fields also.
But the concept of field goes beyond these samples also, because you can find Functions as Field.
The following diagram will illustrate the Scalar Object supported fields in Quantity System
Figure 2: Supported Mathematical Fields in QsScalar Type
Real Number
Rational Number
Which contains {Numerator, Denominator}
Complex Number
Which contains 2 components {Real Value, Imaginary Value}
Quaternions
Which contains 4 compnents {Real, i, j, k}
Symbolic
Symbolic variables that help in symbolic calculations
Functions
Referring to the function as a single quantity that can be added or subtracted
As I promised that’s all for now J
In the next posts, I will talk about the rest functionalities of Quantity System. So be tuned J
The 1.1.9.964 New Release
you may wondering why is this long long version number
actually I don’t want to reach 1.2 soon, thats why I slow down in my releases counting
especially that I am still in ALPHA release
the new release is featuring the new symbolic quantity concept which makes you do calculations with symbolics like mathematica and maxima BUT with my point of view of units
to declare a symbolic quantity you precede it with dollar sign ‘$’ and any number of charachters
$x+$y is a valid expression for x plus y
lets have some fun
make a rank two matrix
h = [$x<in> $y<ft>; 4<fm> 3<mm>]
ofcourse <fm> is Femto Meter
get the determinant
Qs> |h|
Area: 3*x-4.8E-11*y <in.mm>
What about 3 ranked matrix
Qs> m = [$x<in> $y<ft> $z<pm>; 4<fm> 3<mm> 2<yd>; $u<m> $v<ft> $w<rod>]
Qs> |m|
Volume: 3*x*w-110.836363636364*x*v+4363.63636363636*y*u-4.8E-11*y*w+9.54426151276544E-24*z*v-2.34848954546393E-11*z*u <in.mm.rod>
This release also feature a tensor support
the tensor syntax will use ‘<|’ ‘|>’ which I don’t have a names for them now
as I understand (because I am not sure) I was reading the global relativity theory of Einstien (and I repeat I am not sure if I got it right) that Tensor is the ability to transfer your point of view from local co-ordinates into another reference co-ordinates
so that when you look into a matrix for example you see it as a square or rectangle
and to go into z-direction you have to use a tensor view like a cube (this is the 3rd order tensor)
however to go into more reference like 4th order tensor you need some sort of recursive representation for this problem
I found that I can use some sort of recursive magic in syntax
for tensor of matrix resemblance you can use the same matrix syntax
T2 = <| 3 4; 8 9 |>
go into 3rd order tensor
T3 = <| 3 4; 8 9 | 8 7; 3 2|>
go into 4th order
T4 = <| <| 3 4; 8 9 | 8 7; 3 2|> | <| 3 4; 8 9 | 8 7; 3 2|> |>
or
T4 = <| T3 | T3 |>
and yes in storing this in memory I use a lot of inner objects (remember that I didn’t think about performance yet )
etc the 5th and 6th orders to the degree you want
BUT
all sources I read is only dealing with tensor of 2nd order
Needless to say how I get frustrated to understand what the heck is the tensor it really is (but it exists).
covariant, and contra variant vectors and tensors (some help needed here)
Another confusing thing (made my head spin)
If you make a vector, don’t safely consider it a first order tensor, also tensor of first order is NOT a vector
(I don’t know the validity of previous statement)
how is this differ in quantity system
make two vectors
v1 = {3 4 6}
v2 = {9 8 3}
multipy them tensorial ‘(*)
Qs> v1 (*) v2
QsMatrix:
27 <1> 24 <1> 9 <1>
36 <1> 32 <1> 12 <1>
54 <1> 48 <1> 18 <1>
Great isn’t it
However what about tensor from the first order
Qs> tv1 = <|3 4 6|>
QsTensor: 1st Order
3 <1> 4 <1> 6 <1>
Qs> tv2 = <|9 8 3|>
QsTensor: 1st Order
9 <1> 8 <1> 3 <1>
Qs> tv1*tv2
QsTensor: 2nd Order
27 <1> 24 <1> 9 <1>
36 <1> 32 <1> 12 <1>
54 <1> 48 <1> 18 <1>
The difference is that ordinary tensor multiplication is different than the tensorial product of mathematical types other then the tensor.
The first one you have to use ‘(*)’ explicitly and the result was matrix
The second one you only used ‘*’ for multiplication and the result was a tensor from the 2nd order (and it called dyadic product)
another headache product called (kronecker product) for matrices
Try this
Qs> fm = [1 2; 3 4]
QsMatrix:
1 <1> 2 <1>
3 <1> 4 <1>
Qs> sm = [0 5; 6 7]
QsMatrix:
0 <1> 5 <1>
6 <1> 7 <1>
Qs> fm (*) sm
QsMatrix:
0 <1> 5 <1> 0 <1> 10 <1>
6 <1> 7 <1> 12 <1> 14 <1>
0 <1> 15 <1> 0 <1> 20 <1>
18 <1> 21 <1> 24 <1> 28 <1>
the result haven’t changed
Note: you may try two regular multiplication between 2nd order tensors but you will get an exception (because I didn’t implement it yet unless I understand)
About understanding all of these I didn’t imagine that I will go into all of this details (so I really walk into it as it appears to me)
I realized that (vectors, marices, and tensors) are another types of quantities
thats why their becomes a must if I would say.
what else ??
yep I tried to speed up things so I tweaked my parser and made a lot of improvements (but as an inner feeling something is not right, the speed is not satisfactory)
that was a long post as usual
good to write again
and see you safe and sound later
Symbolic Algebra Project
I have started Symbolic Algebra Project in CodePlex
http://symbolicalgebra.codeplex.com/
WHY ??
Because I am a Silly Guy WHO really like to reinvent the WHEEL
I think this project will be the same concept of GiNaC
however being .NET natively should make my hear rest in peace this way
I am going to add derivatives also so wait for it to be released
(MAY be AfTeR long Time
)
Work and Torque (Solution)
I am really sorry
I didn’t notice that I haven’t posted how did I solve the dilemma of Torque and Work Problem
however the solution was there in my discussion of quantity System http://quantitysystem.codeplex.com/Thread/View.aspx?ThreadId=23672
and also on this post of my personal blog http://blog.lostparticles.net/?p=28
Problem Core: Length
Simply I defined TWO Length Types
Normal Length (NL)
This is the normal length that we refer to it in our daily life
Radial Length (RL)
This is the radius length that have an origin point in center of circle
Quantities
Work: Force * Normal Length
Torque: Force * Radial Length
Angle: Normal Length / Radial Length
In quantity system I made the L dimension as NL+RL
CAN YOU SEE ANGLE
I made it explicitly a quantity that is NOT dimensionless
and THIS SOLVED ALL my problems of this Problem
I won’t argue much let us test
Torque * Angle = Work
F*RL * (NL/RL) = F * NL <== see what I mean
Torque * Angular Speed = Power
F*RL * (NL/RL*T) = F*NL/T <== where T is the time.
so you may wonder about Angle and Solid Angle
in SI they are all dimensionless but in Quantity System YOU CAN’T consider them like this
(By the way I’ve break the checking for these two quantities to be summable with dimensionless numbers – just to keep the fundamentals as it is although I am not convinced and I may remove it in future but damn it I need support from any physics guy)
ANGLE : NL/RL
Solid Angle: NL^2/RL^2 because its area over area
Frequency = 1/T
Angular Velocity = (NL/RL)/T
do you remember the conversion between RPM to frequency
RPM (Revolution Per Minute) is a Angle / Time
lets test the law
Omega = 2*pi*frequency
pi: radian value which is NL/RL
Omega = (NL/RL) * 1/T = (NL/RL)/T which angular velocity
Discoveries
PI value
PI is ratio of any circle‘s circumference to its diameter WHICH MEANS (NL/RL)
this is the same value as the ratio of a circle’s area to the square of its radius WHICH MEANS (NL^2/RL^2)
which corresponds to radian unit and stradian unit for angle and solid angle quantities.
Reynolds Number
I am not holding back ( Reynolds number is a dimensionless number that measure inertial forces to viscous forces)
WHY we always differentiating between Flow in Pipes and Flow on Flat plate
let’s see with normal length in quantity system
it shows it is a dimensionless quantity
ok let us force my theory about flow in pipes
the pipe have a diameter and Reynolds number is calculated by rho*v*DIAMETER/viscosity
so let me add d as a diameter and solve again
Qs> d=0.5<m!>
RadiusLength: 0.5 m
Qs> rho*v*d/mue
DerivedQuantity: 0.375 <kg/m.s^2.Pa>
NOTE: Adding ‘!’ after the length unit will mark the quantity as Radial Length quantity.
ERROR it shouldn’t be DerivedQuantity at all it should be Dimensionlesss
so there is another term that should be fixed. Do you know which term ???
lets try the velocity with vr=0.5<m!/s>
Qs> vr=0.5<m!/s>
DerivedQuantity: 0.5 <m/s>
Qs> rho*vr*d/mue
DerivedQuantity: 0.375 <kg/m.s^2.Pa>
ALSO ERROR
ok let us try the density
Qs> rhor = 3<kg/m!^3>
DerivedQuantity: 3 <kg/m^3>
Qs> rhor*v*d/mue
SolidAngle: 0.375 <kg/m.s^2.Pa>
CAN YOU SEE THE SOLID ANGLE Quantity
do you remember the above argue about Solid Angle is dimensionless number
can I pretend now that reynolds number for pipes is CORRECT ???
the new density which is kg/m!^3
This is driving me nuts
Pump Affinity Laws
Also pump equations led to the same SolidAngle Quantity not DimensionLess one
Epilogue
I’ve said what I’ve discovered till now about this problem I hope that may be someday someone explain to me or convince me that Angle is really a Dimensionless number after all of this and that my assumption about Torque and Work is Wrong.
Catching Up
Prologue
I want to catch up with what I’ve implemented so far.
This is not what’s new, but rather a glimpse on what I’ve done and still remembering it
I really need to organize my thoughts about what is happening in this project
the scattering thoughts are frightening me :S
Tensor Parsing:
I want to add Tensor badly in Qs because I wasn’t able to understand it I had to include it
however I’ve Added Tensor parsing
Qs> <|4 3;3 2| 4 5; 5 3 |>
Yes this is a 3rd rank tensor or you may see it as a two matrices in the Z-Axis
what about 4th Tensor (You may ask) ??!! Bear with me I am still thinking of a natural syntax to add it.
also I would like to remind my self that Stress tensor is a 2nd rank tensor (which looks like matrix but with special operations)
using <|…|> syntax you can define also zero rank tensor up to 3rd rank tensor (what will I do with this?? I don’t KNOW)
Text
yes I included the text at last (I was struggling against putting text in Qs, but it was necessary :S or let me say I couldn’t come up with another strategy.
Qs> ml = “c d e f g a b c>”;
Qs> Music:Play(ml + ” ” ml); #Music:Play is an extension function that play midi and the music library is 100% implemented by me (I mean sequencer part and music DSL as it contains eastern tones also – another story indeed)
and yes you can add text to text, also imagine you can add text to number
Qs> 4 + “44″
DimensionlessQuantity: 48 <1>
but the opposite is will not act like this (because I am casting to the left type always – which is the first one in fact)
What is meant by adding text is to differentiate between sending text to functions and sending other types.
so Windows:MessageBox function now accept Text
Windows:MessageBox(“Hello There”) will result into messagebox ofcourse (just try it)
to escape quotation mark use back slash “\”hello\”"
Functions
I like it
(do you ?!?
:))
Function Extensions
With C# or any .Net language frankly {put static class with static functions under Qs.Modules namespace}
the class name becomes namespace in Qs.
- I’ve enhanced the function binding so you can write your C# native function with native numerical type and I will cast it to you without you notice it ( no more QsValue as a parameter type), however this will add other processing lag (but who cares
everything is cached after this)
also I can map vector to array of numbers so use ff(int[] ia) declaration
it will work
Why I was enhancing the extension functions {simply because I am planning to include OpenGL } asking me why :O :O :O ??
silly, every numerical system has a 3d device to render to it.
but frankly I am thinking of visualizing Scalars, vectors, and tensors into 3d conceptual drawings
however OpenGL is a very far idea
emmm
don’t forget the Graph:Plot(xvector, y1vector) it really draws and I consumed a free opensource library to do it.
may be a freakin plot but hey it works and I can visualize some quick samples indeed.
Function Named Arguments
Quantity System Engine can consume different declaration to the function with the same name
however you must change the parameter names
that’s why you can call the function with named arguments (shhsh argument==parameter so I use it interchangeably)
all the following are correct declarations
f(x) = x
f(y) = y^1.5
f(z) = z^2
f(er) = er/4
f(g) = g+9/g^2
Note: the first function name declared is the (default function) the one you call it without specify named arguments
to call any of these functions use the ‘=’ equal sign
f(g=5)+f(er=3)
Function Variables
Now you can treat the functions as normal variables because they are inherited from QsValue (internal structure of Qs)
so that when declaring
u(x) = x^2
v(x) = x/2
w(x) = x*9
r = @u+@v+@w # <== this sum all functions and generate new function in r
r(x) = x^2+x/2+x*9
and don’t worry about parameters, as they are merged for you with any number of them
all basic operations supported (simply I merge the function declaration text with the desired operator
)
HOWEVER this is going to change after I put the symbolic algebra library
(another library I am making)
What about named argument functions??!! (clever question)
imagine you have a x-component speed in u function
u(x) = x
u(y) = y/2
u(z) = z^2.1
you can write
u = @u(x) + @u(y) +@u(z)
and yes
Qs> u(3,4,5) #IT WILL Work
because you may not remember but I encode the functions in the memory based on their arguments number also
so u(x,y,z) now is the default function of u in 3 arguments
(impressive for me I admit)
Sequence
my beloved feature.
sequence now can return a function series
for example
e[n](x) ..> x^n/n!
e[1](1) gives 1
however calling the sequence without specify argument (IN argument enables sequence)
e[1] gives _(x) = x^1/1!
and you can assign it to a function also
let me make it fast
exp = e[0++20]
gives
_(x) = (x^0/0!) + (x^1/1!) + (x^2/2!) + (x^3/3!) + (x^4/4!) + (x^5/5!) + (x^6/6!) + (x^7/7!) + (x^8/8!) + (x^9/9!) + (x^10/10!) + (x^11/11!) + (x^12/12!) + (x^13/13!) + (x^14/14!) + (x^15/15!) + (x^16/16!) + (x^17/17!) + (x^18/18!) + (x^19/19!) + (x^20/20!)
which when you can call your exp normally
exp(1)
Shifting Operators
I’ve added ‘>>‘ right shift as C family and ‘<<‘ left shift
simply the operators is shifting vectors and matrices
not implemented yet for tensors
and also you will find these operators starting of Qs 1.1.9.94 release Changeset 39690
I hope I listed things that I remembered for now
and chaao
‘When-Otherwise’ Condition Expression
In Quantity System Calculator (DLR) I’ve implemented a new way of conditional expression that can be written continuously and fits into one line.
I called it ’when-otherwise’ expression
‘[true result] when [test] otherwise [false result] when …’
let us define a simple function with it
f(x) = x when x< 10 otherwise x^2 when x<20 otherwise x^5
I know that I am going against the famous ‘if-then’ statement, however ‘if-then’ statement is an imperative syntax, and I needed a functional statement that fits in one line.
when I was thinking about this new syntax I also didn’t ignore the question syntax of C,C++, C#
‘Test?True Part, False Part’ , but also this syntax is somehow complex to use, and give me a headache actually.
thats why I invented it this way. You can see that the result part precede the condition part and the syntax is truly easy to remember (hard to type) but easy to extend.
About Scalar and Vector
Few Words
In my design of this calculator (although I am afraid it is evolving into language)
I made a decesion about making its types like the mathmatical numbering types
1- Scalar
2- Vector
3- Matrix
4- Tensor (LATER LATER I HOPE)
The Scalar in Qs is a normal number with a unit.
(remember the idea of this calculator is that all numbers are quantities)
so Scalar in my programming model for now is holding a quantity which is number+unit
and ofcourse Vector is an array of Scalars
the great thing I’ve discovered is that there are two Vector types
Vector Types
a) Euclidean Vector : This is only a three component vector
This Vector is always expressing the point in the space
It has the famous Cross Product Multiplication (implemented in Qs as ‘x’ letter)
b) Normal Vector : This is an array holding a lot
This Vector is any number of components and can have Dot Product and
I am dealing with this types as a whole entity, I am not taking the approach of element by element calculation
because I am not convinced again about this approach :S
Multiplication Operators
So after great thinking and a lot of fancy shadows in my tiny room I made a three multiplication operators
1- Ordinary multiplication ’*’
2- Dot Product ’.’
3- Cross Product ’x’ <== YES it is the X letter
[Who cares??!] my language after all
Power Operators
and to make it worse I made a distinction between the three Power operators which are attached by meaning by their associated Multiplication operators
1- Ordinary Power ’^’
2- Dot Power ’^.’ Which is different completely from the matlab ‘.^’ element power operator
3- Cross Power ‘^x’
Matrix Exponential
So you Remember about the sequence implementation
with sequence implementation I can make functions like sin, cos, and my famous Exponential sequence
Qs> e[n](x) ..> x^n/n!
then wrapping the sequence into a function call
Qs> e(x) = e[0++50](x)
This functions is working great in scalars
have you tried it with matrix ??
I tried it and succeed
look into this wikipedia page Matrix Exponential (by the way you should donate to wikipedia)
so if you passed a matrix to the function it will be treated as a whole matrix not element by element like matlab for example.
and this was an advantage from my model.
Power Dot
another funny thing is the ‘^.’ Power Dot when applying it to the vector.
by the way in any Power operation in Qs I get internally the first term to be Identity
for example in scalar it is 1<1>
Vector: {1<1> 1<1> … } with the number of the components
Matrix Identity : Which is diagonal ones in a matrix with the same dimensions
so when applying the Power dot to vector
first item or zero repetion is the identity term, then by the power number I multiply the vector in the identity for repeat one and etc.
the funny thing is that dot product in vector gives a scalar value then scalar is multiplied by vector again to give a vector value then a scalar
so when you make a power dot to an even exponent the result is vector, and when you make an odd exponent it will be scalar.
pretty strange
Relation Operators
Relation operators are <, >, <=, >=, ==, !=
ofcourse it is well known for scalars
but what about Vector and Scalar
I solved this issue by comparing the norm of the vector with the norm of the scalar
review Vector Norm so The comparison is based on Norm which is Absolute in Scalar and Magnitude in Vector.
Finally
As you can see implementing the Scalar, Vector , and Matrix as a first citizen entities in Qs is overwhelming
and a lot of challenges appeared.
however I hope that next post to be about my new innovative idea of the Comparison statement itself
see you
Namespaces
ok I mentioned before that I’ve implemented namespaces in my quantity system
Why I’ve made this ??
because simply I wanted to add the possibility of adding multi functions in a form of external libraries.
Namespace Operator or Separator
- in C++ the name space is two colons :: like the famous std::vector
- in C# the namespace is a dot . like System.Console.WriteLine
- in xml the namespace is single colon :
so I’ve choose the xml namespace operator because I find it shorter than C++ namespace and more understandable than the dot of C#.
because I’ve always considered the dot . to separate between the object and its members
Built in Functions
like any respectable language you have some built in library for mathmatical functions
you can find the functions and constants to be used
I’ve defined Math namespace to hold some (but not all) functions
Math:Sin, and Math:Sinh
Math:Cos, and Math:Cosh
Math:Log, and Math:Log10
and Math:PI as a constant
User Defined Functions
you can define your user defined function in any namespace you desire
just write the namespace:function and suddenly you have a new namespace if it wasn’t there before
Qs> G:V(x,y) = x(y) # function that take other function as a parameter
Qs> g:v(Math:Sin, 8 ) # passing built in sin function with 8
and as you can notice the functions and namespaces are all case insensitive.
User Defined Functions (External Modules)
and yes you can define your functions outside the quantity system
but the feature is not completed yet
however please try
Qs> Music:Play(c d e f g a b c>)
if you hear the music from your speaker then you are a windows guy
and you can save this as a midi file too
Qs> Music:SaveMidi(c d e f g a b c>, tt.mid)
please find the result file into the program directory.
About DLR and other funny things.
DLR
(Dynamic Runtime Library) is microsoft latest technology that will prove itself as long as .NET struggle to survive.
however this is an old news, you must heard about IronPython, and IronRuby.
My Quantity System Calculator is build over the DLR expressions. This has permitted me to do a numerous things in my calculator.
I added functions, new sequence concept, and lately implemented NameSpaces.
the latest DLR version is 0.92 and you can get it from http://dlr.codeplex.com
Funny Things
if you download the last Quantity system sources from the source panel in code plex
and run this code
Qs> Sin[n](x) ..> ((-1)^n*x^(2*n+1))/(2*n+1)! #Sin sequence
Qs> Sin(x) = Sin[0++50](x) #Sin function
the first function from the Math:Sin(8) is a direct calling for the .NET Math.Sin function
and the second Sin(8) is a call for my sequence-series implementation.
well I have double checked by the windows calculator and the result was the same as the .NET library.
Windows Calculator Sin(8) in radian mode: 0.98935824662338177780812359824529
So which one is the right approximation
let’s try to call the SIN series with less items
Qs> Sin[0++20](8)
DimensionlessQuantity: 0.989358246623414 <1>
ok also have an error
let’s try it for many more items.
Qs> Sin[0++160](8)
DimensionlessQuantity: 0.989358246623403 <1>
we are back to the same result
damn it
what should i trust more?? my sequence-series implementation or the .NET Sin implementation, and what if this was obtained from the FPU ???
I really don’t know.
Quantities! are they all dimensional uniques??
Small Talk
Is it really important to have a unit associated to value.
I really don’t know the answer
I assumed it is important to know the dimension of the quantity.
* To be able to sum, and subtract different units but same dimension quantities.
* To be able to predict that the outcome of the division and multiplication process of quantities.
* To deduce how can I reach specific quantity from another quantity.
Article Begins
So let us focus on the important objective of the library and its calculator.
The main objective was to replace the Dimensionless Variable Concept into Quantity Concept
Reviewing the SI model there are 7 basic base units that form all of our Quantities experience in Life
do I really have to list them ?? I think I should
1- kg (kilogram) [Mass]
2- m (metre) [Length]
3- s (second) [Time]
4- A (Ampere) [Electric Current]
5- K (Kelvin) [Temperature]
6- mol (mole) [Amount of Substance]
7- cd (candela) [Luminous Intensity]
these are 7 base quantities with 7 base units
(I feel they made it 7 so we can tie our self to the 7 number like 7 days and more legendary 7s)
if you encounter a fluid course in your study you will encounter the dimensional analysis course that teach you MLT system
the lecture will teach you about the dimensionality of the quantity
so Length is equal to M=0 L=1 T=0 or for simple writing M0L1T0
Speed or Velocity: M0L1T-1
Acceleration : M0L1T-2
Based on the dimensional Analysis course any quantity in universe have a unique dimensions
and we have special quantities that have M0L0T0 which means Dimensionless quantity
Types of Dimensionless quantities are many
- Mach number.
- Reynolds number.
- Affinity Laws.
also based on professors philosophy Dimensionless numbers are a high class numbers because they always give a lot of information.
for example if I say I am traveling to Alexandria from Cairo
and you asked me about the distance I covered from the beginning of the trip!!
If I told you I passed 100 km from the distance you will wonder and may feel that information is not enough.
But if I told you that I passed half of the distance to Alexandria
you can deduce many things.
because you know roughly when I begin traveling.
you know the maximum speed between towns.
you can deduce when I should get there and in what hour.
practically you can sense and understand whats going on and what will happen.
or simply REALIZE
so dimensionless numbers are important for our life
Different Quantities and The same dimensions
BACK to quantities again
Force quantity are taken from the classical newton equations and it is Mass multiplied by Acceleration
F = kg * m/s^2
this is awesome so Force as a derived quantity = M1L1T-2
(NOTE: in dimensional analysis there is another approach to define dimensions by FLT system due to the fact that we can’t get mass without knowing the gravity of the location we are on now
however let us stick with MLT)
BUT can we REALLY say in honest words that all quantities have a different unique dimensions ??
{NO}
and let me list them as I can remember for now:
1- (Work) vs (Torque):
———————————————–
The two concepts are referring to the same units which are Joule, calorie, or BTU
The same as Torque
2- (Dimensionless) vs (Angle)
——————————
Angle is measured by Length of circumference to the length of radius.
it will be dimensionless
3- (Angle) vs (Solid Angle)
—————————-
as angle units, steradian for solid angle
Solid angle is Area to Area
4-(Frequency) vs (Angular Velocity)
————————————
Frequency is equal to M0L0T-1 or 1/s i.e. (1/Time)
Angular Velocity = rad/s
and rad = 1 because it is dimensionless.
so summing frequency with angular velocity should be logically correct (because they resemble the same dimensions) WHICH is WRONG in literature.
do you remember the equation of Omega = 2 * Pi * f
where
Omega: Angular Velocity
f: Frequency.
5- (Luminous Intensity) vs (Luminous Flux)
——————————————–
The first quantity is lm/sr and the second one is (cd.sr)=lm
Units can differentiate between the two quantities
but the unit is dimensionless and in SI standards you can replace either rad and sterad with which the dimensionless unit.
Conclusion:
- These quantities will prevent any implementation to differentiate between quantities by dimensions and in return will prevent the intelligence of knowing the outcome quantity of an operation
- You can’t take the dimensional analysis approach in differentiating between quantities.
So in return most of the implementation of dimensionality of variables took the shorter approach of supporting only units side.
but where is the quantity ???
can the unit approach differentiate between Torque as N.m and Work as N.m
if you implemented the J (Joule) unit you will have to invent a unit for Torque also, so you can make a distinction between units.
But how about the rest of quantities.
In my next post I’ll introduce to you the hypothetical solution of this dilemma and how I solved this problem in my Quantity System implementation.
Thank you
Ahmed Sadek