On Tue, Nov 18, 2014 at 9:28 AM, David Roe <roed.m...@gmail.com> wrote:
> On Tue, Nov 18, 2014 at 8:05 AM, Bill Page <bill.p...@newsynthesis.org> wrote:
>> On 18 November 2014 09:02, David Roe <roed.m...@gmail.com> wrote:
>>> On Tue, Nov 18, 2014 at 5:57 AM, Bill Page <bill.p...@newsynthesis.org> 
>>> wrote:
>>>>
>>>> > I think you are overly focused on trying to define a derivative that
>>>> > reduces to the conventional derivative of non-analytic functions
>>>> > over the reals.
>>>>
>>>> I've just been casually following this conversation, but I think it's
>>>> important that the derivative of abs(x) be sign(x) not 2*sign(x) or
>>>> 1/2*sign(x).
>>>>
>>
>> What makes it important that "the" derivative of abs(x) be sign(x)?
>> An important point here is that there is no one single unique
>> derivative of non-analytic functions like abs, but rather than all of
>> their derivatives can be expressed in terms of just two.  I am
>> seriously interested in reasons for retaining the status quo.
>
> Because derivative is not just used in the context of functions of a
> complex variable (whether they are analytic or not).  Probably more
> than 90% of Sage users don't know any complex analysis (as frequently
> lamented by rtf).  I will certainly acknowledge that people get things
> wrong with regard to sqrt and log by not knowing about branch cuts.
> But when it comes to the definition of derivative, we need to stay
> consistent with the standard definition of lim_{h -> 0} (f(x + h) -
> f(x))/h for functions of a real variable (or functions that many
> people interpret as just functions of a real variable).  Any other
> decision will cause frustration for the vast majority of our users.

Well, I think it doesn't matter if you know complex analysis or not.
The point is rather that there is a real derivative and a complex
derivative. The complex derivative being a generalization of the real
one (http://en.wikipedia.org/wiki/Derivative#Generalizations,
http://en.wikipedia.org/wiki/Generalizations_of_the_derivative#Complex_analysis).
As such, it must reduce to the real derivative as a special case when
all variables are real, otherwise you get inconsistencies.

For example for real numbers, you get:

|x|' = x / |x| = sign(x)

and you can do this numerically. Here is a function that does this for
any angle theta in the complex plane:

def diff(f, z0, theta, eps=1e-8):
    h = eps*exp(I*theta)
    return (f(z0+h)-f(z0)) / h

For real numbers, you need to set theta=0. This then obviously becomes
the standard definition of a real derivative. So any other definition
than |x|' = sign(x) gives wrong answers. No matter if you know complex
analysis or not.

As far as the derivative of abs(x) in the complex plane for any theta,
the above "diff" function is just the directional derivative, i.e.
derivative in the direction theta. Based on my previous email, the
(only) correct analytic answer is, using Python notation:

x.conjugate()/(2*abs(x)) + x/(2*abs(x)) * exp(-2*I*theta)

And you can check numerically using the function "diff" above that
this is indeed the correct answer (just plug in various complex or
real values for "x" and check that "diff" and the above formula gives
the same numerical answer for all theta).

Bill, you wrote "I think rather that one should strive for the most
general solution
consistent with the mathematics.". Well, the above (i.e.
x.conjugate()/(2*abs(x)) + x/(2*abs(x)) * exp(-2*I*theta)) is the most
general solution consistent with mathematics.

Of these options, only theta=0 gives the real derivative as a special
case, that's what the GiNaC proposal does.

Ondrej

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to