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.
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.
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.
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.
Grab a copy of Dicom, it is absolutely free. You can download it here.