|Everything HP200LX: Knowledge, Products, Service|
A More Detailed Example
One of the reasons for using the L(,) and G() functions is to hide variables from the users of your equations. A more practical use of the L(,) function is to solve for more than one variable at a time. It also gives you a way to impose your own order on the items listed in the variable menu. Probably the most important function of L(,) is to save keystrokes by entering complex expressions. To see how you can impose order in the variable menu and save keystrokes, consider the formula listed below.
The formula comes from the pages of the HP-41C Users' Library Solutions: Business Stat/Marketing/Sales. It describes the relationship between manufacturing costs of an item and the knowledge/ experience you have gained about the manufacturing of the item. I'll paraphrase the problem.
Typically, production costs drop as more of an item is produced. This is because experience is gained and the production process becomes more efficient. The relationship between production cost and efficiency gained through experience can be given as:
Cost of Nth Item =
Cost of 1st x Units^(log LmF/log)
"Units" is the number of the items produced and "LrnF" is the "learning factor", a measure of experience gained in the production process.
Similarly, the average cost of producing any number of items is:
Avg Cost = [Cost of 1st / (Last-First)] x [Last^(B+1)-
First^(B+1)] / B+1
Where B = Log LrnF / Log 2 and "Last and First" refer to the numbers of the items. This formula could find the average cost of producing items #500 through #3000.
There are certain limitations to this formula. The average is a first approximation. Small values of "Last-First" may give inaccurate results.
To get these formulas to come to life, enter Solver and use <Down Arrow> to move the highlight bar to a blank line at the bottom of your Solve Catalog. Press F2 to get to a blank Solver editor screen and then key in the first equation.
There's nothing in the book that says you have to write the formula all on one line. Press a Tab, not <ENTER>, after each line above. When you've finished with the last line, press <ESC> or <ENTER> to end the editing session. Then press F9 and you should see the items listed as
Now suppose I wanted Cost_1st to come before Cost_Nth. I would press <ESC> F2 and add a line to the beginning of the equation.
This subterfuge of adding 0*Cost_1st doesn't change the nature of the equation (0*Cost_1st=0). However, it does change the order of items in the variable menu.
Before pressing <ENTER>, modify the last line of the above equation so that it reads L(B,log(LrnF)/log(2)).
This use of L(,) does not change the equation. It merely gives to the variable "B" the result of log(LrnF)/Log(2)." This will save us some keystrokes later.
Now press <ENTER> F9 (Note: "B" does not appear in the list). Press <Down Arrow> to get a blank editing line. Start typing Avg_Cost and the editing screen appears automatically. Key in the equation below.
Since we don't want "B" to appear in the list, we have to wrap it up in the G() function. Note how our earlier use of L(B, ...) saved us a lot of keystrokes in this equation. Each time we want log(LrnF)/log(2), all we enter is B.
We now have two equations. If we want only one equation that solves for every variable we can rewrite the first equation as follows. Insert + 0*First+ 0*Last at the tail end of the first equation to force Solver to put these variables in the list where you want them. Then insert the second equation, but change the first phrase in the second equation from Avg_Cost= to +0*L(Avg_Cost,. Finally, add the phrase + 0*Avg_Cost at the end to make this variable appear in the list. The equation will look like this in the Solve Editor (this equation in LRNCRV.EQN *):
To make the modifications, I recommend using MEMO. First save the File as LRNCRV.EQN (press <MENU> File Save, type in LRNCRV and press <ENTER>). Then use MEMO to edit the LRNCRV.EQN file.
It's far easier to edit an EQN file with a text editor than to try to do the same thing in the Solver Editor. Finally, save the file and quit MEMO.
[Editor's note: The case in the G function seems important. When I entered Ed's equation using G(b) rather than G(B), it did not perform properly -- Hal.]
Return to Solver and press <MENU> File Retrieve to activate the revised file. Then press F9 and see the following:
The numbers on the right side of the equal signs will be meaningless.
To solve an example problem, set the following:
Cost_1st = 975.00
Cost_Nth = 643.00
Units = 100.00,
First = 1.00
Last = 100 Both First and Last cannot = 0.
The above figures indicate that the cost of producing the first item was $975, the cost of the 100th unit was $643, and the number of "units" was 100. Highlight LrnF = and press <Space Bar>. You should see 0.94. (This assumes that you have pressed <MENU> Options Format Fix 2 from within HP CALC.)
Now find the average cost of producing items 1 through 10,000. Set First=1.00 and Last=10,000.00. DON'T try to solve for Avg_- Cost. (It won't work.) Highlight LrnF again and press <Space Bar>. Note that Avg_Cost magically reveals the amount of 466.13. L(,) solved for two variables at the same time.
Finally, to find the cost of the 10,000th item, set Units=10,000.00. Then highlight Cost_Nth and press <Space Bar>.
The answer is 424.05.
There's more that the L(,) and G() functions can do, but this is enough for now.
Copyright © 2010 Thaddeus Computing Inc