ClariCalc User’s Manual

Introduction

ClariCalc™ gives you the ability to perform high quality, readable calcu­lations using standard math notation.

It works within Microsoft Word, so you can format and illus­trate your work with all the power and flexi­bility of a full featured word processor.

ClariCalc helps you avoid the errors that infest spread­sheet calcu­lations. When you read ClariCalc's written output, you are looking at the actual formula that was used to perform the calcu­lation. ClariCalc also writes the numerical value of every variable used in a calculation. Compared to spread­sheets, ClariCalc calcu­lations are easy to check.

ClariCalc is released under the MIT License. So you can use it for free.

System Minimums: ClariCalc requires Windows 7 or higher and Word 2007 or higher. It does not work in web-based versions of Word.

Note: In several places this manual invites the reader to type an example. Some of those invitations include a command-key combination. For example, ALT keyc means hold down the Alt key, and while doing so, press c.

The Basics

Get a copy of ClariCalc by clicking on the Download button in the left sidebar. Then install ClariCalc by double-clicking on the down-loaded file and following the directions. The next time you open Microsoft Word, it will contain ClariCalc.

You can set some preferences by clicking the button at Add-Ins | Edit | SettingsButton and selecting your preferences in the resulting dialog box. Or you can wait to set preferences later and get right to calcu­lations with the default preferences.

The productivity starts with the first calculation. Your steps are to (1) write an equation, (2) put the selection point where you want the result to appear, and (3) give the command for a calcu­lation. Like this:


Type these examples: The results will be:
1+1 = ALT keyc 1+1 =· 2
(18+7)/6 = ALT keyc \(\frac{18+7}{6}\) =· 4.17
15^2 = ALT keyc 15² =· 225

You can write explanatory notes into your work. ClariCalc will compute the expression written just before the ALT keyc, and that leaves places available for your narrative.

x = Write a note here = 2+2 = ALT keyc     Another note here.

Writing Math

Microsoft Word now has Math Zones to help you generate math notation. Word creates a Math Zone when you type ALT key= or invoke the command Insert | Equation.

The power of a Math Zone is best appreciated when you see it in action, as in the videos located here and here. Or, you can try your own demonstration, such as the following equation. First, type ALT key=, then, inside the math zone, type:

a_b + 20^3 + y\bar + (1+5)/2 + \theta + \sqrt 15

As you type, the math objects will build up and the result will be:

\(a_b +{20}^3+\bar y +\frac{1+5}2 +\theta +\sqrt{15}\)

ClariCalc will add to Word’s math formatting with some equation format adjustments of its own. When ClariCalc performs a calculation, it will…

If you wish ClariCalc to perform its formatting without doing a calculation, place the insertion point after the expression and type ALT keym or invoke the ribbon command: Add-Ins | Edit | Format.

For tips on how to write math quicker, see the sections on Keyboard Shortcuts and Quick Parts, below.

Syntax

ClariCalc performs calculations on expressions written in standard math notation. That is a broad statement, so the following section covers some nuances.

Notation

Decimal symbol

Some countries use a dot for their decimal symbol. Others use a comma. ClariCalc can do either. It chooses the symbol per the settings in the Windows control panel. [Warning: comma decimal is only lightly tested.]

Multiplication

For multipli­cation of two numbers, ClariCalc recognizes several operator symbols. So if  a = 2  and  b = 3, then all of the expressions below will give the same result:

2 × 3 = 2 · 3 = 2 * 3 = (2)(3) = a b = 2 b = a × b = a · b

Between variables, a space is taken to be a multipli­cation operator, as in e = m c².

For the product of two arrays (unlike plain numbers), the type of multipli­cation varies with the operator symbol, as explained here.

Function argument separator

ClariCalc uses the semi-colon, not the comma, to separate function argu­ments, as in:  x = max(a; b; c)

Variable names

Variable names may be multiple characters long. They must begin with a letter from the Latin or Greek alphabet. The rest of the characters may be letters or numerals (0123456789). An under-score within a name is allowed and will be interpreted to mean the start of a subscript. Primes at the end are ok, e.g., fc′. So are accents, e.g., \(\bar{y}\), \(\hat{\theta}\), etc.

Superscripts

ClariCalc will read a superscript as an exponent.

Special Fractions

A special fraction is a small, slanted fraction like ½ or ⅞. They can be part of a mixed fraction such as 1½. ClariCalc can read either decimal fractions like 0.375 or special fractions like ⅜. ClariCalc normally writes calculation results in decimal fractions but if you prefer your results to be written as special fractions, then use the keyboard combination shift Shift keyALT keyc or Shift keyALT keyk.

Example:

1.5 + 1⅞ = 3⅜

Number Names and Bases

ClariCalc recognizes numbers such as 10 thousand, that is, an Arabic numeral followed by an alphabetic name of a number. The numeric extensions recognized are: hundred, thousand, lakh, crore, million, billion, milliard, trillion, googol, percent, procent, permille, promille, ppm, ppb, dozen, gross, score, karat, pair, pairs, wan, and yi. Billion is taken to mean 1,000,000,000.

ClariCalc also recognizes numbers such as 0F hex, that is, a numeral followed by a base label. The bases recognized are: decimal, hex, hexadecimal, octal, binary, and roman. Any number without a base label is assumed to be decimal.

z*

ClariCalc will find the complex conjugate of a variable noted z^*

When you run a calculation, ClariCalc will set variables to italic. It will set function names (e.g. sin), units (e.g. meters), and logic words (if and or not xor else otherwise) to non-italic.

Operators

Operator Keyboard Shortcut Example Comment
= x = 15 Assign a value to a variable.
Assignment statements must begin at the start of a paragraph or just after a tab.
+ 2 + 2 Addition
5 – 3 Subtraction
- -4 Unary minus
* 2 * 4 Multiplication of numbers.
Memberwise product of arrays.
× \times 2 × 4 Multiplication of numbers.
Cross product of vectors.
· ALT key. a · b Multiplication of numbers.
Dot product of matrices, or vectors.
(2)(4) Multiplication
2 a Multiplication. []ClariCalc checks each blank space in an expression and inserts a multipli­cation where appropriate.
2a Multiplication
a2 Not a multipli­cation. ClariCalc reads a2 as a variable name.
a(2) Either a function a(2) or a multipli­cation a×2. []If a valid function name exists, it will take precedence over multipli­cation in this syntax.

Using this syntax for multipli­cation is legal, but i do not recom­mend it. If you type a space between a factor and a following paren, as in a (2), you will make it easier for a reader to tell the difference between a multipli­cation and a function.
/ \(\frac{8}{2}\) Division
÷ \div 8 ÷ 2 Division
\ldiv 8 ∕ 2 Division with inline format.
^ 32 Exponent
\sqrt or \r \(\sqrt{4}\) Square root
\(\sqrt[n]a\) \r(n&a) \(\sqrt[3]{27}\) nth-root
% 10% Percent
10‰ Per thousand
|  | |-4| Absolute value of a scalar, determinant of a matrix, or magnitude of a vector.
\(\lVert\,\,\,\rVert\) \Vert \(\lVert x \rVert\) \(\sqrt{x_1^2+\cdots +x_n^2}\) if the argument is a vector of reals
\(\sqrt{|z_1|^2+\cdots +|z_n|^2}\) if the argument is a complex vector
\(\sqrt{\sum_i\sum_j A_{i;j}^2}\) if the argument is a matrix
⌊ ⌋ \lfloor
\rfloor
⌊4.5⌋ Floor. Always rounds down.
⌈ ⌉ \lceil
\rceil
⌈4.5⌉ Ceiling. Always rounds up.
! 5! Factorial
!! 5‼ Double Factorial
¡ ALT key 0161 Subfactorial, n¡ = \(\left\lfloor{\frac{n!}{e}+\frac{1}{2}}\right\rfloor \)
\(\binom{n}{k}\) (n\atop k) \(\binom{5}{3}\) Binomial coefficient. \(\binom{n}{k}=\frac{n!}{k!(n-k)!}\)
^* z* Complex conjugate
\angle rθ Polar notation separator
\ a \ b
F \ S
Integer division on numbers a and b = ⌊a ÷ b
Matrix direct solution if F and S are matrices and S is square. []Matrices can be used to express a sytem of linear equations, such as
S×D = F.
One can solve such a system by matrix inversion,
D = S⁻¹ × F,
but the direct solution, F \ S, has a faster algorithm.
< Comparison Operators.
For If Expressions, such as:
x = a if (n < 2) else b
>
<=
>=
==
=/
~= Comparison operators that return True for magnitudes that are equal ± 0.1%. Useful when dealing with floating point error in engineering calculations.
<~
>~
~/ Returns True for comparisons that are more than 0.1% apart.
and Logical operators.
For If Expressions, such as:
x = a if (n < 2 and c == 2) else b

not and ¬ are unary operators, as in:
x = a if (not n == 2) else b
or
not
xor
¬ \neg
\wedge
\vee
: 2:3 Integer range separator.

The term V[2:5] will return an vector containing elements 2 through 5 of vector V.

The term table[1].range[4; 2:5] will return an array that contains the contents of table 1, row 4, columns 2 through 5.

The comprehension
[2 i for i in start:end] will return a vector after it executes the expression “2 i ” several times, with variable i taking on each integer value in the range from start to end.

Functions

ClariCalc treats a word as a function name if it (1) matches a word in the ClariCalc function list[]abs acos acosd acosecd acosh acot acotd acoth acsch angle asec asecd asech asin asind asinh atan atan2 atand atanh cis combin cos cosd cosh cot cotd coth count csc csc cscd csch doc erf exp gcd gud haversin haversind hypot imag ln log log! log10 logΓ max mean median mht min permut product random range real remainder rib rms root round sec secd sech sign sin sind sinh sqr sqrt stddev sum table tan tand tanh trace trunc variance Γ Σ Φ, and (2) is placed directly before an open paren­thesis. So a term like sinh(x) is a function. []If the word is not on the function list, then ClariCalc will search for a variable, so terms like a(b) are equivalent to a × b. For four functions (cos sin tan log), the parentheses are optional.

ClariCalc uses the semi-colon, not the comma, to separate function argu­ments, as in:  x = max(a; b; c)

ClariCalc’s built-in functions are described below. Unless noted otherwise, they can operate on any complex number.

cos θ, sin θ, tan θ, sec(θ ), csc(θ ), cot(θ ), haversin(θ )

Trigonometry functions.

The trig functions listed above will assume that the argu­ment is in radians, unless you tell it other­wise. You can tell it other­wise by just writing in a unit, as in: tan(45°).

A superscript after a trig function name will return the function result raised to a power. So that:   sin2 θ = (sin θ )2.

Exception: A superscript -1 indicates an inverse function. In other words, cos-1(x) = acos(x).

ClariCalc’s trig functions will operate on angles and on complex numbers.

cosd(θ ), sind(θ ), tand(θ ), secd(θ ), cscd(θ ), cotd(θ )

The trigonometry functions listed just above will assume that the argu­ment is in degrees.

acos(x), asin(x), atan(x), asec(x), acsc(x), acot(x)

Inverse trigonometry functions. One can also call an inverse trigonometry function with a superscript, as in cos-1(x).

atan2(x; y)

An atan function that returns an angle in the proper quadrant. Given a point defined by real coordinates x and y, atan2 returns the angle between that point and the positive x-axis of a plane.

cosh(x), sinh(x), tanh(x), sech(x), csch(x), coth(x)

Hyperbolic functions. Notation for inverse functions is similar to trigonometry.

doc(filename)

Assigns a Word document to an object. See remote bookmarks.

exp(x)

ex

log x, ln(x)

Natural (base e) logarithm of x.

log10(x)

Base 10 logarithm. ClariCalc will subscript the numerals for you.

log(b; x)

Base b logarithm.

Γ(z)

Gamma function. For positive integers, Γ(n) = (n – 1)!
Unlike a factorial, however, the Gamma function is extended to operate on all complex numbers.

logΓ(x), log!(n)

Natural log of, respectively, the Gamma function and the factorial. The log!() function can operate only on integers ≥ 0. []These functions are useful when doing combinatorial calculations. That is because 170! is the largest factorial that fits into 64 bit floating memory. To avoid over­flow from a factorial, one can substitute an equivalent expression that uses logarithms. For instance:
\(\frac{n!}{k!(n-k)!}=\) exp(log!(n) – (log!(k) + log!(nk)))

abs(z)

Absolute value of a real number
Magnitude of a complex number

min(a; b; c; …)    max(a; b; c; …)

Minimum or maximum of a list or array. Real numbers only.

combin(n; k)

Number of combinations of n items taken k ways = \(\frac{n!}{k!(n-k)!}\)

permut(n; k)

Number of permutations of n items taken k ways = \(\frac{n!}{(n-k)!}\)

hypot(a; b), rms(a; b)

\(\sqrt{a^2+b^2}\)

random()

Pseudo-random number between 0 and 1

rib(a; b)

Random integer bounded by a and b

remainder(m; n)

Remainder after n is divided by m. Integer inputs only. Always returns a positive number.

round(x; n)

Round a real number x to n places after the decimal.
Omit the n to round to an integer.

angle(z), real(z), imag(z), cis(θ )

Functions useful when working with complex numbers.

sum(abc; …), product(abc; …), count(abc; …), range(abc; …), mean(abc; …), variance(abc; …), stddev(abc; …)

Functions on lists or arrays.

erf(x), Φ(x)

Functions useful for normal probability.

gcd(m; n)
gcd(LAT1; LONG1; LAT2; LONG2)

gcd on two integers returns the greatest common divisor.
gcd on four arguments returns an approximate great circle distance between two points on the surface of the Earth, given their latitude and longitude.

sign(x)

Returns 1 if x > 0, -1 if x is < 0, else 0

trace(M)

The sum of the elements of a square matrix.

Constants

π

ClariCalc uses a value of 3.141592653589793238462643383 for π.

e z

ClariCalc will treat e just like any other variable most of the time. But if e is the base of an exponent, for example: e x or e(3 a), then ClariCalc will perform the function exp(z).

Operator Precedence

What is the result of the expression 3 + 4 × 2?

It depends on whether one does the addition first or the multi­plication first. So the answer could be (3+4)(2) = 14  or  3+(4×2) = 11.

To resolve this ambiguity, ClariCalc performs operations with the following precedence:

! ‼ ¡ % ‰ Factorials and percents are done first.
^   ^* Then exponents, from right to left.
Roots
- Unary minus, for example: -4 x
To write a complex number in rθ notation.
× · / ÷ Multiplication or division, from left to right.
+ – Addition or subtraction, from left to right.
 < > ≤ ≥ Comparisons (for If Expressions)
not and or Logical operators (ditto)
: Separator for a range of integers, as in V[2:3].
; @ & ¦ Argument separators for functions, matrices, or Cases expressions.
( ) [ ] All conventions are over-ridden by paren­theses.

Now let’s return to the question that opened this section. We now know that multi­plication has a higher precedence than addition, so the result of our question above is:

3 + 4 × 2 = 3 + (4 × 2) = 11

If Expressions

ClariCalc has two kinds of if expressions.

Inline If Expression

expression_1 if condition else expression_2

Example:

x = 2a if a < b else a² =

I recommend that you surround the condition with parentheses. They make the statement easier to read.

x = 2a if (a < b) else a² =

Cases Expression

Example:

β1 = \(\begin{cases}0.85 &\text{if }f_c^\prime\leq 4000 \\0.65 &\text{if }f_c^\prime\geq 8000 \\0.85-\frac{f_c^\prime -4000}{20{,}000}&\text{otherwise}\end{cases}\)

You can initiate a cases expression by clicking the ribbon button Add-Ins | Insert | \(\tiny{\begin{cases}\square \\ \square\end{cases}}\)

In a cases expression, ClariCalc will automatically align the logic words if and otherwise. You needn’t take any action to make that happen.

Conditions may contain logical operators: and or not xor

x = 2a if (a < b and b == 5) else a²

Chained comparisons are okay.

x = 1.0 if (a < b < 5 < d) else 1.3

In an inline expression, the equals comparison operator must be ==. In a cases expression, you can use either = or ==.

x = 1.0 if (a == 12) else 1.3

Rounding

ClariCalc will round off the result of a calculation. You can specify the type of rounding via the SettingsButton button on the Add-Ins ribbon tab. The following rounding options are available:

Show All

…shows all digits, as in:    sin(45°) = 0.707106781186548

##0

…rounds off to the nearest integer, as in:   sin(45°) = 1

##0.00

…rounds to two digits after the decimal, as in:  sin(45°) = 0.71

Scientific

…shows the result in 0.00E+00 format and displays the number of significant digits that is specified in Preferences. So, three significant digits returns:  sin(45°) = 7.07E-01

Significant

…rounds the result to the number of significant digits that is specified in Preferences. So, three significant digits returns:   sin(45°) = 0.707 and 10×sin(45°) = 7.07

##0 or Significant, whichever is longer

…rounds to the specified number of digits, unless an integer is more precise. []To an engineer or scientist, it makes perfect sense to round off a result from 10,322.6 lbs to 10,300 lbs. From that perspective, this rounding spec promotes spurious precision. So why is this rounding spec here? Well, some ClariCalc users want to avoid freaking out their clients.

Variables

If you write variables into your equations, ClariCalc will search your document for values to plug in. Here's an example.

a = 7          b = 11.2         c = -4     ← separated by tabs

x = a+b/c = ALT keyc

Result:

x = \(a+\frac{b}{c}\)a+b/c = \(\color{#3333CC}{7+\frac{11.2}{-4}}\) = 4.2

When an expression contains variables, ClariCalc will:

  1. Search for the variable assignments.
      a.   First in bookmarks and ParentFiles.
      b.   Then upwards in the document for variable assignments.
  2. Write an echo of the expression, with the values plugged in.
  3. Do the calculation and write the result.

To assign a value to a variable, just write

variableName = value at the start of a paragraph, or after a tab.

More examples:

L = 14 ← Write assignments at the start of a paragraph.
w = 0.12 P = 2.3 ← or after a tab.

M = \(\frac{w\,L^2}{8}+\frac{P\,L}{4}\) = \(\color{#3333CC}{\frac{(0.12)(14^2)}{8}+\frac{(2.3)(14)}{4}}\) = 10.99

A ClariCalc search for a variable goes in the upward direction. So if you have defined d more than once, ClariCalc will find the place that is (1) above the calculation line, and. (2) closest to the calculation line.

A variable search is case-sensitive. A search for E will not find e.

Variable names may be multiple characters. They must start with a letter, not a number. Other characters may be letters or numbers. Subscripts are ok. Primes at the end are ok, e.g., fc′. So are accents, e.g., \(\bar{y}\), \(\hat{\theta}\), etc.

To assign a text string, put the text inside quotes, e.g., s = a string

Note that ClariCalc writes an echo of the expression that displays the values used for each variable. This echo allows one to check ClariCalc’s work. The echo is typically colored blue to set it apart from other text.

When a value is sourced from a Bookmark, a Parent File, or from LookupTable.txt, then the value is written in green. This gives a checker a better audit trail for the values.

If you want to suppress the echo (often a bad idea), you can write an ellipsis where the echo would normally go.

Example: t = c - a = … = 5

Speed Tip

ClariCalc may slow down a little in a long document. To regain some speed, you can choose in the SettingsButton Settings to Search for variable assignments ONLY within the current section and in bookmarks.

To insert a section break, use the ribbon button: Layout | Breaks | Section Break (Next Page) or the keyboard shortcut Ctrl keyShift keyEnter key

Bookmarks

In a really long document, ClariCalc can slow down a little if it has to search a long way back to find a variable. To keep things speedy, ClariCalc has an alternate search method. It uses a Microsoft Word feature called bookmarks that you may not have used before. In Word, a bookmark is a place in the document that has a name. Word keeps track of this place and can find it quickly.

When ClariCalc searches for a variable, it will first look in the list of bookmarks. If ClariCalc finds the variable name in the list of bookmarks, it will use the bookmark, even if the variable name is defined again later in the document. That last sentence is an exception to the usual upward search. Bookmarks are trumps. That's why they're fast.

You can set a lot of bookmarks at once with ClariCalc. For example:

Fy = 36 ksi E = 29000 ksi G = 12000 ksi
fc′ = 4500 psi fc″ = 4500 psi² fyr = 60000 psi

Select the whole block of text and choose the menu command:

Add-Ins | Insert | Miscellaneous | Bookmark(s).

Word only allows alphanumeric characters in bookmark names. That interferes with certain variable names, so the ClariCalc bookmarking utility examines each proposed name and will make a substitution for the last character in four cases:

fc fcPrime
fc fcPPrime
\(\bar y \) yBar
\(\hat{\theta}\) θHat

Remote Bookmarks

A ClariCalc expression can call in a value from a bookmark, even if the bookmark is in a different Word document. To do this, first use the doc() function to assign a particular Word document to an object. The bookmarks of that other document can then be called as attributes of the object. Here’s an example:


stds = doc(Section A.docx) assigns a document to an object named stds
A = stds.L × stds.W
F = A × stds.p
Two equations that call bookmarks.

You can skip the first step, as in the equation below.

p = doc(Section A.docx).p

You can also call table elements from the other document, as in:

n = stds.table[1].cell[2; 3]

File path

The syntax above ask you to assign a filename. You can choose to write an entire file path as your document definition, like this:

stds = doc(S:\Clients\John Doe\jobname\Section  A.docx)

Or, you can omit the path and just write the file name:

stds = doc(Section A.docx)

If you omit the path, ClariCalc will first look for the external document in the same folder as the current document. If the desired document is not there, ClariCalc will then search the folder that contains the current folder, then the folder that contains it, all the way to the root subdirectory.

Parent Files

If you want to avoid the Object.Attribute notation, you can assign values in a ParentFile. Here's how:

  1. Use a text editor, say NotePad, to create a text file. Write your data into the file using a tab-delimited format like this example:
Name Value Unit
E 29000 ksi
G 12000 ksi
  1. Save the text file with UTF-8 encoding. It can now be used as a parent file.
    Or, skip steps 1 and 2; select a range of assignments, then invoke Add-ins | Edit | Edit | Create Text ParenFile.
  2. Place the parent file into the same folder as the descendent file(s), or in any folder that contains the descendent file(s).
  3. In each of the descendent files, type in the file name of the parent file, then select that file name and bookmark it with the name ParentFile.

Subsequent variable searches in the descendent files will inherit all the variable assignments in the parent file. Like this:

x = 2 G = (2)(12000) = 24000

A ParentFile has precedence over any variable assignment except a bookmark.

Variable Search of Data with a Lookup Key

If you have a big table of tab-delimited data in a separate text file, ClariCalc can search through it for a lookup value. To call for such a search, a document would contain text that looks something like this:

Section = “W8x31 This line sets a lookup key W8x31.
2 d = (2)(8) =: 16 The value for d comes from the entry for W8x31 in LookupTable.txt.

The data in LookupTable.txt can be anything you write. It’s format will look something like the structural steel table shown here:

W wself A d tw bf tf
Section plf in2 in in in in
W14x74 74 21.80 14.17 0.450 10.070 0.785
W8x31 31 9.13 8.00 0.285 7.995 0.435
W8x28 28 8.25 8.06 0.285 6.535 0.465
W8x24 24 7.08 7.93 0.245 6.495 0.400

In order to search this table, first set a lookup key for say W14x74. In the rest of the document, ClariCalc variable searches will find values for:

wself, A, d, tw, bf, or tf

There are two ways to set a lookup key:

  1. Select from a list of keys in the menu command:
    Add-Ins | Insert | Lookup Key…
  2. Write the key into your document, then hit ALT keyL. Example:
Type this: W14x74ALT keyL
Result: Section = W14x74

You can have more than one lookup key active at one time, provided that they are of different types. For instance, one key (say Section = W14x74) might deliver section properties like A and d. (area and depth for the W14x74 section.)

Another key (say SteelGrade = ASTM A36) might then deliver properties, like Fy and Fu, of a steel grade.

The file with the data is named LookupTable.txt. It must be located in C:\Users\userID\AppData\Roaming\Hilbert\

References to values inside a table

An expression located outside a table can refer to value(s) inside a table using any of the following syntaxes:

x = table(indicator).cell[row; col]

x = table(indicator).range[row; col]

x = table(indicator).find[string; col]

x = table(indicator).match[pattern; col]

x = table(indicator).interpolate[row; col]

The indicator term can be either an integer or a string of text, or a variable that returns an integer or string. An integer refers to a table by its position relative to the expression. A string refers to the nearest (upward) table that starts with that string. Examples:

table(-1) ← refers to the previous table
table(0) ← refers to the table containing the expression
table(2) ← refers to the table after the next table
table(“Fv”) ← refers to the nearest table that starts with Fv

The table’s method and property terms are:

[row; col] returns the contents of one cell.
.cell[] returns the contents of one cell.
.range[] returns an array with the contents of several cells.
.find[] returns an array with the contents of cells from rows that match a string.
.match[] returns an array with the contents of cells from rows that match a regular expression pattern.
.interpolate[] returns a value interpolated between cell values.

.find and.match work only on rows, not on columns.

The row and col terms can take several forms:

A positive integer points to a specific row or column.

A string refers to the row or column whose header is the string.

end points to the bottom row or rightmost column.

A blank points to an entire row or column.

Colon-separated integers point to a range of cells.

Examples for row and col:

[3; 2] ← returns the cell contents at row 3, column 2
[end; 4] ← returns the bottom cell in column 4
[2:3; 4] ← returns a 2x1 list
[4;] ← returns an array containing row 4

Dictionaries

A dictionary, like an array, contains data, but a dictionary is indexed by keys, not integers.

array[3] ← Array calls use an integer.
dictionary[k] ← Dictionary calls use a key, which can be a string.

The syntax that one uses to create a dictionary has pairs of a key and a value surrounded by braces.

decade = {50s: Elvis; 60s: Beatles; 70s: Eagles}

base = {B:7.0; C:9.5; D:11.5}

Note that keys are separated from values by a colon. Each pair is separated from the others by a semi-colon. Keys need not be surrounded by quotation marks.

You can call a dictionary value in two steps, by assigning a dictionary to a variable and then making the call.

decade = {50s: Elvis; 60s: Beatles; 70s: Eagles}

star = decade[50s] = Elvis

Or you can call a dictionary value in one step by defining the dictionary and the index on the same line. The index can of course be a variable.

Cexp = C

α = {B:7.0; C:9.5; D:11.5}[Cexp] = 9.5

Dictionary values cannot be changed and they cannot be nested. They can contain a unit.

L = {court: 94 feet; field: 100 yards}

Units

If any operands are written with a unit, ClariCalc shifts into unit-aware mode. In this mode, ClariCalc will recognize units and handle unit conversions automatically. Like this:


Type these examples: The results will be:
2 m + 5 feet = mm ALT keyc (2 m) + (5 feet) = 3,524 mm
\(\frac{10{,}000 \text{ m}}{100\text{ km/h}}\) = ALT keyk minutes \(\frac{10{,}000 \text{ m}}{100\text{ km/h}}\) = 6 minutes

So long as the units for all operands, including the result, are compatible, ClariCalc can automatically handle unit conversions through most math operations and functions.

ClariCalc can read compound units. Examples:

multipli­cation: lb·in or lb-in
division: m/s or h/(N·m) (Use only one solidus
character “ / ” in any unit.)
powers: m/s2 or m·s-2

ClariCalc checks for incompatible units. If it finds a problem, it will shut down the calculation and give you an error message.

\(\frac{1500\text{ m}}{60\text{ mph}}\) = volts ALT keyk Error. The expression's units
are incompatible
with the result's units.
4 ft + 6 sec = ALT key k Error. You're adding
incompatible units.

Recognized unit formats include:

5 meters Unit name or symbol written after the numeral.
$10.25 Currency symbol written before the numeral
5′ 6″ Feet and inches
10° 15′ 7″ Degrees, minutes, seconds
95V∠80° Unit symbol (e.g. V) embedded within a complex number written in polar coordinates.

Currency exchange rates are not automatically updated. To update them, click on the button at: Add-Ins | Edit | Misc | Update Currency Exchange Rates. ClariCalc will then get a current set of exchange rates from Yahoo Finance.

ClariCalc has two calculation commands: ALT keyc and ALT keyk.

Both of those commands will recognize units in your expressions and handle them automatically. Both will do this expression correctly:

10 m + 3 yards = ALT keyc feet → 41.8 feet
10 m + 3 yards = ALT keyk feet → 41.8 feet

The difference between the two commands occurs when ClariCalc does a variable search. For each variable, ClariCalc finds where a value is assigned, and then:

ALT keyc → returns the scalar (number) assigned to a variable
ALT keyk → returns both the scalar and the unit

Example:

a = 15 mm        b = 5 m

a + b = ALT keyc a + b = 15 + 5 = 20
a + b = mm ALT keyk a + b = (15 mm) + (5 m) = 5015 mm

Weight

ClariCalc’s default settings impose a strict treatment of mass and force. That is, ClariCalc will flag as an error any attempt to add mass to force or to convert mass to force.

But you can relax that setting via ClariCalc Preferences. Then ClariCalc will not flag a force + mass addition as an incompatible unit error. Instead, it will make a conversion under the assumption that the force is a weight imposed on the mass by earth gravity. []This simulated compatibility will work though any number of additions and multipli­cations, but it may be fooled by a calculation involving an exponent. ClariCalc assumes that g = 9.80665 m/s².

If the relaxed treatment is a problem for your work, don’t use it. For example, people working in fluid dynamics should keep the strict treatment.

Traditional Units

Many traditional units have had more than one historical definition. ClariCalc currently has the following default treatment of certain traditional units:

[]ClariCalc gets its conversion factors from a file named UnitFactors.txt, which you can view and edit by invoking the ribbon button Add-Ins | Edit | Show | Unit Factors.

Currency Exchange Rates

To update the currency exchange rates in UnitFactors.txt, invoke the ribbon command Add-Ins | Edit | Misc | Update Currency Exchange Rates.

Recalculation

This section is for that moment when you want to change one number, then re-calculate a lot of results. No problem. Go ahead and edit your text. Then select the text that you want to re-calculate and hit the Re-Calc button or type ALT keyr. ClariCalc will re-calculate everything in the selection.

You may have noticed that when you do a calculation, ClariCalc will add a small hidden symbol next to the last equals sign. That is a bread crumb left behind so that ClariCalc can know the type of re-calculation needed there. The bread crumb will not print out.

Beyond Real Numbers

One can add, multiply, etc., with many things besides real numbers. ClariCalc can help you do that. It operates on dates, arrays, matrices, vectors, comprehensions, and complex numbers.

Date Arithmetic

ClariCalc enables date addition and subtraction.

To assign a date to a variable, place a valid date string inside quotation marks. ClariCalc can recognize some dates even without quotation marks, such as today or now.

d1 = 12 January 2015

Then use the normal addition and subtraction operators to do date arithmetic. Examples:

d2 = d1 + (6 weeks) = (1/12/2016) + (6 weeks) = Friday, February 12, 2016

d3 = today + (10 weeks) = Sunday, September 6, 2015

d4 = d1d3 = (1/12/2016) - (9/6/2015) = 237 days

As you can see, the echo displays dates in the Short Date format chosen in your Windows Control Panel. ClariCalc writes results in Long Date format.

Arrays

A ClariCalc array is a collection of values stored in a one- or two-dimensional grid. They look like these examples:

\(\begin{pmatrix}1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1\end{pmatrix}\)    \(\begin{bmatrix}4\\ 5.5\\ 0.9\end{bmatrix}\)   [11   2.4   800]

One can call an individual value from an array with an index, as in: x = M[1] or y = M[1; 3].

Most ClariCalc operators and functions operate on arrays in an element-wise fashion. If you add a scalar to an array, or pass an array to most functions, ClariCalc will do an element-by-element calculation and return an array.

However, mathematicians have several ways to do multiplication on arrays. In ClariCalc, you choose the type of multiplication by your choice of multiplication symbol:

A B returns a matrix product, \((\mathit{\mathbf{A\,B}})_{ij}=\sum_{k=1}^m{A_{ik}B_{kj}}\).

A × B returns a cross product = |A| |B| sin(θ) n

A · B returns a dot product \(=\sum_{i=1}^n{A_i B_i}\)

A ∗ B returns a elementwise product, \((\mathbf A\mathrm{\ast }\mathbf B)_{ij}=A_{ij}B_{ij}\)

I want to draw your attention to the character in the previous line. In most expressions, ClariCalc will remove a * character and substitute a different multi­pli­cation syntax. But there is an exception: Any expression that contains an array will keep the ∗ character so that it can be used for an element-wise product.

Here are some other array operations:

AT returns a transposed array.

A-1 returns an inverted matrix, if A is square.

|A| returns a \(\begin{cases}\text{determinant }&\text{if }\mathbf A\text{ is square} \\\text{magnitude }&\text{otherwise}\end{cases}\)

abs(A) returns elementwise absolute values

F \ S returns a \(\begin{cases}\text{matrix direct solution }&\text{if }\mathbf S\text{ is square} \\\text{elementwise integer division }&\text{otherwise}\end{cases}\)

Functions min() and max() will work elementwise if you pass multiple arrays to the function. If you pass one array, they will find the minimum or maximum of the elements in the array.

There are three ways to write an array:

  1. If you click on the \(\tiny \begin{bmatrix}1 & 0 \\0 & 1\end{bmatrix}\) button on the Add-Ins menu, ClariCalc will show a dialog box to help you populate a matrix, such as:
    M = \(\begin{pmatrix}10 & 4 \\0.5 & 103\end{pmatrix}\)
  2. Between square brackets with spaces to separate elements and semi-colons to separate rows, as in: V = [10  4] or M = [10  4; 0.5  103]
  3. Comprehensions, see below.

To append a scalar onto one end of a vector, write the scalar name and the vector name into another array. Such that:

[a  V] will prepend a to the beginning of vector V.

To concatenate two arrays, write the array names as elements in another array. So that:

[A  B] will concatenate in a side-by-side manner.

\(\begin{bmatrix}\mathbf A \\\mathbf C\end{bmatrix}\) or [A; C] will concatenate C to the bottom of A.

Comprehensions

Comprehensions provide a concise way to create a column vector, using a syntax similar to set builder notation in mathematics.

Syntax:

[expression for variable in start:end]
where:

expression will be evaluated several times, with variable taking on all the integer values in the range from start to end

start and end are also expressions. They must result in integers.

Here are some examples

Input Result
V = [2 i for i in 1:3] = ALT keyc \[\begin{bmatrix}2\\ 4\\ 6\end{bmatrix}\]
n = 2
[3 + i for i in 1:n] = ALT keyc
\[\begin{bmatrix}4\\ 5\end{bmatrix}\]
[2 + V[i] for i in 2:3] = ALT keyc \[\begin{bmatrix}6\\ 8\end{bmatrix}\]

You can append a comprehension to a vector, like this:

\(\small\begin{bmatrix}2\\ \text{[7 + \textbf{V}[\textit{i}] for \textit{i} in 1:2]} \end{bmatrix}\) = \(\small\begin{bmatrix}2\\9\\11\end{bmatrix}\)

Or, you can get the same result this way:

[2; [2 + V[x] for x in 1:2]] = \(\small\begin{bmatrix}2\\9\\11\end{bmatrix}\)

In a comprehension, a call to index 0 returns 0. That is, A[0] = 0.

Matrices

A matrix is a two dimensional array of numbers, associated with certain matrix operations.

ClariCalc can: add matrices, subtract them, multiply them, invert them, and transpose them. It can find determinants of square matrices.

If you click on the \(\tiny \begin{bmatrix}1 & 0 \\0 & 1\end{bmatrix}\) button on the Add-Ins menu, ClariCalc will show a dialog box to help you populate a matrix.

You can work directly with matrices or you can work with variables to which you have assigned matrices. Here are some examples:

A = \(\begin{pmatrix}1 & 2 \\ 3 & 4\end{pmatrix}+\begin{pmatrix}7 & 1 \\ 8 & 3\end{pmatrix}\) = \(\begin{pmatrix}8 & 3 \\ 11 & 7\end{pmatrix}\)

B = \(\begin{pmatrix}10 \\ 15\end{pmatrix}\)

C = A B = \(\color{#3333CC}{\begin{pmatrix}8 & 3 \\ 11 & 7\end{pmatrix} \begin{pmatrix}10 \\ 15\end{pmatrix}}\) = \(\begin{pmatrix}125 \\ 215\end{pmatrix}\)

To append (or delete) rows or columns in an existing matrix, right click on an element and choose a command from the pop-up menu.

To invert a matrix, use this notation: x = A-1 = ALT keyc

To transpose a matrix, use this notation: x = AT = ALT keyc

To solve a system of linear equations, Ax = B, use either:

The inverted matrix technique: x = A-1 B = ALT keyc

Or a notation for direct solution: x = B \ A = ALT keyc

Determinants

Use the |A| notation to find the determinant of a square matrix. As in:

A = \(\begin{pmatrix}1 & 2 \\ 3 & 4\end{pmatrix}\)

d = |A| = \(\color{#3333CC}{\begin{vmatrix}1 & 2 \\ 3 & 4\end{vmatrix}}\) = -2

Norms

Use the \(\small ||\mathit{\mathbf A}|| \) notation to find the Frobenius norm []\(\small ||\mathit{\mathbf A}||=\sqrt{\sum_i\sum_j A_{i;j}^2}\) of a matrix.

\(\small n=||\mathit{\mathbf A}||=\color{#3333CC}{\begin{Vmatrix}1 & 2 \\ 3 & 4\end{Vmatrix}}=5.477\)

To retrieve one value from a matrix, use a bracket notation.

x = matrixName[rowIndex; columnIndex]

Example: x = A[2; 2] = 4

The trace function, trace(M), returns the sum of the elements on the diagonal of a square matrix.

Vectors

In ClariCalc, a vector []The word vector can be taken to mean many different things. It makes no difference to ClariCalc how you interpret the meaning of a vector. It just does the operations. is a one dimensional array of numbers associated with certain vector operations. ClariCalc can: add vectors, subtract vectors, multiply them by a scalar, do dot products, find vector magnitudes, and find vector norms. ClariCalc can do cross products on 3-vectors.

Tip: you can use the \(\tiny \begin{bmatrix}1 & 0 \\0 & 1\end{bmatrix}\) button to get an array creation dialog box.

Vector Examples:

F1 = \(\begin{bmatrix}3 \\9\end{bmatrix}\)

F2 = \(\begin{bmatrix}0.7 \\0.6\end{bmatrix}\)

Use normal math notation to write addition, subtraction, or multipli­cation by a scalar.

F1 + F2 = \(\color{#3333CC}{\begin{bmatrix}3 \\9\end{bmatrix}} + \color{#3333CC}{\begin{bmatrix}0.7 \\0.6\end{bmatrix}}\) = \(\begin{bmatrix}3.7 \\9.6\end{bmatrix}\)

P = 2 F1 = (2) \(\color{#3333CC}{\begin{bmatrix}3 \\9\end{bmatrix}}\) = \(\begin{bmatrix}6 \\18\end{bmatrix}\)

Dot Products

Type ALT key. or \cdot to create a dot product symbol.

c = F1F2 = \(\color{#3333CC}{\begin{bmatrix}3 \\9\end{bmatrix}} \cdot \color{#3333CC}{\begin{bmatrix}0.7 \\0.6\end{bmatrix}}\) = 7.5

Magnitudes

Use the |a| notation to find the magnitude of a vector.

m = |F1| = \(\color{#3333CC}{\begin{vmatrix}3 \\9\end{vmatrix}}\) = 9.49

Norms

Use the \(\small \|\mathit{\mathbf x}\| \) notation to find the norm []\(\small ||\mathit{\mathbf z}||=\begin{cases}\sqrt{x_1^2+\cdots +x_n^2}&\text{ if }\mathit{\mathbf x}\text{ is a vector of reals} \\ \sqrt{|z_1|^2+\cdots +|z_n|^2}&\text{ if }\mathit{\mathbf z}\text{ is a complex vector} \end{cases}\) of a vector.

\(n= \left\lVert\mathbf F\right\rVert=\color{#3333CC}{\begin{Vmatrix}3 \\9\end{Vmatrix}}=9.487\)

Cross Products

Write \times to get the cross product symbol ×.

F1 = \(\begin{bmatrix}3\\9\\4\end{bmatrix}\)

F2 = \(\begin{bmatrix}0.7\\0.6\\26\end{bmatrix}\)

\(\mathbf{P} = \mathbf{F_1}\times\mathbf{F_2} = \color{#3333CC}{\begin{bmatrix}3\\9\\4\end{bmatrix}} \times \color{#3333CC}{\begin{bmatrix}0.7\\0.6\\26\end{bmatrix}} = \begin{bmatrix}232\\-75.2\\-4.5\end{bmatrix}\)

Complex Numbers

ClariCalc can perform calculations with complex numbers. Examples:

\(\sqrt{-9}\) = 0 + 3i

(2 + 3i ) + (8 – 2i ) = 10 + 2i

(4) (2 + 3i ) = 8 + 12i

\(\frac 3{2+i}\) = 1.2 – 0.6i

You can set ClariCalc to recognize either “ i ” or “ j ” for \(\sqrt{-1}\).

There are four options for output format:

a + bi    a + jb    rθ (rad)    rθ °

Use the Add-Ins | Edit | SettingsButton button to set formats.

You can assign a unit to a complex number.

(2)(2 + j 3 volts) = 4 + j 6 volts

Electrical engineers may find the polar format to be useful. The following example sums two out-of-phase energy sources:

E1 = 100V∠45°

E2 = 80V∠90°

E1 + E2 = (100V∠45°) + (80V∠90°) = 166V ∠ 64.9°

Keyboard Shortcuts

Below are some keyboard shortcuts that I have found useful. There are many more at Word Options | Proofing | AutoCorrect Options… | Math AutoCorrect.

Some of these shortcuts will instantly convert to their target. Others take effect only when (1) a ClariCalc calculation is run, or (2) when you type ALT keym after your formula.


Desired Input Comment
Math Zone ALT key= Creates a Word Math Zone
exponent ^exponent Works for any exponent or subscript.
Builds up in a Math Zone, or during calculation, or when you type alt+m after your formula.
subscript _subscript
\r Radical
\(\sqrt[b]x\) \r(b&x)
δ \delta Works for many Greek letters. Shortened versions, e.g. \d, work for some Greek letters, but not the ones with short English names, like nu or rho.
Δ \Delta
· \cdot Middle dot, as in: N·m
ALT key.
× \times
÷ \div
\ldiv Linear div: ab
Works best in a Math Zone.
ALT key ' Prime
Hit ALT key ' twice to get a double prime, ″.
\pprime Double prime
° \degree Degree
ALT keyo
<=
>=
=/
~/
~=
<~
>~
\(\bar y\) y\bar Accents work best in a Math Zone.
\(\hat{\theta}\) θ\hat
\(\dot{z}\) z\dot
\(\vec F\) F\vec
\angle \an also works.
ø o// o with stroke
<–
–>
=>
\checkmark
\dagger
\euro
£ \pound
¥ \yen
fc fc' Starts out as f_c^′
Builds up to fc′ during calculation.
fc fc"

Quick Parts

Microsoft Word has a feature called Quick Parts which provides a shortcut to insert a section of text or graphics. It works like this:

Type:

test F3 key     (type "test" then press the "F3" button.)

Result:

This is a demonstration of Word’s Quick Parts feature.

You can create Quick Parts entries of your own, or use ones that others have created.

ClariCalc takes the Quick Parts idea and adds some math ability.

Type:

t2 F3 key

Result:

x = \(\left(\tfrac{15}3\right)(2)+5\) = 15

With ClariCalc, Quick Parts entries aren't just text. They proceed to do some calculation work.

Choose an Quick Parts Entry from a list

You may end up with a lot of Quick Parts entries. I’ve written several for structural engineers. But it can become difficult to remember them all.

ClariCalc can display a list of all the ClariCalc Quick Parts entries, so that you can choose an entry from the list. To get the list, invoke the command:    Add-Ins | Insert | Quick Part…

Tables

A Word table can do a few of the calculations that you might do in Microsoft Excel. Word's spreadsheet abilities are pretty rudimentary compared to Excel, but ClariCalc helps with some enhancements of its own.

TableFormulaDialog

In order to do a calculation in a Word table, first select a table cell, then click on the Table Tools | Layout | Formula button. It will bring up a dialog box for your formula.

Write in your formula and hit ok. Formulas can include cell references like "A1".

Microsoft describes the standard capabilities of such formula fields here.

ClariCalc adds several enhancements:

Table tools

On the Table Tools | Layout ribbon, ClariCalc adds nine buttons:

Ordinarily in Word, a row insert or row delete will fail to adjust relative cell references. When ClariCalc is installed, the references are adjusted. (If you don't want a cell reference to be adjusted during Copy & Paste or Fill, then write an "$" before the cell reference.)

ClariCalc Variables

Ordinarily in Word, a formula field can only call variables that are cell references or bookmarks. With ClariCalc, if you calculate using ALT keyR, then formula fields in a table can call ClariCalc variables. (This is a slow operation, so you won’t want to over use it.)

References to values inside a table

An expression located outside a table can refer to value(s) inside a table using any of the following syntaxes:

x = table(tbl).cell[row; col]

x = table(tbl).range[row; col]

x = table(tbl).find[string; col]

x = table(tbl).match[pattern; col]

x = table(tbl).interpolate[row; col]

The tbl term can be either an integer or a string of text, or a variable that returns an integer or string. An integer refers to a table by its position relative to the expression. A string refers to the nearest table that starts with that string. Examples:

table(-1) ← refers to the previous table

table(0) ← refers to the table containing the expression

table(2) ← refers to the table after the next table

table(“Fv”) ← refers to the nearest table that starts with “Fv

The table’s method and property terms are:

.cell[] ← returns the contents of one cell.

.range[] ← returns an array with the contents of several cells.

.find[] ← returns an array with the contents of cells from rows that match a string.

.match[] ← returns an array with the contents of cells from rows

.interpolate[] ← returns a value interpolated between cell values.

.find and.match work only on rows, not on columns.

The row and col terms can take several forms:

A positive integer points to a specific row or column.

A string refers to the row or column whose header is the string.

end points to the bottom row or rightmost column.

A blank points to an entire row or column.

Colon-separated integers point to a range of cells.

Examples for row and col:

[3; 2] ← returns the cell contents at row 3, column 2

[end; 4] ← returns the bottom cell in column 4

[2:3; 4] ← returns a 2x1 list

[4;] ← returns an array containing all the cells in row 4

Sum a Column

Back in grade school, you did sums that looked like this:

3.20
2.55
 7.01
12.76

That format is easy to read, so ClariCalc makes it easy for you to do. Here's an example from a material takeoff:

Beam 1 = (24 plf)(3)(15 ft) = 1080 lbs
Beam 2 = (15.5 plf)(8)(12 ft) = 1488
Connections = 0.15 Σ = (0.15)(2568) =   385
Total = Σ = 2,953 lbs

The trick is to put the Σ character into your formula. After you’ve done that, just ALT keyc or ALT keyk like any other calculation. ClariCalc will locate the Σ, and in the calculation echo, it will plug in a sum of the preceding lines’ final numbers.

You can also get this effect by placing the insertion point below the numbers that you want to sum, then clicking on the button at:

Add-Ins | Calculate | Σ

When you sum this way, ClariCalc will automatically set tab stops to align the column.

ok / ng

An engineer will often calculate a value, compare it to an allowable value, and record a decision – either ok or ng (no good).

Example: Fb = 21,400 psi
fb = \(\frac {M}{S_x}\) = \(\color{#005696}{\frac{17{,}000\text{ lb}\cdot\text{ft}}{24.3\text{ in}^3}}\) = 8,400 psi < Fb, ok

ClariCalc has a field that will make that comparison and refresh the ok/ng decision every time that you redo a calculation.

Step one is to do the calculation, but stop just before writing ok.

fb = \(\frac M{S_x}\) = \(\color{#005696}{\frac{17{,}000\text{ lb}\cdot\text{ft}}{24.3\text{ in}^3}}\) = 8,400 psi < Fb,

Step two is to invoke one of these two commands:

Add-Ins | Insert | OK | □ ≤ □ ⇒ OK

Add-Ins | Insert | OK | □ ≥ □ ⇒ OK

ClariCalc will insert the field. Then, every time the calculation is refreshed, it will re-check the comparison. If the value flips to a value that violates your chosen comparison, the field will notify you.

fb = \(\frac{M}{S_x}\) = \(\color{#005696}{\frac{75{,}000\text{ lb}\cdot\text{ft}}{24.3\text{ in}^3}}\) = 37,000 psi > Fb, ng

If you are interested in the internal contents of the field, you can see them by selecting a field and pressing shift F9. It will look something like this:

{ ◊if 37,000 <= 21,400 ok ng }

The two numbers inside the field correspond to the two values in the comparison. The two values will be converted to SI base units if their assigned units do not exactly match.

Troubleshooting

Answers to some common questions:

The ClariCalc installation didn’t work. What’s wrong?

Watch out for:

  1. If Internet Explorer would not download the ClariCalc installation file, try another browser. Chrome works.
  2. Exit Word before running ClariCalc-Setup.exe.
  3. You need to have Administrator rights to install ClariCalc.
  4. Examine your user ID. If you have more than one user profile, ClariCalc may have installed to the wrong folder.

Why didn't ClariCalc find my variable?

ClariCalc only searches for variables at the beginning of a line or after a tab.

Why did ClariCalc find the wrong number for my variable?

a.  If a Bookmark exists, ClariCalc will find it, no matter what else is in your document.

b.  If you have set a lookup key or a parent file, then ClariCalc may have found your variable in another file.

Why did ClariCalc add an extra character after the "=" sign?

The extra character is a breadcrumb that will later tell ClariCalc where and how to perform re-calculation. The breadcrumbs will not print out. When a recalculation encounters these characters, ClariCalc will take the following actions:

  Re-compute the preceding formula.

='  Re-compute the preceding formula, with unit-aware variable search.

=:  Delete the preceding formula echo and re-compute the formula that preceded it.

=;  Delete the preceding formula echo and re-compute the formula that preceded it, with unit-aware variable search.

Format for Lookup Table Files

As described above, a user can define a lookup key, such as:

Section = “W8x18

then ClariCalc will populate variables with values from a lookup table, based on the lookup key.

This section tells you how to write your own lookup table. To begin, all lookup table files must be located in subdirectory C:\Users\userID\AppData\Roaming\Hilbert\. There can be more than one such file.

In that folder, ClariCalc will examine all the files named: LookupTable*.txt. If you have ClariCalc Pro, you may already have two such files—LookupTableStructural.txt and LookupTableElectrical.txt.

LookupTable files must be written in a particular format. The next few lines show an example:


Categories: Section Steel
 
W wself A d tw bf tf
Section plf in² in in in in
W8x31 31 9.12 8 8 0.285 0.435
W8x28 28 8.24 8.06 6.54 0.285 0.465
W8x24 24 7.08 7.93 6.5 0.245 0.4
W8x21 21 6.16 8.28 5.27 0.25 0.4
W8x18 18 5.26 8.14 5.25 0.23 0.33
 
Steel Grade Fy Fu Ry Rt
Steel ksi ksi
ASTM A36 36 58
ASTM A36 plates 36 58 1.3 1.2
ASTM A992 50 65 1.1 1.1

The file’s first line has tab-delimited values that define the categories of the possible lookup keys. This example has two categories, so the user would be able to define such lookup keys as:

Section = “W8x18”, or

Steel = “ASTM A992

The file’s second line must be blank.

The remainder of the file is a series of tab-delimited data sections. The top row of each section contains the variable names that the document will inherit after a lookup key is defined. The second row of each section defines the unit of measure for each variable.

The rest of the rows in each section contain the data. First comes the lookup key, then a value for each variable.

Now let me modify what I said about the first two rows of each section. The first word in each of those rows is used to help the operation of the dialog box that allows a user to choose a Lookup Key from a list.

The first row’s first word will populate the Group list on the left hand side of the dialog box.

The second row’s first word will define the category of the lookup key, such as Section or Steel.

Each section must be separated from other sections by a blank line.

Save the text file in UTF-8 text format.

When a user wants to access this data, they will do it in two steps.

  1. Define the lookup key, e.g., Section = “W8x24
  2. Call a variable in a calculation, e.g., d = 7.93 in.

ClariCalc Precision

Internally, ClariCalc holds numbers in memory using either a Decimal data type or a Double (64 bit floating) data type. The Decimal numbers have precision of 28 digits or less. Doubles have approximately 15 digit precision.

Precision limits like these can create problems that you might not expect. Problems when you test for equality, problems in subtraction, problems with overflow. John Cook explains them well here.

During a recalculation, ClariCalc internally holds the result of each operation with maximum precision. These internal values are discarded when the recalculation ends. For subsequent recalculations, ClariCalc uses the value displayed on the page or screen, which may have been rounded to a less precise value when it was written into the document.

Specialties

ClariCalc goes beyond the calculation engine in ClariCalc and provides several additional capabilities. These are described in other pages of this website:

Updates

ClariCalc updates are free. To get the latest version of basic ClariCalc, use the Download button in the left sidebar. ClariCalc was last modified on 28 March 2018.