Tc

From Techniques for computer generated pictures in complex dynamics
Revision as of 15:17, 27 February 2014 by Arnaud Cheritat (Talk | contribs) (Created page with "This is a very useful tool. A tc is a complex number z together with a complex vector dz attached to. The notation dz is probably not the best but it is to mimic physicist no...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This is a very useful tool.

A tc is a complex number z together with a complex vector dz attached to. The notation dz is probably not the best but it is to mimic physicist notation, like \[(z+dz)\times(w+dw)=w\,z+(w\,dz+z\,dw)+\text{neglected}\] or \[\cos(z+dz)=\cos(z)-\sin(z)dz.\]

Operator overloading

C++ allows operator overloading. In other words, you can use instructions like d=c+a*b in your programs, with any kind type of objects for a,b,c,d.

This is why it is much easier to program with complex numbers in C++ than in Java for instance. Compare C++

z=u*z*(z*z+cos(c*z)+d);

with Java

z=mul(u,mul(z,add(mul(z,z),add(cos(mul(c,z)),d))));

or worse, with C

mul(w,c,z);
cos(w,w);
add(w,w,d);
mul(v,z,z);
add(w,w,v);
mul(w,z,w);
mul(z,u,w);

Operations

One defines \[(z,dz) + (w,dw) = (z+w,dz+dw)\] \[(z,dz) \times (w,dw) = (z\,w,w\,dz+z\,dw)\] \[-(z,dz) = (-z,-dz)\] \[1/(z,dz) = (1/z,-dz/zˆ2)\] \[\overline{(z,dz)} = (\overline{z},\overline{dz})\] \[\exp(z,dz)=(\exp(z),\exp(z)dz)\] \[\cos(z,dz)=(\cos(z),-\sin(z)dz)\] \[etc...\]

Tangent space and jets

One can imagine that a tc pair (z,dz) represents a moving point, starting from z and moving at speed dz: $z(t)=z+dz\,t+o(t)$ . In other words it is an element in the tangent space TC of the complex numbers field C. This is why I chose the name tc for the C++ class. It can also be considered as 1-jets (can be generalized to higher degree power series expansions, like $(z,b,c)$ representing $z(t)=z+b\,t+c\,t^2+o(t^2)$).

Derivatives

It computes derivatives for you.

Say you defined Z=(z,1) and computed W=cos(ZZ). Then you get W=(a,b) with a=cos(z*z) and b= the derivative of a w.r.t. z: you did not need to determine that cos(z*z)=-2*z*sin(z*z), the class computed b iteratively for you.

Implementation

Either I will put code here or a link to download code.