The value that should be

This post is on the Code Plex  web site and related to my Quantity System Framework

The value that should be

I am writing it here to keep the dates of posting synchronized 😀  codeplex is the site and this is my site  {ooooooops   I hate sharepoint by the way }

————————————————————-

Peace upon you The one who is lookin 🙂

If you didn’t find the CTP version of F#  that contain the measuring supported in the compiler then find it here F# September 2008 CTP Release .

I tried it and found it interesting 🙂 congratulation to the F# team.

however,

today I was willing to talk about  the value of the quantity, suddenly I had an argument with Patrick about what the value should be?
he tried to convince me that value should be some sort of matrix {like matlab variables} and then if I want to have a scalar then I can use {1×1} matrix

well I admit that he has a point, but again I wasn’t satisfied 🙁

dealing with matrix in this early stage will be a headache for me also in any case I can’t compete with matlab either 🙂

I was playing with F# while reading Andrew blog about its implementation of units. when I read this statement

“Next time,
we’ll write types that are generic in units-of-measure. This makes the feature extensible: if floats with units aren’t what you want, just define your own types!”

I figured out that I can make the value of the quantity to be generic.

as you may know I was from the beginning insisting about making the Dimension of the quantity is my main concern, and not the units. so I am speaking Quantities not Units of measure. [its a huge difference] 🙂

review my latest discussion about the length problem.  { again making Angle Quantity was like a charm it is dimensionless and its detectable }

however as I am thinking about the syntax all the time I found my self writing this form of code

Velocity<float> vf1 = 20.8f;
Velocity<float> vf2 = 2.09f;

Velocity <float> v = vf1 + vf2;

and in that way I am emulating the Nullable<T> class

however the imagination didn’t stop here

as I am concerned about the Quantity not the value that it hold

then why I can’t do this ??

Velocity<int>          vi1 = 55;
Velocity<string>    vi2 = “Too Fast”;

var v = vi1 + vi2;              // <= Can I really achieve it

as you may notice the addition is valid for the same quantity even if the storage type is not the same

try to imagine that you have a storage type called  ‘Tank’

and another one called  ‘Bottle’

struct Tank;
struct Bottle;

if you make Volume<Bottle> + Volume<Tank> :    [ To be read like this Volume of Bottle Added to Volume of Tank ]

this meaning is really inspiring me again. And you will have the right to define your plus operator to sum what you want {I’ll just call your operator}

Another example

Visocity<Honey> + Viscosity<Oil>

Clear example like

Mass<Moon> + Mass<Earth> + Mass<Proton>

I hope it make sense

Again I am dealing with Quantities not units.

Quantities are smarter than units

Quantity can tell you about realizable meaning but units don’t tell much

And reviewing the length problem you know that Work is having the same units of Torque which again is not permitted in any case.

Again my assumption about Length to be Arc Length and Normal Length may be wrong but until now I managed to solve the problem of Work and Torque and this what’s keeping me up.

In the next discussions I want to clarify the meaning of Quantity-Value-Unit and how can they be ordered formed together.

Are they tightly coupled or loosely coupled?

Can I imagine them as a unit of three or a 2-1 or 1-2 or 1-1-1?  😀 a bit like soccer game

Thanks for you all.

—————————————————————

however I wanted to comment about something

we know as  a programmer that object is having properties

so one could say farewell you can  make

Earth.Mass = 50

Spoon.Mass = 30

and then he will go to the conclusion that we can inherit from the Class MassObject

or even Implementing interface  class Earth:IMass

why I am writing this ??

because I smell something wrong here

keeping thinking about inheritance then we should say that PhysicalEntity class should have all Quantities like Mass, Weight, Volume, and Viscosity

then we can inherit from this class obtaining Earth, Spoon, and Proton

but let us revise Proton and Electron which they have Electrical Quantities

do I have to  make another class for the electrical Quantities

lets take a Fish class

can Fish have  Fish.Volt    ???  (yes it can be but it is meaning less)

what I want to say that Object Oriented was describing the Shape of the object but not the content of the object

back to Fish

Fish.Swim() will result in movement from  x1, y1, z1, t1 to x2, y2, z2, t2

in fluid dynamics we can say safely that fish density may be changed by location, and time

however Density<Fish>  (Density of Fish  is by all means reasonable and realizable)

so in thermodynamic system there was differentiation between internal properties and external properties

external properties are depend on internal properies

does this mean that describing object in class shouldn’t include its external properties ??

however as you alawys my reader know about me I am just thinking but not sure and don’t know what to conclude after this

chao 😀  😉

Leave a Reply

You must be logged in to post a comment.