The Museum of HP Calculators

HP Forum Archive 21

[ Return to Index | Top of Index ]

HP PRIME: derivative at a point
Message #1 Posted by Alasdair McAndrew on 18 Nov 2013, 10:37 p.m.

I was experimenting with some interpolation techniques; in the CAS view of the Functions app I've entered:

{-3,1,2,5} -> xs
{-61,-5,-1,83} -> ys
product(x-xs) -> q(x)

So far so good. Now what I want to do is evaluate the derivative of q(x) at all the elements of xs. Here's where I get stuck: "diff" only computes symbolic derivatives, and SLOPE doesn't seem to work:

SLOPE(q(x),7)
SLOPE(q(X),7) 

return 0 and "Error: Undefined Result" respectively.

q(x) returns (3+x)*(-1+x)*(-2+x)*(-5+x) as it should q(X) returns 0 - it seems to think that the value of X is 0 - and this persists even after "purge(X)".

In Home view,

q(x) returns Error: Syntax Error q(X) returns -30

So no joy there.

I have discovered that, for example

eval(diff(q(x)),x=3)

will, for example, compute the derivative at a point. But it won't let me pick out a list element:

eval(diff(q(x)),x=xs(1))

produces a long expression full of "xs(1)": clearly for some reason this is not treated as a numeric value.

The best I can do is

seq(eval(diff(q(x)),x=k),k=xs) -> ds

which works, but is confusing. (MAKELIST doesn't seem to work here: in fact MAKELIST hardly even seems to work).

Are there any "natural" ways to perform these sort of computations?

[Note, on both the TI-nspire and the Casio ClassPad I would just use "diff(q(x)|(x=xs)".]

Edited: 18 Nov 2013, 10:39 p.m.

      
Re: HP PRIME: derivative at a point
Message #2 Posted by Tim Wessman on 18 Nov 2013, 10:58 p.m.,
in response to message #1 by Alasdair McAndrew

dq(x)/dx=xs or (dq(x)/dx)|x=xs both work I beleive.

X exists because it is a non-removable home real variable.

Also, there is not any such thing as a <application> HOME or <applicaiton> CAS view. There is 1 CAS view, and 1 home view. The application is "active" while you are in those views, but it is not attached to it in any way.

            
Re: HP PRIME: derivative at a point
Message #3 Posted by parisse on 19 Nov 2013, 6:52 a.m.,
in response to message #2 by Tim Wessman

map(xs,q') or apply(q',xs)

Edited: 19 Nov 2013, 6:58 a.m.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall