HP Forums
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


RE: Plot derivative of a function - cyrille de brébisson - 06-06-2014 08:24 AM

Hello

> Math will never be confusing

I beg to differ!

Math is extremly confusing. Past the very basic things (and even then...), most definitions are not agreed upon between mathematicians, and they all play with slightly different, generally unspoken rules depending on their field and even locale.

Examples:
- -6 is a number (a negative number) the square of a number is the number times the number. and yet -6² is -36!

- 3 points at the same location is a triangle... or not, depending on where you are from

- depending on your locale, in right to left writing countries, PI is written 3.14159 or 95141.3 your job to figure out which number is actually ment (PI is easy, but if you read 1.5, you do not know if it is 1.5 or 5.1!)

- 0^0 is undefined or 1 (some other say 0, but they are a minority)

- Matrix + scalar is mathematicaly non-sensical.. even then, I have seen it often, both in math packages and in math texts to say: add scalar to every item in the matrix.

- Modulo is not formally defined (at least not in a consistent manner) for negative numbers.

- Addition is not associative in numerical math!

etc, etc, etc...

These are all mathematic confusion which, when you move from one part of math to another cause confusions, errors and mis-understanding... In our field, where do do touch multiple levels, locals, type of users, we see this all the time...

Cyrille
Un-Obfulscating since 1998


RE: Plot derivative of a function - HP67 - 06-06-2014 08:31 AM

(06-06-2014 08:24 AM)cyrille de brébisson Wrote:  - -6 is a number (a negative number) the square of a number is the number times the number. and yet -6² is -36!

When the heck did this happen?

(06-06-2014 08:24 AM)cyrille de brébisson Wrote:  - depending on your locale, in right to left writing countries, PI is written 3.14159 or 95141.3 your job to figure out which number is actually ment (PI is easy, but if you read 1.5, you do not know if it is 1.5 or 5.1!)

No, this is not correct. In languages that write from right to left numbers are still written in the normal way (left to right). It's one of many good reasons that all computing should be done in English.


RE: Plot derivative of a function - Angus - 06-06-2014 08:33 AM

Cyrille's, the discussion was about to get very productive even You People at hp could get insights on what the users find out and miss..... Parisse joined.....

Could you not just have forgotten to bring this off topic thing up???

Sincerely


RE: Plot derivative of a function - Tim Wessman - 06-06-2014 04:07 PM

(06-06-2014 08:31 AM)HP67 Wrote:  No, this is not correct. In languages that write from right to left numbers are still written in the normal way (left to right). It's one of many good reasons that all computing should be done in English.

It is correct depending on where you are. There truly is a shift between ltor and rtol numbers in some regions even with the primary language is the same in nearby locations.

In short, it is a mess.


RE: Plot derivative of a function - Wes Loewer - 06-07-2014 01:12 PM

(06-05-2014 04:25 AM)cyrille de brébisson Wrote:  Problem is, it is not wrong!

Well, from a math point of view, I'd say it is wrong. From a computer science point of view, it's allowed, though perhaps not advisable in this case. I think the double meaning of x here may have caused confusion about what was going on. I'd at least suggest it not be used in documentation.

If a student writes something on paper, I expect them to write it using proper math notation. If a student types something into their calculator, all I'll see is the answer.

Quote: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)...

I recall in my first college programing class back in the 80's. The professor was emphasizing the importance of using locally defined variables and I wrote something like:

Code:

Program CircArea(output);

const 
  PI = 3.14;

function area(r : real) : real;
const
  PI = PI;  { <-- notice this }
begin
  area := PI*r*r;
end;
...

He didn't like the PI = PI statement, but I thought it made perfect sense. I figured the PI on the left was local to the area() function while the PI on the right was Global. My intent was that within the function, only local constants (PI) and variables (r) were used.

It seems silly now, but at the time I thought I was so clever. :-)

-wes


RE: Plot derivative of a function - CR Haeger - 06-07-2014 02:45 PM

(06-04-2014 06:56 AM)Wes Loewer Wrote:  
(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

Wes - thank you for your guidance and I hope I didnt stir up a bees nest suggesting that dual use of X was mathematically correct.

From my practical user (Engineer) standpoint, I was looking for ways to graphically display how the first derivative or slope of f(x) or F1(X) changed over a range of x values. In the Prime Function App, we are required to use upper case X only to represent "independent x axis" values. If T or other variables could be substituted for the independent variable then I might use it. That is also why I suggested the use of the slope() function.

This also seems to apply to the integral or area() commands where I might want to display how the area changes over a varying (0-->X?) lower/upper limits for f(x).

In CAS, I also have used solve() and fsolve() with derivatives, definate integrals using lower case x for both the independent variable and the variable to solve for. Ive also used other variables ("a" in this case). Both seem to work. Maybe this is also not mathematically correct.

[attachment=772]

In my limited experience with TI36 and TI84 calculators, they also allow for the dual meaning of X in first derivatives and integrals.

Best,
Carl


RE: Plot derivative of a function - HP67 - 06-07-2014 06:32 PM

(06-06-2014 04:07 PM)Tim Wessman Wrote:  There truly is a shift between ltor and rtol numbers in some regions even with the primary language is the same in nearby locations.

Can you list a few? I was not aware of any and I say that as somebody who lives in a country where they write in the wrong direction but still write numbers in the correct direction...


RE: Plot derivative of a function - Manolo Sobrino - 06-08-2014 01:14 AM

(06-06-2014 08:24 AM)cyrille de brébisson Wrote:  Hello

> Math will never be confusing

I beg to differ!

Math is extremly confusing. Past the very basic things (and even then...), most definitions are not agreed upon between mathematicians, and they all play with slightly different, generally unspoken rules depending on their field and even locale.

Examples:
- -6 is a number (a negative number) the square of a number is the number times the number. and yet -6² is -36!

- 3 points at the same location is a triangle... or not, depending on where you are from

- depending on your locale, in right to left writing countries, PI is written 3.14159 or 95141.3 your job to figure out which number is actually ment (PI is easy, but if you read 1.5, you do not know if it is 1.5 or 5.1!)

- 0^0 is undefined or 1 (some other say 0, but they are a minority)

- Matrix + scalar is mathematicaly non-sensical.. even then, I have seen it often, both in math packages and in math texts to say: add scalar to every item in the matrix.

- Modulo is not formally defined (at least not in a consistent manner) for negative numbers.

- Addition is not associative in numerical math!

etc, etc, etc...

These are all mathematic confusion which, when you move from one part of math to another cause confusions, errors and mis-understanding... In our field, where do do touch multiple levels, locals, type of users, we see this all the time...

Cyrille
Un-Obfulscating since 1998

People are confusing, Maths are not (just undecidable sometimes), unless you confuse Maths with the conventions used to write them down. You should always choose a consistent one. And writing that kind of integrals is a bad convention, which besides is formally wrong. Neither Riemann nor Lebesgue would know what to do about such a beast and you're doing Riemann.

Your examples... -6, everybody understands that -6 is -6, and -6^2 is -36 (unless you confuse good old written on blackboards Maths with RPN). If they wanted it to be 36 they'd have written (-6)^2. 3 points at the same location are whatever you want them to be, but mainly they are the same point unless we're not talking about Geometry. You can write left to right or right to left, but if you want to publish your results you will write Pi=3.14159265... 0^0=1 is as convenient as 0!=1 is, but it really doesn't matter. Keeping it indeterminate is possibly even better. Modulo of a negative number, it doesn't matter how you define it as long as you're consistent with it and the rest of remainders. Addition of Real numbers is associative in Numerical Maths, it's not for floating point numbers on finite precision devices, so what? You can do numerical analysis with a stack of paper and a pencil, that's how they made it first.

After having read some of the musings and questions about Maths of calculator designers I just understand calculators so much better... you won't catch a Mathematician saying that Maths are confusing. BTW, would you trust a doctor who says that Medicine is confusing?


RE: Plot derivative of a function - CR Haeger - 06-08-2014 01:40 AM

Yes, I would trust my doctor even more if he admitted that medicine IS confusing - especially when treating confusing people (as you say).

In the meantime, perhaps Mathemeticians can constructivly help both HP and TI developers with implementing proper math conventions.

I think we answered the OP question on how to use the Prime in his Math class Smile


RE: Plot derivative of a function - Manolo Sobrino - 06-08-2014 02:18 AM

(06-08-2014 01:40 AM)CR Haeger Wrote:  In the meantime, perhaps Mathemeticians can constructivly [/i]help both HP and TI developers with implementing proper math conventions.

I guess Mathematicians aren't usually too well off to work pro bono for corporations.

I'm sorry if I was harsh, but that was a really weird statement for me. You know, when someone says that Physics is confusing in itself I can tell that they just have no idea about what they're talking about. You can be confused, puzzled or whatever but that's you, there are thousands (if not millions) of intelligent graduates working on it, are they so dumb that they are not able to define precisely their own field of expertise? Really?

I don't know, I guess I'm getting tired about this kind of stuff.


RE: Plot derivative of a function - parisse - 06-08-2014 01:00 PM

Maths notations are most of the time context-sensitive (e.g. f(x+1) vs y(x+1)). I do not remove points to a student writing int(f(x),x,0,x) if he is at a sufficient level.


RE: Plot derivative of a function - Onkel Otto - 06-08-2014 03:13 PM

Hi :-),

while playing around with the Prime and compairing it with Nspire CX CAS, Classpad 300,
Ti-92 ... and some others, I observed a strange behaviour.

When using options from the "Fcn"-Menue in Plot (e.g. "Signed area.." or "Intersection", Pic1)

[attachment=774]

which take reference to other functions defined, the function name in the referenced function
is renamed from original name (Pic2: F3(X) = dF2/X)/dX=X)

[attachment=775]

to "F1(X)" (Pic3 and Pic4).
[attachment=776]
[attachment=777]

This behaviour is reproduceable and occures with the virtual and with the real Prime.
Once the "F2(X)"-String was replaced by some chinese symbols (not reproduceable).
An other time the real Prime was instantly rebooting when I tried to apply "Tangent"
to function #2 or #3.
The plotted graph allways keeps fine unless you open and save the modified function.

Best greetings
Klaus,
... who likes the Prime more and more :-)


RE: Plot derivative of a function - Manolo Sobrino - 06-08-2014 04:45 PM

(06-08-2014 01:00 PM)parisse Wrote:  Maths notations are most of the time context-sensitive (e.g. f(x+1) vs y(x+1)). I do not remove points to a student writing int(f(x),x,0,x) if he is at a sufficient level.

Yes, they are context dependent, but in an expression same symbols should refer to the same thing as x=x and we all agree on Leibniz's law. You can use for instance an i for the imaginary number and an index, the context makes it clear -they are different things- but that's because we don't use the imaginary unit for indexes because that makes no sense and free standing indexes are rare. It could be argued that this is still a bad notation, and that's why it is becoming frequent to type the imaginary unit with a different font style.

Using x as a single name for two unrelated variables is troublesome. Not for humans that know what's going on, but for computers. A nice custom (that should be compulsory) is to prime the integration variable so that you have g(x)=int(f(x'),x',0,x).. and thank God they came up with that as a notation for the sources of potentials/fields in contrast with the 'unprimed' variables (those of the potentials/fields).

The point here is that the definite integral cannot depend on the integrated variables because you integrate them! What you are doing is using two different variables called x, one refers to all the points whose value you have to add along the path and after the sum they're done, the other specifies the point at which you stop. You know this, students that have passed some Calculus should as well but the computer doesn't and as I pointed out in another thread IMO it can cause trouble with delayed evaluation.


RE: Plot derivative of a function - parisse - 06-08-2014 07:03 PM

Not for that one, because you take the antiderivative then substitute. Problems arise for example with this notation:
f1(x):=diff(f(x),x)
You should use f1:=f' or f1:=unapply(diff(f(x),x),x)


RE: Plot derivative of a function - jte - 06-10-2014 09:19 PM

(06-08-2014 01:00 PM)parisse Wrote:  Maths notations are most of the time context-sensitive…

This discussion reminds me of a math class I attended many years ago. I can't recall the exact subject at the moment (it might have been a measure theory course). The hour-long class consisted of discussing a single proof. It wasn't until the last few minutes of the class that we suddenly realized we were using the same letter for two distinct meanings (using it, in each meaning, perhaps a half-dozen to a dozen times). There was no confusion as to which meaning was intended in each case. We had a good laugh when we realized what had happened. The professor attempted to rewrite the instances still remaining on the blackboards, but didn't have time (and the attempt ended up making what was written more confusing).