# A question about derivatives (cubics)

Given an equation:

f(z) = a (x + I y)^3 + b (x + I y)^2 + c (x + i y) + d


Which can be re-written as:

real f(z) ax^3 - 3axy^2 + bx^2 - by^2 + cx + d
imag f(z) 3ax^2y - ay^3 + 2bxy + cy


Am I correct in deriving them this way?

Mathematica: D[a x^3 + 3 a x y^2 + b x^2 + c x + d, x] // TraditionalForm
real f'(z) 3ax^2 + 3ay^2 + 2bx + c
Mathematica: D[3 a x^2 y - a y^3 + 2 b x y + c y, y] // TraditionalForm
imag f'(z) 3 a x^2-3 a y^2+2 b x+c


Some background. While I have dabbled in what I consider the interesting bits of mathematics all my life I am at best an amateur (hopefully in the British sense) at best. It has been a very long time since I took Calculus and that was single variable Calc at that. My current investigation is into just where I made errors in what should have been a simple implementation of Newton's method involving Cubic functions. This in aid of creating the resultant fractal plot. This was in the early 80's when my software and FracInt were pretty much the only ball games in town. Here is the code as written for Ultra-Fractal:

zold = #z
iz = imag(#z)
rz = real(#z)
zr2 = sqr(rz)
zi2 = sqr(iz)
t0 = (rz - iz) * (rz + iz)
t1 = (3.0 * A * t0) + (2.0 * B * rz) + @C
t2 = 2.0 * iz * (3.0 * A * rz + B)
t3 = A * rz * (zr2 - 3.0 * zi2) + (B * t0 + @C * rz) + @D
t4 = rz * (3.0 * A * rz - 2.0 * B) - (A * zi2) + @C
t5 = sqr(t1) + sqr(t2)
zr = (((rz * t5) - (t1 * t3) - (iz * t2 * t4)) / t5)
zi = (((iz * t5) + (t2 * t3) - (iz * t1 * t4)) / t5)
#z = zr + flip(zi)


I am attempting to compare what I should have done with what I did so as to better understand what I'm doing! The formula produces Newton images unlike any others so I do not seek to correct the errors, just comprehend them. BTW, the lack of expression in terms of complex types is based on the lack of a complex type when this was written in the early 80's---complex.h was typically a roll your own affair but even at that, it was the norm to break things up in terms of real and imag and process accordingly.

• Just as a side note: a wonderful book to learn more about functions of complex numbers is 'Visual Complex Analysis' by Tristam Needham. Gained a lot of insight from this book. – Thies Heidecke Jul 30 '13 at 22:19
• @ThiesHeidecke I've been working with Complex Analysis with Mathematica which has been helpful. I'll take a look at Needham---always nice to expand my bookshelf! – hsmyers Jul 30 '13 at 23:33
• +1 for Thies and 'Visual Complex Analysis' by Needham – Sektor Jul 31 '13 at 9:28

One way to handle the situation here is to use ComplexExpand

To obtain the Re part of the expression we use

 ComplexExpand[Re[a (x + I y)^3 + b (x + I y)^2 + c (x + I y) + d]]

d + c x + b x^2 + a x^3 - b y^2 - 3 a x y^2


and the Im part

ComplexExpand[Im[a (x + I y)^3 + b (x + I y)^2 + c (x + I y) + d]]


c y + 2 b x y + 3 a x^2 y - a y^3

I don't know why you are trying compute the differentials in the first place, but that's a built-in functionality. Plus, as a general rule of thumb do use lower case letters, because there are upper case letters that are part of Mathematica's built-in functionality (keywords) and collisions occur.

• Hadn't know the upper/lower case convention. Do now. That noted that was not the part that I'm having problems with :) – hsmyers Jul 30 '13 at 21:27
• Regarding the need for differentials, a generalization of a Newton fractal is Zn+1 = Zn - a p(Zn)/p'(Zn) hence the need. I suppose my question was I correct in selecting for x in the first instance and for y in the second? – hsmyers Aug 1 '13 at 4:43
• @hsmyers I am sorry I took 3 days off and I'm away from my workstation/laptops. I will help you further when I get back home. – Sektor Aug 1 '13 at 9:58