Locking and Unlocking Variables
Locking lets you protect variables from modification or deletion. Locking prevents unintended changes to a variable.
Time and altitude lists can be locked to ensure problem fidelity. |
Reference function f1 can be locked to prevent unintended change. |
Variables you Cannot Lock
• | System variable Ans |
• | stat. and tvm. variable groups |
Important Information About Locked Variables
• | To lock variables, use the Lock command. |
• | To modify or delete a locked variable, you must first unlock the item. |
• | Locked variables display a lock icon on the variable menu list. |
• | The Lock command clears the Redo/Undo history when applied to unlocked variables. |
Examples of Locking
Lock a,b,c |
Locks variables a, b, and c from the Calculator application. |
Lock mystats. |
Locks all members of variable group mystats. |
UnLock func2 |
Unlocks variable func2. |
lm:=getLockInf (var2) |
Retrieves the current lock status of var2 and assigns that value to lm in the Calculator application. |
For more information, see the Reference Guide.
Updating a Variable
If you want to update a variable with the result of a calculation, you must store the result explicitly.
Entry |
Result |
Comment |
a := 2 |
2 |
|
a3 |
8 |
Result not stored in variable a. |
a |
2 |
|
a := a3 |
8 |
Variable a updated with result. |
a |
8 |
|
a2 & a |
64 |
Variable a updated with result. |
a |
64 |
|
Reusing the Last Answer
Each instance of Calculator automatically stores the last calculated result as a variable named Ans. You can use Ans to create a chain of calculations.
Note: Do not link to Ans or any system variable. Doing so could prevent the variable from being updated by the system. System variables include statistics results (such as Stat.RegEqn, Stat.dfError, and Stat.Resid) and Finance Solver variables (such as tvm.n, tvm.pmt, and tvm.fv).
Example 1
As an example of using Ans, calculate the area of a garden plot that is 1.7 meters by 4.2 meters. Then use the area to calculate the yield per square meter if the plot produces a total of 147 tomatoes.
1. | Calculate the area: |
- | On the Calculator entry line, type 1.7*4.2, and press Enter. |
- | Handheld: On the Calculator entry line, type 1.7 r 4.2, and press ·. |
2. | Reuse the last answer to calculate the yield per square meter: |
- | Type 147/ans and press Enter to find the yield. |
- | Handheld: Type 147 p ans, and press · to find the yield. |
Example 2
As a second example, calculate and then add 2*log(45).
1. | Type 3.76/(-7.9+sqrt(5)), and press Enter. |
Handheld: Type 3.76 p (v7.9+sqrt(5)), and press ·.
2. | Type ans+2*log(45), and press Enter. |
Handheld: Type ans+2 r log(45), and press ·.
Temporarily Substituting a Value for a Variable
Use the “|” (such that) operator to assign a value to a variable for just a single execution of the expression.