Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Gradient Of an Unknown Function

  1. Intresting

    2 vote(s)
  2. Good

    0 vote(s)
  3. Useless

    0 vote(s)
  1. Jul 24, 2006 #1
    Hello, The latest research of mine concerning the derivative of a function without using diffrentiation and even without having the knowledge of what the equation of the funtion is, is attached to the post, please send me your comments on this latest document of mine.
    With regards.

    Attached Files:

  2. jcsd
  3. Jul 24, 2006 #2


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    Dearly Missed

    Don't post doc-documents.
    Learn Latex.
  4. Jul 24, 2006 #3


    User Avatar
    Staff Emeritus
    Science Advisor

    First, a lot of people won't open a ".doc" file from someone they don't know for fear of computer viruses- attaching such files is not a good idea. I have pretty good virus security so I took a chance.

    Essentially what Mubashir is doing is taking three (equally spaced in his example),calculating the slope of the two secant lines from the two outside points to the middle point and so the angles they make at the middle point. He is apparrently assuming (his exact words are "I thought it would be quite comfortable") that the angle the tangent line makes with the x-axis must be the average of those two angles.

    In his example, he uses y= x2 with the three points (1, 1), (2, 4), and (3, 9) so that the slopes are (4-1)/(2-1)= 3 and (9- 4)/(4-3)= 5. Among other things, he derives the formula "1/2(180+ (90- tan-1 3)+ tan-15)- 180)", apparently not realizing that that reduces to (1/2)(tan-15- tan-13). He then asserts, without evidence, that dy/dx= tan(tan-15- 1/2(180+ (90- tan-1 3)+ tan-15)- 180)) again apparently not realizing that that reduces to tan((1/2)(tan-15+ tan-13).

    Of course, it is easy to calculate that tan((1/2)(tan-15+ tan-13)= 3.7655644370746374130916533075759 approximately while the correct derivative of y= x2 at x= 2 is 4.

    Mubashir, You could do much better more easily by averaging the two slopes themselves: (5+ 3)/2= 4 is exact (for a quadratic function) since the second derivative is a constant.
  5. Jul 25, 2006 #4

    thankyou for your reply first, there has been a misunderstanding in what I have done, After reading your reply I edited my document to make it more clear, there was no avrage taken but a trignometrical process was taken place (attached to the reply,) & when it comes to the answer not being so acurate, I've done some changes last night where you won't get a .000001 diffrence in your answer compared to the diffrentiated answer which is writen in the attached document & by the way it's not just working for quadratic curves but any type of curve you would imagine...

    The attached document is edited for clarification.

    The ultimate formulla is;

    dy/dx =10^10*tan (½(tan-1((f(x+1)–f(x))/10^10)+tan-1((f(x)–f(x-1))/10^10)))

    I'll be waiting for your response,

    Attached Files:

  6. Jul 25, 2006 #5


    User Avatar
    Staff Emeritus
    Science Advisor

    Adding two numbers and dividing by 2:
    is averaging. What you are doing is averaging the two angles the secants make. As I said before the tangent angle is not, in general, the average of the two secant angles.
    I don't know what the point of the "10^10" is but did you even do the arithmetic? This answer is far worse than what you had before.
  7. Jul 28, 2006 #6
    Sorry for the delay in my response,
    When it comes to taking average as you pointed out, you are wrong, I haven’t taken the average of the two gradients at all, The angle divided by two is due to the main definition of a tangent; Lets imagine that we are talking about extremely nearby points where the three inserted terms belong to three neighboring points, the tangent to the curve at the middle point should be such that the angle between the curve and the tangent is equal for both neighboring points. By taking the definition under consideration I concluded with what you read in the document, so I had to divide the angle by 2 to get equal angles on both sides of the point. Now you may argue about the relative position of the points which is too much, you are right “the smaller the distance between the points, the more accurate the answer is” hence, the answers are not exact but excellent approximations.

    You have written that the answers are not accurate in the formula provided, There is something happening which I don’t understand, (I’m a student of O’levels so I’d be glad if you help me figure out the problem) if we use the formula with small gaps between the terms, it works very accurately & there is just .00000001 difference in the answers compared to differentiation. I mean the formula given below;

    dy/dx = tan ( 0.5 ( tan-1 (( f(x+0.1) – f(x) ) / 0.01) + tan-1 (( f(x) – f(x-0.01) / 0.01)))

    This equation is even applicable for x^20 or higher degree equations… To get rid of inserting these extremely nearby points, I thought to decrease the size of the curve (not the dimensions) by 10^10, in this way 1 unit would turn to 10 billionth of a unit and even the points with huge gaps between each other would become extremely near. So when the calculation was taking place the curve was small enough to get good approximations, and after the evaluation the curve was brought to its original size hence multiplied by 10^10.
    I don’t feel that the technique has a problem but its answers are absolutely the same as differentiation for degree 2 equations but as the degrees increase the answers become larger and larger by about 1 to 3 units for the degrees 3 and 13/15 respectively.

    We know that differentiation is itself not accurate and that we say “delta x” approaches zero which is impossible, and the real answers should be a little bit more than that of differentiation. What’s the problem with the last part of my technique???

    I’ll be really thankful if you help me figure out what’s going on…
  8. Jul 28, 2006 #7
    That's just not true. The concept of a "neighboring point" doesn't make much sense on its own either.

    When you add ANY two things together and divide the result by two you are averaging them. (A+B)/2 is the average of A and B.

    I have no idea what you mean by that. When you differentiate something, you take the limit. It is not an approximation.

    Even if the tangent function behaved linearly under multiplication of its argument, this would still just give you the same result. However, the tangent function does not behave linearly under multiplication of its argument, so doing this just changes your result so that sometimes it will be better and sometimes it will be worse. Try using your expression on, say, [itex]e^x[/itex]. The one with those 10^10 factors will give a worse result. I'd actually be very surprised if it always gave a better result for polynomials too.

    Sometimes your technique will give you a better answer than just averaging the slopes of secants. But not always (and probably not even usually), and in order to get that precision you need to be able to compute tangents and arctangents to high precision as well as finding the slopes of the secants to high precision. Adding and dividing by two is much easier, if you need a quick approximation!

    They aren't absolutely the same. It's still an approximation, you just aren't calculating it to enough places to see the difference. For example, calculating

    [tex]10^{12}\tan{\left[\frac{1}{2}\left[\mbox{arctan}\left(\frac{2.01^2-4}{10^{10}} \right)+ \mbox{arctan}\left(\frac{4-1.99^2}{10^{10}}\right)\right]\right][/tex]

    gives a result of 3.9999999999999999999999999996000000000000000000001 (to 50 places).

    On the other hand, just averaging the slopes of secants (taken over the same range in [itex]x[/itex] on both sides) will always give the exact derivative for any second-order polynomial.

    (and note that in order to do that calculation without a computer, I'd need a table of arctangents of arguments on the order of [itex]10^{-12}[/itex]!!)
    Last edited: Jul 28, 2006
  9. Jul 28, 2006 #8


    User Avatar
    Staff Emeritus
    Science Advisor

    No, that is not at all a defintion of tangent, much less the "main" definition. For one thing, there is no such thing as "neighboring points".

    I can only conclude from this that you have no idea what differentiation is! The derivative of a function is exact. You seem, by saying 'we say "delta x" approaches zero which is impossible", to be denying the whole concept of the limit!

    You have repeatedly asserted that your method "works very accurately" but have not shown any actual calculations. I have and they are not any where near "accurate". For example, your first case gives the derivative at x= 2 to be about 3.76 rather than the correct value of 4. Please show your calculations for the derivative of y= x2 at x= 2.

    All you are really doing is calculating the derivative as [itex]\frac{f(x+h)- f(x-h)}{2h}[/itex] which is a perfectly reasonable approximation. The derivative is lim, as h goes to 0, of that fraction.
    Last edited: Jul 28, 2006
  10. Jul 28, 2006 #9


    User Avatar
    Gold Member

    there's two techniques that are similar in name, but one is exact and one is an approximation.

    differentation is exact, as HoI says, and it is usually denoted by dy/dx

    taking the difference (notation used is usually 'delta y'/'delta x') is an approximation that's accuracy depends on how small your 'difference' (delta x = x2 - x1, delta y = y2 - y1)

    in computational physics, you learn a lot about changing your differentation into a difference. You lose accuracy, but sometimes there is no other way to solve a problem, than by a difference approximation.

    differentation must fist be solved with calculus (and diff eq) before a numerical solution can be applied. Some calc equations are just impossible to solve, but still possible to approximate with.
  11. Jul 28, 2006 #10
    well, something similar to (but not quite the same as, since that's just the same as the previous suggestion of averaging the slopes of secants [or just taking a single secant]) that, with a lot of extra complications! That at least would get you exact answers for quadratic derivatives :tongue2:
    Last edited: Jul 28, 2006
  12. Jul 29, 2006 #11
    Thankyou for your replies,
    the addition of 10^10 would not make the answers much acurate because I had not thought about the relative position of the points, Is there anyway to get rid of inserting nearby points?

    If differentiation is exact then why do we say "delta y/delta is approximatly equal to dy/dx" Why not exact???

    As I have concluded (if correct) the following formulla should be provided by the technique;

    dy/dx= 10^10*tan(.5(tan-1((f(x+.01)-f(x))/10^8)+tan-1((f(x)-f(x-.01))/10^8)))

    And as Halls of Ivy requested the calculation, here it is; (x^2 at x=2):

    10^10*tan(.5(tan-1((2.01^2-4)/10^8)+tan-1((4-1.99^2)/10^8)))= 4

    It works for e^x too as given below: when x=2

    whie differentiation gives 7.389056099
    hence a very little difference is there (not worse)
  13. Jul 29, 2006 #12


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Because delta y/delta x IS an approximation. Delta y/delta x is taking two relatively close points, and finding the slope of the line betwen them

    dy/dx, on the other hand, is doing actual analytic mathematics to determine the exact formula for the slope at a certain point
  14. Jul 29, 2006 #13


    User Avatar
    Staff Emeritus
    Science Advisor

    ?? Isn't it obvious? one, [itex]\frac{\Delta y}{\Delta z}[/itex] is an approximation to the exact derivative,[itex]\frac{dy}{dx}[/itex].

    You must be using a very bad calculator then. The one provided with Windows gives 3.999999999999999999999996, not 4. A good approximation but not the derivative as you have been saying.

    Yes, since you have "repaired" what you had before by using [itex]\Delta x= 0.01[/itex] instead of 1, you have a reasonably good approximation to the derivative (though I don't see that you gain anything by the powers of 10). If, however, you had used the standard "three point approximation", [itex]\frac{f(x+\Delta x)- f(x- \Delta x)}{2\Delta x}, given in any numerical analysis book you would have, for the x-squared problem, [itex]\frac{2.01^2- 1.99^2}{2 (0.01)}= 4, exactly.
    For the exponential problem, [itex]\frac{e^{2.01}- e^{1.99}}{2(0.01)}= 7.389179250 (to the 9 decimal places you give). That is 0.000000001 more accurate than your more complicated calculation.

    If, as I presume, you are just beginning your study of calculus, you are to be congratulated on working your way through that. But, you need to understand that the derivative is the limit of the difference quotient, not just the difference quotient calculated for some small [itex]\Delta x[/itex].
  15. Jul 29, 2006 #14
    Fixing Halls' tex :tongue2: :

    I will add that I'm pretty sure that if you don't include those silly 10^10 factors the angle-averaging actually gives a slightly better result than the usual secant method for [itex]e^x[/itex].
  16. Jul 29, 2006 #15
    Yes you are right hallsofIvy, I have started calculus some months ago, & thankyou for the encouragement :)

    This is completely true that the answers are not abseloutly the same as diffrentiation in all cases, but the advantage of this expresion is such that we don't need to know the equation of the function which is necessary while diffrentiating, Like the cases with projectile motion of a ball or the movement of cosmological objects, etc...

    & about the presence of the 10^10 factor I've tried it on diffrent functions, where I find it more accurate in polynomials when it's present and as you pointed out less acurate for e^x but the diffrences are so small...

    The expresion shows a fact when "x" is either minima or maxima;

    0 = 10^10*tan(.5(tan-1((f(x+.01)-f(x))/10^8)+tan-1((f(x)-f(x-.01))/10^8)))

    -( f(x+0.01) - f(x) ) = ( f(x) - f(x-0.01) )

    which means: f(x+0.01)=f(x-0.01)
    which is a general truth, (& I think a prove to the validity of the technique)

    I would be glad for some guidence in the deffrentiation, It seems like I have a serius misunderstanding about the definition of a point, In the school, Iam told that "point is a zero dimensional circle" which is creating a problem, because if so, then we can just draw a huge varity of tangents to the circle with variying gradients, So what I had to conclude at the end was that "a point doesn't exist but extreamly small line segments" to make the varying tangents get fixed, To avoid this disasterous conclusion, I thought diffrentiation is not 100% accurate & delta "x" can't aproch to zero, In this way points could remain as points but the real answer for the gradient of the curve at the point of interest is slightly more than our answer obtained through diffrentiation.

    So what is a point???

    I'll be thankful if you can provide me a link as a source to solve this confusion...
    Last edited: Jul 29, 2006
  17. Jul 29, 2006 #16
    Check out,
    for information on a point.

    Also, in general you can check,
    for information.

    However you need a decent math background to really use the site. I remember checking it when I first started taking calc I, and it was a little hard to follow. The more comfortable you become with math, the easier it is to deal with concepts that you have no clue about.

    Also, I think you are not understanding how a tangent line is drawn. The line is tangent to a curve AT A POINT. In other words the tangent line crosses a point, but is tangent to the curve NOT tangent to the point itself.
  18. Jul 30, 2006 #17
    This is just not true. Neither is 0 = 10^10*tan(.5(tan-1((f(x+.01)-f(x))/10^8)+tan-1((f(x)-f(x-.01))/10^8)))
    in general for an extrema.

    You are thinking about behaviour in finite intervals in terms of an instantaneous rate of change. You just can't do that, you can always find exceptions because derivatives describe only local behaviour and not behaviour in finite intervals around the point at which the derivative is taken.

    For an extreme counterexample to the statement I quoted, try

    [tex]f(x) = \frac{1}{e^{1000(x-5)}+1} + e^{-(1000(x-5))^2}[/tex]

    at the maximum at [itex]x=5[/itex]. I think you'll find that [itex]f(5.01)-f(4.99)[/itex] is not quite 0 :)
    Last edited: Jul 30, 2006
  19. Jul 30, 2006 #18


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    A point sort of is a circle with zero radius. You could also think of it as a square with side length zero, or a line with length zero (or even a sphere with radius zero). But none of those really get to the idea behind a point. I'm not going to try and give a good definition (I don't have one handy, and will probably just confuse you), but think of a point as a single location in space. So the point at (3,3) is ONLY the single location at (3,3), not the location of (3,3) and an infinitely small surrounding area Let's look at time instead.... a point in time isn't a small interval of time. Similiarly, a point in space isn't an interval

    You aren't trying to be tangent to the point, but tangent to the curve at a specific point. And delta x can approach zero.... obviously you can't calculate the difference quotient with delta x AS zero, but the limit is essentially the same thing. Essentially, by taking a limit, you make the most accurate approximation possible (which happens to be 100% accurate).
  20. Aug 1, 2006 #19
    Thanks for the guidence,
    Data, How many turning points does the equation you have provided contains??? though it was quite intresting!!! By the way, why can't we take dy/dx=0 ????
  21. Aug 1, 2006 #20
    woops, I actually made an error there. I'll post a real counterexample when I get home :tongue2:
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?

Similar Discussions: Gradient Of an Unknown Function
  1. Gradient function? (Replies: 1)