Plot derivative of a function
|
06-07-2014, 01:12 PM
Post: #25
|
|||
|
|||
RE: Plot derivative of a function
(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. 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:
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 |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)