Re: HP 15C LE extremums Message #13 Posted by Dieter on 20 May 2013, 4:04 p.m., in response to message #11 by Richard Berler
First, please do not use 2 y^x when you want to get x^2. There is a dedicated x^2 key on virtually any scientific HP, which works much faster, preserves x in LastX and is even potentially more accurate.
Your approach assumes that x fills the whole stack so that it can be recalled with x<>y in your LBL 0 routine. However, in LBL 1 it's this routine that provides the x-value, so you will have to enter a few ENTER commands that fill the stack before GSB 0 is called. Also the LBL 1 routine lacks the final division by h. Which usually (but not always) does not matter much if you want to solve for f'(x)=0, but I think you should add that division there.
With these adjustments everything works fine. All this can be done shorter and faster if the function is coded the way Thomas and I proposed. Also see my detailled post below.
0 ENTER 12 f SOLVE 0 => 5,0000 f(5) = 0
0 ENTER 5 f SOLVE 1 => 1,5000 f'(1,5) = 0
Dieter
|