HP Forums
Plot derivative of an ABS( function ) fails (RESOLVED) - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Plot derivative of an ABS( function ) fails (RESOLVED) (/thread-3725.html)



Plot derivative of an ABS( function ) fails (RESOLVED) - StephanP - 04-27-2015 12:29 PM

While testing the HP Prime I ran into the following odd behaviour.

Symb
F1(X)=|X^2 -10X +21| (between absolute brackets)
F2(X)=dF1(X)/dX=X (the derivative of F1)

Plot
F1 plots fine, bouncing nicely at x=3 and x=7
F2 does not plot well. It gives three horizontal line segments.
Y=1 for x < 3
Y=-1 for 3 < x < 7
Y=1 for x > 7

[attachment=1916]

If I use the function Slope in the plot windows, then correct slope values are given for F1.
For F2, slope values are "NaN".

When I remove the absolute brackets from F1, F2 plots perfectly.


RE: Plot derivative of an ABS( function ) fails - StephanP - 04-28-2015 12:25 PM

No response yet. Still I'd like to know.
- Is it a bug?
- Am I wrong to expect a proper derivative plot?


RE: Plot derivative of an ABS( function ) fails - rprosperi - 04-28-2015 01:28 PM

(04-28-2015 12:25 PM)StephanP Wrote:  No response yet.

It has been less than a full day since your initial post. Please be patient for a reply, many users do not check in hourly or even daily. It seems your interest is more curiosity than some urgent need, so please continue exploring it yourself in parallel; you may find an answer before another user gets to reply.


RE: Plot derivative of an ABS( function ) fails - ww63 - 04-28-2015 01:58 PM

Hello,

probably the problem is a result of the fact, that the ABS-Function leads to a not continously differntiable function. At the roots of the basic function the ABS-function creates a discontinuity!

What is the slope at x = 3 or x = 7? I think the value of the derivative at this points represented by NaN (not a number).

regards

Wolfgang


RE: Plot derivative of an ABS( function ) fails - CR Haeger - 04-28-2015 02:19 PM

F2(X)= SLOPE(F1,X) seems to work.

Similar topic Here


RE: Plot derivative of an ABS( function ) fails - Tim Wessman - 04-28-2015 02:27 PM

For the moment, you'll need to use that SLOPE command as shown in the other thread. It *was* an issue. :-)


RE: Plot derivative of an ABS( function ) fails - StephanP - 04-28-2015 03:58 PM

Yes, SLOPE(F1,X) works.
I did find that other thread, but as I was experiencing crashes using slope() (lowercase from the Catalog), I went for the d/dx method. This seemed to work fine, apart from the ABS() case.
Still it's a bit confusing, these variants of slope() and SLOPE(). I had to type it manually.

Thanks CR, Tim.


RE: Plot derivative of an ABS( function ) fails (RESOLVED) - Tim Wessman - 04-28-2015 04:45 PM

(04-28-2015 03:58 PM)StephanP Wrote:  I had to type it manually.

TOOLBOX->APP->FUNCTION


RE: Plot derivative of an ABS( function ) fails (RESOLVED) - CR Haeger - 04-28-2015 04:54 PM

(04-28-2015 03:58 PM)StephanP Wrote:  Yes, SLOPE(F1,X) works.
I did find that other thread, but as I was experiencing crashes using slope() (lowercase from the Catalog), I went for the d/dx method. This seemed to work fine, apart from the ABS() case.
Still it's a bit confusing, these variants of slope() and SLOPE(). I had to type it manually.

Thanks CR, Tim.

Toolbox > App > Function > SLOPE is what I use while in the Function App.

Another interesting way to key this into CAS and send to Function App:

f(x):= |X^2 -10X +21|
F1:=f
F2:=f'


which defines f(x), F1 as f(X) and F2 as f'(X). Hit Plot and it should display ok.