Quote:

I gave your program credit in my 1st post...indeed it worked great.

Thank you very much. However, I basically wanted to point out that the local minimum is not located at x = 1,353 or somewhere between 1,3 and 1,4, as you wrote. Actually it is at x = 0,1353.

Quote:

Still puzzled by the 34s since my dx is small (.029) and f'(x) is real all the way down to zero

The 34s f'(x) command evaluates the user function at numerous points around x. Pauli mentioned an interval of x +/- 5 dx. With dx as large as 0,03 this means you will get significantly below zero.

I tried your function x^{sqrt(x)} in the following way on the 34s. Two points are essential:

- Provide a decent value for dx. Values as small as x/100000 are fine here. I did it this way:

LBL [delta]X

X=0?

INC X ' for x=0, continue with x=1

SDR 05 ' divide by 100000

RSD 01 ' round to one significant digit

RTN

- The f'(x) command returns an
*approximation* (!) of the first derivative. How accurate may this estimate be? Six digits? Eight? Ten? More? We simply do not know. So we cannot expect a result of exactly zero at the local minimum or maximum. There is not much sense in having the solver going through half a dozen more iterations in order to find the 10th, 12th or 16th digit of a solution that is not that exact anyway. So it's a good idea to stop the solver as soon as the derivative drops below, say, 1E-9 or 1E-10. A simple round command will do that. The following code for the derivative rounds all results below 5E-10 to zero.

LBL "FX"

ENTER

SQRT

y^x

RTN

LBL "DER"

f'(x) "FX"

RDP 09 ' round to nine places

X<>0? ' if not equal to zero,

X<> L ' restore unrounded result

RTN

This way everything works on the 34s as well:

0,1 ENTER 1 SLV "DER"

=> 0,13533528322

This agrees in 10 digits with the true result.

*Addendum:* unlike simple implementations, the 34s multi-point derivative seems to handle large dx values very well. In the above code, replace SDR 05 with SDR 02, and RDP 09 may become RDP 12. For the same initial guesses, the solver should now return a result with 14 valid decimals.

Dieter

*Edited: 8 Oct 2013, 4:20 p.m. *