points by westurner 4 years ago

> The author opens with the example of finding the antiderivative of xn. When n ≠ -1 the antiderivative is another power function, but when n = -1 it’s a logarithm.

What a neat limit. Probably best to leave the powerfn/logfn() as a dumb symbolic symbol until the end (until after later parameter substitution)?

nh23423fefe 4 years ago

I don't follow. The antiderivative fails because of division by zero. What limit? And what does symbolic manip do?

  • gus_massa 4 years ago

    The idea is that you want to calculate

    integral{from t=0, to t=x} t^{-1+0} dx

    but you calculate instead

    f(x) = lim_{ε->0} [ integral{from t=0, to t=x} t^{-1+ε} dx ]

    that is just

    = lim_{ε->0} [ (t^ε - 1) / ε ]

    replacing t^ε

    = lim_{ε->0} [ (e^(ln(t)*ε) - 1) / ε ]

    by https://en.wikipedia.org/wiki/L%27H%C3%B4pital%27s_rule

    = lim_{ε->0} [ ln(t)*e^(ln(t)*ε) / 1 ]

    that is easy to calculate

    = ln(t)*e^(ln(t)*0) / 1

    = ln(t)*1 / 1

    = ln(t)

    So f(t)=ln(t)

    • _Microft 4 years ago

      Just for the sake of correctness: the differential has to be dt instead of dx here.

      • gus_massa 4 years ago

        I agree, thanks. But I saw your comment just now and it's too late to edit. :(

    • westurner 4 years ago

      So the type of the return value changes at asymptotes/limits (already) and thus that's not a pure function in terms of math. If a [math] function returns a more complex type signature instead of throwing a ZeroDivisionError (as Python core does) what is that then called? Is it differentiable or no, etc?

      We throw ZeroDivisionError instead of axiomatically defining a ranking for

        scalar*parameter*inf
      
        if x > 0:
            2*x*inf > x*inf
            # because
            2 > 1
      

      But basically every CAS just prematurely throws away all terms next to infinity (by replacing the information in that expression with just infinity)? And nothing yet implements e.g. Conway's Surreal numbers infinities?

      Is negative infinity to the infinity greater or lesser than infinity?

        assert (-1*math.inf)**math.inf == math.inf
      
        assert (-1*sympy.oo)**sympy.oo == sympy.oo
      

      Here's a dumb Real/Function instead of prematurely discarding information that could be useful:

        from sympy import symbol
        from sympy.abc import x
      
        Infinity = symbol('Infinity', real=True)  # *
        # 
      
        from sympy.symbols import Wild
      

      All the axioms just change there.

        limit(-x**-1)
      

      An uphill battle for certain.

      "[Python-ideas] Re: 'Infinity' constant in Python" https://mail.python.org/archives/list/python-ideas@python.or...

      • hither_shores 4 years ago

        > So the type of the return value changes at asymptotes/limits (already) and thus that's not a pure function in terms of math.

        Plenty of functions are discontinuous. Almost all of them, in fact. (This isn't true constructively, but GP is clearly doing classical analysis.)

        > If a [math] function returns a more complex type signature instead of throwing a ZeroDivisionError (as Python core does) what is that then called? Is it differentiable or no, etc?

        Depends on the smooth structures you've imposed on the domain and codomain, which requires much more powerful types to represent than are available in any mainstream language I'm aware of. (You might be able to contort Haskell into something sort of close, but it wouldn't be simple.)