Hack 74 Use Fields for Heavy-Duty Calculations![]() ![]() can perform some surprisingly complex calculations.The built-in formula fields [Hack #72] give you most of the math power needed for typical Word work. But what if you need something more sophisticated? With some old-fashioned algebra, you can use those formula fields as building blocks for more complicated calculations. This hack shows you two such field combinations for calculating logarithms and a few trigonometry functions.
added for readability. While not necessary, they make these mammoth fields much easier to read and modify. 8.6.1 LogarithmsWhen you update the following field, you're prompted to enter a number. The field then calculates the log of the number you entered. Because Word does not include a built-in log function, this hack uses a Taylor Series Approximation to calculate the results. {QUOTEAs coded, the field gives results to 13 decimal places, which should be enough for most purposes. If you need to calculate the logs of larger or smaller values, increase the values in parameter b (the exponent) accordingly.
8.6.2 TrigonometryWord's formula fields also lack trigonometric functions, such as sine, cosine, and tangent. Again, you can use Taylor Series Approximations to generate quite accurate results (to 13 decimal places). Here's how to create a table that will give you the sine, cosine, and tangent values for a given angle, as shown in Figure 8-4. Figure 8-4. Viewing the trig values calculated for an angle![]() two rows. Title the first column Angle, the second Sine, the third Cosine, and the fourth Tangent. In the second row, enter the field codes for each value, shown in the next four sections.To create the "Ø" character, hold down the Alt key and type 0216 on the numeric keypad [Hack #30] . 8.6.2.1 AngleEnter the following field code in the second row of the first column: {QUOTE{ASK Ø "What angle do you want the trig values for?"}{Ø}} 8.6.2.2 SineEnter the following field code in the second row of the second column: {QUOTE 8.6.2.3 CosineEnter the following field code in the second row of the third column: {QUOTE 8.6.2.4 TangentEnter the following field code in the second row of the fourth column: {QUOTETo enter a new angle, select the entire table and press F9.Paul Edstein |