Extremum and second derivative

Post here to share useful tips and tricks, to ask questions about using your DM42 or to report software-related problems
Post Reply
Patrick
Posts: 21
Joined: Wed May 03, 2017 3:30 pm
Location: Canada

Extremum and second derivative

Post by Patrick » Fri Sep 07, 2018 8:23 pm

Hello,

Since I wanted to experiment a way of producing d/dX using the complex variable method, I implement one of Thomas Klemm's post on my hp42s. Even if the structure of my program is quite messy, it gives me d/dX, the extremum and the sign of the second derivative. The main issue here is when I try to execute the same program on my DM42, it doesn't work as expected.

For instance, with a very simple equation like f(x)=2x^2-4, my hp42s gives me an extremum at (0,-4), an F(X)'' of 4 (a minimum) with an initial guess of any number. When I run the same data on the dm42 and Free42, with an initial guess of 1, I get an extremum at (0.9899,-4) and a f(x)'' of -39 196 080 396 (a maximum) witch is obviously false. The only way to get the correct minimum is to provide an initial guess of 0 or very close to 0, like 1E-6.

I know that there's a lot to do to improve my program, but it seems to be accurate on the hp42s.

What should be done to make it work on the DM42 ? I must be missing something.

Here attached is my program. Just enter the equation in EQ and execute dF.

Thanks for your help.
Attachments
d-dX.zip
(471 Bytes) Downloaded 25 times
Unit SN: 00044

dlachieze
Posts: 140
Joined: Thu May 04, 2017 10:20 am
Location: France

Re: Extremum and second derivative

Post by dlachieze » Sat Sep 08, 2018 9:05 am

It seems to come from the x<>y at step 30. You're recovering the Solver previous estimates and uses as the x solution. As the Free42 Solver implementation is different from the 42s implementation you get a different value. But what you need is what you stored in R00, so as a quick fix just replace step 30 by RCL 00 (and then you can simplify your program as you don't need anymore R01...).
DM42 SN: 00425

Patrick
Posts: 21
Joined: Wed May 03, 2017 3:30 pm
Location: Canada

Re: Extremum and second derivative

Post by Patrick » Sat Sep 08, 2018 10:38 am

Thank you very much for your help. I modified line 30 and tried the program with f(x)=e^x-3x^2. It works perfectly with initial guess at 0 and 3. :P

Merci Didier, je n'avais pas encore réussi à mettre le doigt sur le problème.
Unit SN: 00044

Post Reply