Enter a Formula |
Enter a Formula When you open the formula editor, the cursor is in the formula pane. To enter a formula, type in the formula pane, click buttons on the keypad, or use the attribute and function list. Most likely you'll use a combination of these methods. Here are a few suggestions that will come in handy. •Click on an item to get an explanation of it in the help pane at the bottom of the formula editor. •When things don't work the way you want, use parentheses. •The up-arrow key is very useful when you want to understand the structure of an expression. •The formula editor is not case sensitive. You can type all lowercase, and TinkerPlots will interpret your expression correctly. For example, Round works as well as round. •When you have correctly typed an attribute name, it turns blue. •When you have correctly typed a slider name, it turns magenta. •Type * (Shift+8) for multiplication, / for division, and ^ (Shift+6) for exponentiation. When you've typed an exponent, use the right-arrow key to exit it. •Enter π by typing pi. As soon as you type an operator or press any of the arrow keys, the symbol π appears in place of "pi." •When you type the left parenthesis for a correctly spelled function, the function name turns red. •When you type an open parenthesis, TinkerPlots gives you both open and close parentheses, with the cursor between them. You can simply begin typing. To exit the parentheses, type a close parenthesis or use the right-arrow key. •Multiplication is sometimes indicated as a dot between terms and sometimes, as in traditional algebra, as nothing between terms (though you need to put the asterisk in). •When you type an open quote, TinkerPlots gives you both open and close quotes, with the cursor between them. You can simply begin typing. To exit the quotes, type a close quote or use the right-arrow key. You must use quotes to enter string values in formulas (such as "rich" in the following example). •When you type if( you get a complete (though empty) if-statement, with three parts for you to fill in (as shown below). Type the condition (in the example above, income > 100000), then use Tab to move to the results (result-if-true goes on the top, result-if-false on the bottom). If you want the results to be words (also known as strings), you must surround them with quotation marks. (See Make If- and Switch Statements.) •When you have more than two results, instead of nesting if-statements, you can use the switch function. This is useful for recoding attributes. The switch function takes an optional expression inside parentheses and then evaluates each of any number of true/false expressions to determine which value to return. To add an alternative, press Insert (Win) Command+Option+Return (Mac) on your keyboard. (See Make If- and Switch Statements.)
|