f'(x) on WP34S  Printable Version + HP Forums (https://archived.hpcalc.org/museumforum) + Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum1.html) + Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum2.html) + Thread: f'(x) on WP34S (/thread218717.html) 
f'(x) on WP34S  Thomas Scott  04222012
I'm a bit puzzled by the results I'm getting using f'(x) on certain
Tom
Re: f'(x) on WP34S  Paul Dale  04222012 It samples at a number of points each spaced 0.1 apart. It tried to use ten points .5, .4, .3, .2, .1, .1, .2, .3, .4 and .5. If you set flag D, the infinity error wouldn't be raised and the derivative should fall back to a four or six point estimate if the ten fails. Alternatively, change the dX it is using by defining the appropriate global label.  Pauli
Edited: 23 Apr 2012, 1:43 a.m. after one or more responses were posted
Re: f'(x) on WP34S  Walter B  04232012 I updated the description of f'(x) in the manual to make it a bit clearer. Committed and ready for reading :)
Re: f'(x) on WP34S  Marcus von Cube, Germany  04232012 Pauli, can the effect of flag D be automated? From a user's point of view, the error is not justifiable because the function is well behaved at 0.5 and near it. Something like the following should do: FS?S DBut it might even be better to automate this all together for XROM code. Edited: 23 Apr 2012, 2:44 a.m.
Re: f'(x) on WP34S  Paul Dale  04232012 Yes, the D flag could be automated, yes I've considered this and decided not to do it. I think that only the derivatives will gain anything from this. My reasoning is two fold:
The first one is the big one to my mind, the user's settings are sacred. If they want to allow infinities and NaNs, there is a simple and well documented method to do so. Although, not all of the caveats and pitfalls are well documented :) However the second point is also quite relevant. Appropriately setting the dX value is important and requires some understanding of the function being differentiated.
PS: the original GaussKronrod integrator also fell into the same category. The Romberg integrator doesn't.
Re: f'(x) on WP34S  Thomas Scott  04232012 "Alternatively, change the dX it is using by defining the appropriate global label." Re: f'(x) on WP34S  Marcus von Cube, Germany  04232012 Thomas, its not a 'd', its a 'delta' (to be found by fEXIT (lower case), gD (delta)).
Re: f'(x) on WP34S  Thomas Scott  04232012 Yes, that's what I meant to say (or write)and that's what I've been doing (without success). Re: f'(x) on WP34S  fhub  04232012 I remember that there has been auch a predefined global label 'deltaX' in previous versions, which was even listed in the CATalog. Now I can't find it anymore  has it been removed intentionally?
Franz
Re: f'(x) on WP34S  Paul Dale  04232012 Yes this label was removed intentionally. It was primarily there to ensure the CAT browser always found something :) Marcus's rework of CAT avoided the issue.
Re: f'(x) on WP34S  Paul Dale  04232012 Upper or lower case delta? You need to put a lower case delta in. The case shift is fshift EXIT. So the whole sequence is: fshift R/S ENTER^ fshift EXIT gshift STO ENTER
Re: f'(x) on WP34S  Thomas Scott  04232012
Yes, that's what I've been doing (using gD not gSTO) and also using a lower case x. Should x be upper case? Re: f'(x) on WP34S  Paul Dale  04232012 Capital X. XEQ'[delta]X' is the line of code that calls the user supplied function from XROM.
Re: f'(x) on WP34S  Paul Dale  04232012 The manual says lower case x  so it is wrong :) Well, it doesn't agree with the code.
 Pauli
Re: f'(x) on WP34S  Thomas Scott  04232012 When I define (small delta)X(uppercase x), then the f'(x) function Re: f'(x) on WP34S  Paul Dale  04232012 Try pressing R/S after the f'(x) 77. For some reason the code doesn't seem to want to start executing....
Re: f'(x) on WP34S  Paul Dale  04232012 Or wrapper the f'(x) call in a program and it runs all the way through.
 Pauli
Re: f'(x) on WP34S  Walter B  04242012 Quote:It's simply more consistent than the code :) The command is called f'(x) so the routine for the step size should be called δx (i.e. lower case delta and lower case x) ... Re: f'(x) on WP34S  Marcus von Cube, Germany  04242012 We are working on the issue. Calling a user label from XROM needs special precautions which aren't met yet.
Re: f'(x) on WP34S  Paul Dale  04242012 We accept any case now and f' seems to work okay again.
Re: f'(x) on WP34S  fhub  04242012 Another question, Pauli: For me this value 0.1 seems really a bit big, I guess I would have used dx=1e3 if I had written such a f'(x) routine (but of course I don't know the details of your 10point approximation method). And if someone arguments that for big xvalues adding such a small dx may not change x (or f(x+dx) may not be different to f(x)), well  then it might even be better to make this default dx dependent of the value of x. Just an idea ... Franz
Edited: 24 Apr 2012, 7:31 a.m.
Re: f'(x) on WP34S  Paul Dale  04242012 No real reason to choose 0.1, many similar values will be as good. I needed a default value and that's what I picked, the choice of the delta is really dependent on the problem being solved more than anything else. It is, however, possible to choose too small a value  I did originally although I don't remember exactly what I picked. I do remember it didn't seem all that small at the time. JeanMarc Baillard's numerical derivatives for the 41c chooses similar values for dX and also lists the 10 point formula I used. BTW: the 34s will fall back to a six point or a four point formula if flag D is set and problems occur  I don't expect most people to ever discover this but it is there for the more numerically savvy.
