# HP Forums

Full Version: Plot derivative of a function
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi all

I cannot seem to work out the following and would appreciate some help. In the FUNCTION app, I put some function in F1. What I would like to have is in F2 the calculator to work out the numerical derivative of F1 and therefore be able to plot the function and its derivative.

I don't want to put the actual derivative into F2 but something like F2(X)=diff(F1) (but obviously something that works). Then I could get my students to explore functions and slopes without having to be able to differentiate things that are beyond them.

I'm trying to avoid using any CAS because it is not permitted for the exam system I work within.

Many thanks
(05-31-2014 02:47 PM)swisscow Wrote: [ -> ]Hi all

I cannot seem to work out the following and would appreciate some help. In the FUNCTION app, I put some function in F1. What I would like to have is in F2 the calculator to work out the numerical derivative of F1 and therefore be able to plot the function and its derivative.

I don't want to put the actual derivative into F2 but something like F2(X)=diff(F1) (but obviously something that works). Then I could get my students to explore functions and slopes without having to be able to differentiate things that are beyond them.

I'm trying to avoid using any CAS because it is not permitted for the exam system I work within.

Many thanks

I try these example and it works...

F1 : SIN(X)/X
F2 : dF1(X)/dX=X

where d../d.. are in fact the pattern (the key just right near catalogue key... 1rst row 4th coll)

Edit: There is an issue... You can't find extrema of F2 if you need with the embedded tools but the root find works...
Genius!

Many thanks, got it working
(05-31-2014 02:47 PM)swisscow Wrote: [ -> ]Hi all

I cannot seem to work out the following and would appreciate some help. In the FUNCTION app, I put some function in F1. What I would like to have is in F2 the calculator to work out the numerical derivative of F1 and therefore be able to plot the function and its derivative.

I don't want to put the actual derivative into F2 but something like F2(X)=diff(F1) (but obviously something that works). Then I could get my students to explore functions and slopes without having to be able to differentiate things that are beyond them.

I'm trying to avoid using any CAS because it is not permitted for the exam system I work within.

Many thanks

This seems to work:

F1(X)= SIN(X)
F2(X)= SLOPE(F1,X)

where SLOPE() is from Toolbox>App>Function>SLOPE (#5) and
F1 is from Vars>App>Function>Symbolic>F1 (#1)
or type SLOPE(), F1 in with Alpha...

** Teachable moment: looks about 57 times different if you are in degrees versus radians...
And another round of thanks for that solution.

I have been trying to crack this for a while and now 2 solutions in as many minutes - marvellous stuff.

Thanks
(05-31-2014 03:40 PM)swisscow Wrote: [ -> ]And another round of thanks for that solution.

I have been trying to crack this for a while and now 2 solutions in as many minutes - marvellous stuff.

Thanks

My pleasure - I only recently stumbled on Toolbox>App>Function> which gives cool plots of slope, area, root etc which are dynamic with changes in F1(X).

May I ask specifically how you key in the first solution? dF1/dX=X? No rush.
[/quote]
May I ask specifically how you key in the first solution? dF1/dX=X? No rush.
[/quote]

The key just at the right of the catalogue key... will open a pattern menu... the partial derivative is on 1rst row and 4th coll...
Its like a fraction with the dF1(X) on the top and dX=X on the bottom
Cool thanks that worked! Wonder why the =X is required?
(05-31-2014 06:23 PM)CR Haeger Wrote: [ -> ]Cool thanks that worked! Wonder why the =X is required?

First I was confused about that too, but if you just put the template of the partial derivative into the command line and then press "Help" you will get a nice explanation on that. The use of dX=X in the denominator becomes clear when using the algebraic entry version of the partial d instead of using the textbook entry.
Hello,

Quote:Cool thanks that worked! Wonder why the =X is required?

F2(X) needs to be a function that, when evaluated with a given X variable returns a Y.

if F1(X)=SIN(X)
and F2(X)=dF1(X)/dX
note that the X in the F2(X) definition is NOT the same as the X in F2(X)...
What it is (in programing terms), is a local variable, which has the same name, but is different.
dF1(X)/dX is NOT a function that varies with X as you can calculate it regardless of the value of X...
dF1(X)/dX is the same as dF1(A)/dA for example.

If you restate your problem as: F2 is the result of the EVALUATION of the derivative of F1 with respect to a variable at a given value of a variable, then you see that you do indeed have 2 variables to contend with, not one.

the syntaxe: dF1(X)/dX=value is a shorthand for dF1(X)/dX | X=X (|=WHERE)

Cyrille
(06-02-2014 05:59 AM)cyrille de brébisson Wrote: [ -> ]the syntaxe: dF1(X)/dX=value is a shorthand for dF1(X)/dX | X=X (|=WHERE)

The math purist might prefer dF1(T)/dT=X for dF1(T)/dT | T=X. It seems clearer written this way as it shows that you're taking a derivative with respect to a variable, T, then evaluating it at a value, X.

I strongly discourage students from writing things like the above or ∫(F1(x),x,0,x) in which the x has two different meanings. And by "strongly discourage" I mean I take off a token point on a test. :-)

-wes
(06-04-2014 06:56 AM)Wes Loewer Wrote: [ -> ]… I take off a token point on a test. :-)

just one token point for something which is wrong? … You are really generous!
(06-04-2014 08:26 AM)Maro Wrote: [ -> ]
(06-04-2014 06:56 AM)Wes Loewer Wrote: [ -> ]… I take off a token point on a test. :-)

just one token point for something which is wrong? … You are really generous!

It depends on the context. Suppose a 10 point problem asked students to find some quantity which required the signed area under a function, f(x), from 0 to some value x, and they wrote ∫ f(x) dx from 0 to x, but correctly found the anti-derivative, correctly evaluated it at the endpoints, subtracted, and gave a correct interpretation. Yeah, I'd probably take off only one point. Call me a push-over, but I'd say they got about 90% of the math correct. :-)
Hi Wes
sure! you are right

(06-04-2014 02:38 PM)Wes Loewer Wrote: [ -> ]... Call me a push-over, but …

oh no, I will never do that
Hello,

Quote:just one token point for something which is wrong? … You are really generous!

Problem is, it is not wrong!
What you have is 2 variables, with the same name but a different scope.
This is not a problem in computer sciences where such a construct
{
int i=0;
{
int i=1;
}
}
happends often, and where we know what to look for (but still causes bugs every once in a while)...

In math, the ground is much murkier as math is WAY less formal than most people think...

regardless, int(f(x),x,0,x) is not 'wrong', it is just VERY confusing to someone who is not paying attention/used to such concepts...

Cyrille
(06-05-2014 04:25 AM)cyrille de brébisson Wrote: [ -> ]Hello,

Quote:just one token point for something which is wrong? … You are really generous!

Problem is, it is not wrong! ….

Sorry, it is!

(06-05-2014 04:25 AM)cyrille de brébisson Wrote: [ -> ]
regardless, int(f(x),x,0,x) is not 'wrong', it is just VERY confusing to someone who is not paying attention/used to such concepts...

Cyrille

It may not be "wrong" for someone who is not paying attention to formal math, but for those who do care about math it is wrong! (Math will never be confusing) IMHO, if programmers in general were more correct in math a lot of bugs could be avoided … and customers be satisfied.
(06-05-2014 08:00 AM)Maro Wrote: [ -> ]
(06-05-2014 04:25 AM)cyrille de brébisson Wrote: [ -> ]Hello,

Problem is, it is not wrong! ….

Sorry, it is!

(06-05-2014 04:25 AM)cyrille de brébisson Wrote: [ -> ]
regardless, int(f(x),x,0,x) is not 'wrong', it is just VERY confusing to someone who is not paying attention/used to such concepts...

Cyrille

It may not be "wrong" for someone who is not paying attention to formal math, but for those who do care about math it is wrong! (Math will never be confusing) IMHO, if programmers in general were more correct in math a lot of bugs could be avoided … and customers be satisfied.

Math check in addition to spell check, and grammar check!
Maro, you should have added humor tags about bugs that could possibly be avoided... Just to match cyrille's humor. Though things are about to become off-topic.
But we should focus on the important things like bugs and requests for help. We are the community let's work together. Althogh some are disappointed.
Pages: 1 2
Reference URL's
• HP Forums: https://www.hpmuseum.org/forum/index.php
• :