On Tue, Nov 18, 2014 at 11:08 AM, Bill Page <bill.p...@newsynthesis.org> wrote:
> On 18 November 2014 12:29, Ondřej Čertík <ondrej.cer...@gmail.com> wrote:
>> On Tue, Nov 18, 2014 at 9:28 AM, David Roe <roed.m...@gmail.com> wrote:
>>> ...
>>> 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.
>
> I agree, but apparently for a different reason.
>
>> 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.
>>
>
> As I said in another email, I think this is highly dependent on one's
> education and experience. Although I admit that it is very common
> (almost ubiquitous) to teach calculus starting from the notion of
> continuity and limits, I my opinion these references on wikipedia are
> especially biased.   To me from the point of view of computer algebra,
> the algebraic properties of derivatives are more important.
>
> For the sake of continuing the argument, from the point of view of
> algebra why should we consider derivatives of complex functions as a
> generalization of the real one rather than the real derivative as a
> defined in terms of something more general?  In particular notice that
> the so called Wirtinger derivatives also make sense in the case of
> quaternion analysis, so should we be expecting to view quaternion
> calculus also as a "generalization' of real derivatives?

I don't know that much about quaternions. Real numbers and real
analysis is essentially a subset of complex analysis. Is that true
that complex analysis is a subset of quaternion analysis? But I think
it's true that quaternion analysis is a generalization of a real
analysis, so I would definitely expect the quaternion derivatives to
match the real ones.

>
> OK, maybe I am pushing this a little too far.  I admit that the
> argument from the point of view of limits and without any reference to
> conjugate is quite convincing.
>
>> ...
>> 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.
>>
>
> Have you had a chance to consider the issue of the chain-rule yet?

Yes. Very straightforward, as I suggested in my last email. Just start with:

D f / D z = df/dz + df/d conjugate(z) * e^{-2*i*theta}

and then consider the chain rule for Wirtinger derivatives
(http://en.wikipedia.org/wiki/Wirtinger_derivatives#Functions_of_one_complex_variable_2),
I am sure that can be proven quite easily. Then you just calculate
directly:

D f(g) / D z = df(g)/dz + df(g)/d conjugate(z) * e^{-2*i*theta} =

= (df/dg * dg/dz + df/d conjugate(g) * d conjugate(g) / dz) + (df/dg *
dg/d conjugate(z) + df/d conjugate(g) * d conjugate(g) / d
conjugate(z)) * e^{-2*i*theta} =

= df/dg * (dg/dz + dg/d conjugate(z) * e^{-2*i*theta}) + df/d
conjugate(g) * (d conjugate(g)/dz + d conjugate(g)/d conjugate(z) *
e^{-2*i*theta}) =

= df/dg Dg/Dz + df/d conjugate(g) D conjugate(g) / Dz

So at the end, the theta dependence got absorbed into Dg/Dz and D
conjugate(g) / Dz, but it assumes that these directional derivatives
are taken with the same angle theta.

You can now use it to do the example from GiNaC:

  cout << abs(log(z)).diff(z) << endl;
  // (before) -> D[0](abs)(log(z))*z^(-1)
  // (now) -> 
1/2*(z^(-1)*conjugate(log(z))+log(z)*conjugate(z)^(-1))*abs(log(z))^(-1)

I.e. f(g) = |g|, g(z) = log(z) and you get:

D |log(z)| / D z = conjugate(g)/(2*|g|) * D log(z) / Dz + g / (2*|g|)
* D conjugate(log(z)) / Dz =

= conjugate(log(z)) / (2*|log(z)|) * 1/z + log(z) / (2*|log(z)|) *
1/conjugate(z) * e^{-2*i*theta})

= 1/(2*|log(z)|) * (conjugate(log(z)) / z + log(z) / conjugate(z) *
e^{-2*i*theta})

So it exactly agrees, except that there is a theta dependence in the
final answer and GiNaC implicitly chose theta=0. Everything in this
example should be straightforward except perhaps:

D conjugate(log(z)) / Dz = d conjugate(log(z)) / dz + d
conjugate(log(z)) / d conjugate(z) * e^{-2*i*theta}

where we first write conjugate(log(z)) = log|z| - I*arg(z) =
log|conjugate(z)| + I*arg(conjugate(z)) = log(conjugate(z)) and then
we can see that the first Wirtinger derivative is zero (no functional
dependence on "z"), and the second one is 1/conjugate(z). So the
answer is:

D conjugate(log(z)) / Dz = 1/conjugate(z) * e^{-2*i*theta}


I hope I didn't make some mistake somewhere, but it looks all
straightforward to me.

Ondrej

>
> Bill.
>
> --
> 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.

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