You could solve this out using the cubic formula, but that's specific to cubic functions, and as ever in mathematics what we aim for is generality.
You could use Newton's Method to approximate roots.
Now, you could also use Mathematica and solve for the x values using just the Solve function. But ... that's not very exciting.
What you could also do is this.
Thinking about the function, the zeros could be complex numbers of the form a + b*i, where i is the square root of -1. So, instead of f(x), we'll write out f(a + b*i).
Expanding out, you get
f(a + b*i) = (a + b*i)3 - 2(a + b*i)2 + 5(a + b*i) - 1
f(a + b*i) = (a3 + 2*b2 - 2*a2 - 3*a*b2 + 5*a - 1) + i*(5*b - 4*a*b + 3*a2*b - b3)
Now, it's interesting to look at the real and imaginary parts of f(a + b*i). For convenience, we can just write Re[f(a + b*i)] for the real part, and Im[f(a + b*i)] for the imaginary part. Naturally we get.
f(a + b*i) = Re[f(a + b*i)] + i*Im[f(a + b*i)]
And in this case,
Re[f(a + b*i)] = a3 + 2*b2 - 2*a2 - 3*a*b2 + 5*a - 1
Im[f(a + b*i)] = 5*b - 4*a*b + 3*a2*b - b3
Now, we're looking for f(a + b*i) = 0. When that is true, Re[f(a + b*i)] = 0 and Im[f(a + b*i)] = 0. I think for convenience I'm just going to write z = a + b*i from now on.
So, we're looking for z such that Re[f(z)] = 0 and Im[f(z)] = 0. One way of approaching that is to look at the absolute value of the function.
Abs[f(z)] = ( Re[f(z)]2 + Im[f(z)]2 )1/2
When f(z) = 0, Abs[f(z)] is also 0, and in no place else will that be true. Abs[f(z)] also has the advantage of /always/ returning a real number. We've eliminated all unnecessary imaginary numbers.
Now, this is where it gets kind of wonky.
So, you think to yourself, 'Ok, pretty much at every point around the z we're looking for, the value of f(z) is going to be the same, so we'll plot how similar nearby f(z)'s are. And we'll do this in the following way. For a given z value, chosing a and b, we'll calculate f(z), then Abs[f(z)], which will be a real number. Then we'll find the tenths digit of Abs[f(z)]. If that digit is odd, we'll put a black mark on the z, and if it is even, a white mark. Then there will appear concentric circles around the zeros of f(z) in the complex plane.'
In Mathematica, we can write this like so. 'I' is Mathematicaspeak for i, the square root of -1.
f[z_]:= z3 - 2z2 + 5z - 1
zPoint[z_]:= If[Mod[IntegerPart[FractionalPart[Abs[f[z]]]*10], 2] == 1, z, 0]
vals = Union[Flatten[Table[zPoint[a + b*I], {a, -3.0, 3.0, 0.005}, {b, -3.0, 3.0, 0.005}]]];
pts = Table[{Re[vals[[k]]], Im[vals[[k]]]}, {k, 1, Length[vals]}];
ListPlot[pts, PlotStyle -> AbsolutePointSize[1], AspectRatio -> 1];
This code basically looks at every complex number in the square 3 + 3i, 3 - 3i, -3 + 3i, -3 - 3i, and tests the tenths digit if it's even or odd. The way the 10ths digit is determined is first by dropping everything to the left of the decimal, taking only the decimal part. FractionalPart[value]. Then, multiply it by 10, to move the tenths digit into the units place. Then cut off the remaining decimals using IntegerPart. Then, just calculate the remainder when divided by 2.
And thus we get
Nice, eh?
Now, according to Mathematica, the actual roots should be at z = 0.217, 0.892 + 1.95*i, 0.892 - 1.95*i. To make things clear, here's the same picture with those points circled in red.
Clicking to look at the larger image, it should be clear that concentric rings do in fact appear around the locations of the roots.
The problem of course is that they appear around other points as well.
Strange points. Wonderful points. Sometimes, they hardly seem to be circling a point at all, but just random concentric circles floating in space.
Now, some of these points can be explained. The circles around the roots clearly make sense, as there will be circles of common value around those points as the function goes to 0 there. Importantly, this is because the function approaches 0 approaching those points from every direction. This kind of behavior also explains other points of concentric circles, as the function attains a set value from all directions - you'll still get the rings of equal value, but they won't be circling on where the function is 0, just some other constant.
The other rings ... drive me crazy. It's like there are phantom rings that exist in the interference between the concentric circles, like some kind of wave interference.

Or some kind of illusion based on the way the computer approximates cuves with straight segments. However, the way the 'phantom rings' stretch and distort in the same way the 'actual' rings do makes me think there might be something more to them.
So, while this does indicate the location of the roots ... it's not very handy. But it looks nice.
And it looks nicer the strange the functions get. For example, here is something like f(z) = (z - eCos[z])(z + eSin[z])/( Cos[Re[z]]*Sin[Im[z]] ), a strange function indeed. I think this one looks like a butterfly, myself.
A butterfly ... of death!
And that's the magic : ) If you have any functions you want me to do for you, leave a comment and an email address in some form and I'll send it along. I only have limited space to post pictures here, otherwise I'd definitely show off more.
1 comments:
Great stuff. Thanks for explaining those plots. Once the exams are over and I have more time I'll try implementing your code in Maple or Matlab to play around with it.
Post a Comment