Plot derivative of a function - 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 a function ( /thread-1489.html)Pages: 1 2 |

Plot derivative of a function - swisscow - 05-31-2014 02:47 PM
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 RE: Plot derivative of a function - dg1969 - 05-31-2014 03:09 PM
(05-31-2014 02:47 PM)swisscow Wrote: Hi all 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... RE: Plot derivative of a function - swisscow - 05-31-2014 03:18 PM
Genius! Many thanks, got it working RE: Plot derivative of a function - CR Haeger - 05-31-2014 03:22 PM
(05-31-2014 02:47 PM)swisscow Wrote: Hi all 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... RE: Plot derivative of a function - swisscow - 05-31-2014 03:40 PM
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 RE: Plot derivative of a function - CR Haeger - 05-31-2014 03:53 PM
(05-31-2014 03:40 PM)swisscow Wrote: And another round of thanks for that solution. 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. RE: Plot derivative of a function - dg1969 - 05-31-2014 04:20 PM
[/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... RE: Plot derivative of a function - swisscow - 05-31-2014 05:03 PM
Its like a fraction with the dF1(X) on the top and dX=X on the bottom RE: Plot derivative of a function - CR Haeger - 05-31-2014 06:23 PM
Cool thanks that worked! Wonder why the =X is required? RE: Plot derivative of a function - Maro - 05-31-2014 07:10 PM
(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. RE: Plot derivative of a function - cyrille de brébisson - 06-02-2014 05:59 AM
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 RE: Plot derivative of a function - Wes Loewer - 06-04-2014 06:56 AM
(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 RE: Plot derivative of a function - Maro - 06-04-2014 08:26 AM
(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! RE: Plot derivative of a function - Wes Loewer - 06-04-2014 02:38 PM
(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. :-) 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. :-) RE: Plot derivative of a function - Maro - 06-04-2014 03:04 PM
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 RE: Plot derivative of a function - cyrille de brébisson - 06-05-2014 04:25 AM
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 RE: Plot derivative of a function - Maro - 06-05-2014 08:00 AM
(06-05-2014 04:25 AM)cyrille de brébisson Wrote: Hello, Sorry, it is! (06-05-2014 04:25 AM)cyrille de brébisson Wrote: … 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. RE: Plot derivative of a function - Manolo Sobrino - 06-05-2014 08:59 AM
http://www.hpmuseum.org/forum/thread-1385.html RE: Plot derivative of a function - DrD - 06-05-2014 10:24 AM
(06-05-2014 08:00 AM)Maro Wrote:(06-05-2014 04:25 AM)cyrille de brébisson Wrote: Hello, Math check in addition to spell check, and grammar check! RE: Plot derivative of a function - Angus - 06-05-2014 10:39 AM
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. |