Knowbotron's Unit Conversion Calculator
Tips and Tricks on Knowbotron's freeware unit conversion calculator Dicom. The calculator is the first of it's kind that not only converts units but considers units into calculations.
Tuesday, September 22, 2009
Friday, December 29, 2006
New Dicom Calculator User's Forum
Knowbotron Forum (forums.knowbotron.net) is a new place to discuss products from knowbotron. The new Dicom user's forum there is dedicated for Dicom users only. The old Dicom forum is therefore discontinued. Please discuss anything and everything about Dicom in this new forum.
Sunday, August 20, 2006
On Document Calculation
In Dicom Calculator you can evaluate expression, right on the input document, without pressing [F8] and generating an output document. To do so, write any expression on Dicom input document. Select the expression and press [F4] and [F5].
[F4] will apply the begin and end tag to the expression and [F5] will calculate the expression and display the result immediately.
Example:
- Write 5 ft^2 + 3 m^2 on the input tab of a new document.
- Select the expression with your mouse.
- Press [F4] and then [F5], the result will be shown immediately after the expression as: 3.4645152 m.^2
Note: Dicom will replace exponentiation (^) symbol with superscript in the process.
Tuesday, August 01, 2006
Memory and Variable in Dicom Unit Conversion Calculator
Dicom can store values in memory. In dicom you can also store values in variables.
Named Memory Variable
Example:
x = 1
y = 3 ft.
In the above examples values 1 and 3 ft are stored into variables named x and y. You can later reuse these named memory variables in other expressions.
Example:
z = x + 10 (result is 11)
wd = y + 6 inch. (result is 1.0668 m.)
Unnamed Memory Variable
In addition to named variables as in the examples above Dicom also internally stores calculation results in memory locations. These are so called unnamed variables and can be recalled in an expression using # operator. Dicom remembers recent 16 results in unnamed memory locations starting with 1. The memory location 0 however always stores the latest calulation result.
Example:
1 + 2 + 3 (result is 6, stored in memory location say, m)
#0 + 4 (result is 10, will be stored in memory location m+1)
#0 + 100 (result is 110, will be stored in memory location m+2)
...
...
#(m+1) + #(m+2) (result is 120)
In the above example the result of the first expression (i.e. 6) is stored to unnamed memory variable location no. say m. The second expression recalled this result using #0 and add up 4 with it. As you may guess the result of the second expression (which is 10) will be stored into next memory location, m+1, and so on. In the last expression location (m+1) and (m+2) are recalled and added together.
You can define and use as many named variables as you like. However, you should be careful in selecting the name of the variables so that those do not conflict with Dicom's 650+ unit symbols, 150+ functions and other reserved words. A recommended convention is use m_ as a prefix to name your variables.
Example:
m_width = 3 m.
m_height = 12 m.
m_area = m_width * m_height
Note that you can assign values to a named variable but you can't do the same to unnamed memory location.
Example:
m_width = 3.5 m. (is valid)
#0 = 3.5 m. (is invalid)
You can store both dimensionless values and units to variables but during calculation don't mix things up. The exression you want to evaluate always need to be homogeneous in terms of dimensions.
Example:
m_width + 6 (is invalid)
m_width + 6 inch. (is valid)
Length of a Dicom variable name can be a maximum of 31 characters.
You can display all used named and unnamed memory variables from Dicom explorer. Click on View > Explorer and then click on Memory tab. The nodes Numbered memory and Named Memory will display the unnamed and named variables you have used in current the session.
You can use RECLAIM command to refresh dicom memory. Alternaetly, you can right click on Memory node on the dicom explorer Memory tab and select Reclaim Memory.
This will erase all the named and unnamed memory variables and reclaim the memory for reuse. However, to reflect the refresh in Dicom explorer you need to right click on the root node Memory and select Refresh Memory.
Wednesday, July 26, 2006
Currency Conversion in Dicom
Currency in Dicom is treated like any another physical quantity (like mass, length, time, etc.). So syntax to convert one currency from another is same as you convert units.
Example:
10 USD to EUR
The above will convert 10 US dollars to Euro. Note that Dicom's 3 character long currency symbols are standard ISO symbols that are also being used by renowned systems like xe.com, SAP, etc.
One advantage of treating currency as another physical quantity is, you can calculate expression that involves currency along with other units.
Example:
10 USD/mi to EUR/km
Updating Currency Rate
Needless to say that Currency value is ever changing. So, you need to update currency rate. In Dicom it is plain and simple, you just assign the new value.
Example:
1 EUR = 1.1 USD
1 GBP = 1.7 USD
Unfortunately, version 4.0 do not automatically update currency from internet. You can, however still update using a batch file.
Updating Currency Rate in a Batch
Write down all your currency assignments as in the example above in a text file. You can use notepad to edit your file. You may separate each assignment either by newline or by semicolon.
Save your file.
In Dicom calculator enter the following command:
RUN '<input file>'
Replace <input file> with the actual path and filename. Single quotes are required. Press enter. Dicom will update the currencies as instructed in the file.
Dicom's RUN command can take an optional output file name, like:
RUN '<input file>' '<output fle>'
You may use the above syntax to check out the results and errors if any. You may collect up to date currency rate from www.xe.com.
Note:
You may use RUN command for other purposes also e.g. to set up Dicom environment. The input file is not a Dicom document file but a batch of calculator commands and expressions. So input file content should be simple text file containing barebone commands, expressions and functions (without any document tags and document specific commands) that you can execute from Dicom calculator.
Monday, July 24, 2006
Solving Equations in Dicom
The process of solving this equation is - at first we assume a value of x and then calculate the right hand side (RHS) with the assumed value of x. We then better our assumption with the new value of x as the calculated value and continue this process untill assumed value and calculated value converge within the range we can tolerate.
If we solve the equation manually with an assumed value of x=1, the result will be as follows:
Using Dicom this process can be carried out automatically. To do this we need to use expression opeartor (:=) and Loop() function in Dicom.
Expression Operator
The expression operator is an unique feature of Dicom conversion calculator which tells Dicom to remember the expression and recalculate whenever a variable of the expression is changed. This operator is different from assignment (=) opeartor.
In short, the difference between expression operator (:=) and assignment operator (=) is that the expression operator assigns expression to a memory variable, while the assignment operator assigns value to a memory variable.
to see how expression (:=) operator works in Dicom, enter the following in Dicom calculator and press enter.
x=1; y
You will see the result being1.7099759466767. Now change the value of x=1 to x=2 and press enter. Voila, the value of y has also been changed to 2.80203933065539.
Loop() Function
Now we need to evaluate y with calculated value on each iteration. Dicom Loop() function syntax is as below:
Loop( intNum, 'exprn')
Where, intNum is an integer number denoting the no of iterations and exprn is the expression to iterate and should be written within single quotes.
We want to assume the first value of x=1; then we calculate the value of y and assign the calculated value to x. So expression we want to iterate is 'x=y'. Let's iterate it 20 times. Below is the resulting dicom instructions:
y := (17*x-12)^(1/3) ; x=1; Loop(20, 'x=y')
Cut and paste the above instructions in Dicom calculator. You will get the value of x after 20 iteration and it is 3.71021341594725.
Let's recalculate it for 100 iterations:
y := (17*x-12)^(1/3) ; x=1; Loop(100, 'x=y')
And we get x= 3.71021358587913
To clear out Dicom memory i.e. any previous assignment, expression, etc. you may use RECLAIM command before issuing new instructions to Dicom that stores memory varables.
Example:
Grab a copy of Dicom, it is absolutely free. You can download it here.
Thursday, July 20, 2006
Date and Time Functions in Dicom Unit Conversion Calculator
Dicom conversion calculator has numerous built in date and time functions. Discussed here are some of the most commonly used ones:
- Cdate( [date_args] ) - returns date part of the date/time specified by the parameters
- Ctime( [date_args] ) - returns time part of the date/time specified by the parameters
- Cdatex( [date_args] ) - returns date and time specified by the parameters
date_args in each of the cases is optional. When date_args is omitted the functions return current date and time as appropriate.
That means:
- Cdate() = Current Date. The Today() function also produces same output.
- Ctime() = Current Time
- Cdatex() = Current Date and Time. The Now() function also returns same output.
Date Parameters
In place of date_args you can optionaly specify day, month, year, hour, minute and second.
date_args = day [, month [, [year [, [hour [, [minute [, second ] ] ] ] ] ]
The defults for missing parameters are assumed as month=January, year=0001, hour=00, minute=00, and second=00.
Thus, the valid syntaxes for the Cdate() function are:
Cdate() = current date
Cdate(20) = 20 January 0001
Cdate(20,2) = 20 February 0001
Cdate(20,2,2006) = 20 February 2006
Ctime() = current time
Ctime(20,2,2006) = 00:00:00
Ctime(20,2,2006,13) = 13:00:00
Ctime(20,2,2006,13,30) = 13:15:00
Ctime(20,2,2006,13,30,5) = 13:15:05
Cdatex() function works in a similar manner also.
There are many date/time related functions in dicom that require date_args, for example:
- Age( [date_args] ) - Seconds elapsed between current and speified date/time
- Cdow( [date_args] ) - Name of the day of the week
- Cmonth( [date_args] ) - Name of the month
- Day( [date_args] ) - Day of the month
- DayNum( [date_args] ) - Day serial of the year, 1 January being 1st day
- DaySerial( [date_args] ) - Day serial since 01-Jan-0001
- Dow( [date_args] ) - Day of the week (0=Sunday, 6=Saturday)
- DowISO( [date_args] ) - ISO day of the week (0=Moday, 6=Sunday)
- Month( [date_args] ) - Month no (1-12) of the year
- Second( [date_args] ) - Seconds elapsed since 01-Jan-0001 00:00:00
- WeekNum( [date_args] ) - Week no (1-52) of the year
- WeekNumISO( [date_args] ) - ISO week no (0-52) of the year
- Year( [date_args] ) - Year of the date
Note that in each of the above functions date_args are optional and if you don't specify it, current date/time will be assumed.
You can assign the ouput of Cdate(), Ctime() or Cdatex() functions to a memory variable and use that variable in place of date_args as well.
Example:
LandingOnMoon = Cdate(16, 7, 1969); TimePassed = Age(LandingOnMoon)
You may also use: Age(16, 7, 1969)
Tuesday, July 18, 2006
Controlling Precision and Presentation - DECIMAL, DIGIT and FORMAT
- DECIMAL is used to set number of digits after decimal point, large value is displayed in normal notation
- DIGIT is used to set number of significant digits, large value is displayed using exponential notation
- FORMAT is used to format the result
Syntax of DECIMAL Command
[SET] DECIMAL []
n can be any value between 0 and 18. If it is not specified or 0 the decimal is reset to default 15.
Example:
DECIMAL; 2.34^15 = 345332.824799534
DECIAML 2; 2.34^15 = 345332.82
Syntax of DIGIT Command
[SET] DIGIT []
n can be any value between 0 and 18. If it is not specified or 0 the decimal is reset to default 15.
Example:
DIGIT; 2.34^15 = 345332.824799534
DIGIT 2; 2.34^15 =3.5e+005
You may notice that DIGIT or DECIMAL without any value specified defaults to same format, which is 15 significant digits with exponential form for large value.
Syntax of FORMAT Command
[SET] FORMAT ['']
spec is the format specifier enclosed within single quotes ( ' )
The spec follows the C/C++ format convention. Some examples are shown below:
Example:
FORMAT '%x' ; 255 = ff (hexadecimal)
FORMAT '%i' ; 13/3 = 4 (signed integer)
FORMAT '%f' ; 13/3 = 4.333333 (6 decimal float)
FORMAT '%.15g' ; 13/3 = 4.33333333333333 (dicom default i.e. 15 decimal float, may use exponential notation when required)
Clik here to visit Knowbotron's web site.
Monday, July 17, 2006
Dicom Conversion Calculator can Handle Binary, Octal, Hexadecimal and Arbitrary Based Numbers
In Dicom a value without any base indicator is a decimal value as usual.
Example: 100, 1.234, 1e-10 etc.
However you can specify the base value of a number in Dicom. To do this you need to follow the syntax below:
0b<base value>:<number>
Here, base value can be any value between 2 and 36
Example:
Binary number or base-2
0b2:10101010 (decimal 170)
Octal number or base-8
0b8:1234567 (decimal 342391)
Hexadecimal number or base-16
0b16:2345FF (decimal 2311679)
An arbitrary base-36 number
0b36:19ADZ (decimal 2112983)
Note that the digits and letters allowed in an arbitrary N (36>=N>=2) based number are first N number of digits and letters from the list below:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z
Thus for a binary number only allowed digits are: 0 and 1.
For an octal number allowed digits are 0 to 7.
For a hexadecimal number allowed digits are 0 to 9 and letters A to F.
For a 36 based number all 36 values (0 to 9 plus A to Z) are allowed.
If you don't specify digits and letters from the allowed range an "Unknown string" or "Missing operator" error will occur.
Converting a Decimal Number to a Base-N Number
You can use FORMAT command to specify the base value to be converted to. The syntax is as below:
FORMAT '0b<base value>'
Example:
FORMAT '0b2'; 170
= 0b2:10101010
FORMAT '0b8'; 342391
= 0b8:1234567
FORMAT '0b16'; 2311679
= 0b16:2345ff
FORMAT '0b36'; 2112983
= 0b36:19adz
Note that FORMAT command without any specification will reset Dicom to decimal value formatting.
Converting a Base-X number to a Base-Y Number
Set FORMAT to specify base value Y to convert to. Enter the X-based representation of the number to convert.
Example: Convert binary 10101010 to hexadecimal number
FORMAT '0b16'; 0b2:10101010
= 0b16:aa
Sunday, July 16, 2006
Runtime Modes of Dicom Unit Conversion Calculator
Dicom unit conversion calculator can run in any of the four modes described below.
Compact Mode - Document and Calculator view, suitable for adhoc calculation.
Normal Mode - Explorer, Document, Calculator, and Converter all are on stage (in the figure above). The normal view is suitable for document based mass computation.
Custom Mode - As configured by you. As an example you may want just the calculator to be in front when you run Dicom
Tray Only - Only tray Icon view, suitable if you always want dicom to be active and ready for calculation and conversion.
You can select runtime mode from the menu, choose "File > Preferences... > Mode Settings > Startup Mode"
Dicom unit conversion calculator is available here for free download.