 # OSDev.org

The Place to Start for Operating System Developers
 It is currently Sun Sep 20, 2020 6:15 am

 All times are UTC - 6 hours

 Print view Previous topic | Next topic
Author Message
 Post subject: Cube root of a complex number Posted: Wed Aug 05, 2020 2:16 am Member Joined: Wed Aug 30, 2017 8:24 am
Posts: 619
Hi all,

and now for something completely different. I've been thinking about cubics a lot lately, and tried to work out some cubics by Cardano's method. Not like the computer does, but in a symbolic way. And I keep hitting the snag that if a cubic has three real solutions, then u³, one of the intermediate results, will be a complex number in cartesian form. Now, I want to take its cube root, but I can only get numeric solutions, not symbolic ones, anymore.

I suppose I should explain Cardano's method first. If you have a general cubic equation ax³ + bx² + cx + d = 0, the first thing you do is divide everything by a. Then you have x³ + b'x² + c'x + d = 0. You then perform a substitution x = t - b/3. This results in the equation t³ + pt + q = 0. Which is equivalent to t³ = -pt - q. The genius of Cardano's method is then to substitute t = u + v, so adding two new variables. The left-hand side will then expand to u³ + 3u²v + 3uv² + v³ = (u³ + v³) + 3uv(u + v). But u + v = t, so this means (u³ + v³) + 3uvt = -pt - q. This leads to the equation system:
Code:
I.  u³ + v³ = -q
II. 3uv = -p

After a bit of fiddling this leads to the equation u^6 + qu³ - p³/27 = 0. Which is a quadratic equation in u³. Once I have u³, I can take its cube root to get u. Also the above equation system to get v. Add them together to get t, and then add b/3 to get x. To get the other solutions, multiply u with a cube root of unity and recalculate the other things.

Now, the problem is, even if the actual solutions of the equation are simple, it can be hard to find them this way. In my example, I found that u³ = 10 + i √243. Now, before taking the cube root, I would like to put that into polar form. The radius is simple, and simplifies to 7√7. But the angle is just some arctangent. Probably a transcendental number. Then I take the cube root, which means taking the cube root of the radius, which gives √7, but the angle is just that weird arctangent expression divided by 3. And then I have to calculate the cartesian form again, because I am going to be adding these things together in a bit, and that is where I cannot proceed symbolically.

My program doesn't care, it will just calculate these things numerically, but this leads to numerical error. In my example, it did calculate the roots of 2, 3, and 5 correctly, but gave them each a tiny imaginary component. However, it also calculated that my u and v are numbers that look to me like they are rational if expressed in cartesian form.

I hit upon the idea of drawing a triangle to help me get ahead, but now I have the problem of trisecting an angle in geometry. I'm stuck. And google (or duckduckgo in my case) failed to find the answers I was looking for. Can someone help?

_________________
Life is beautiful. Nobody said easy.

Top Post subject: Re: Cube root of a complex number Posted: Wed Aug 05, 2020 5:41 am Member Joined: Sat Feb 08, 2020 11:11 am
Posts: 100
I did a quick search for Cardano's formula (https://en.wikipedia.org/wiki/Cubic_equ ... 's_formula).
Assuming your coefficients are real, there is guaranteed to be at least one real solution to your cubic equation. In the article, there is a formula for this real solution (There are cube roots involved, but since everything is real, I assume taking the cube root will be simple). From this real root, it is simple to get the other roots. I'm not sure I understand your question completely... Do you just want a technique to get the cube root of a complex number? Or do you want to solve a cubic equation (with real roots)? If it's the latter, I don't think you need to take the cube root of a complex number. I could be wrong though...

P.S: I just read through the article really quicky, and I assume that your coefficients are real (You say that the equation has 3 real roots, so the coefficients are real). I will try to read more about it when I have time

Top Post subject: Re: Cube root of a complex number Posted: Wed Aug 05, 2020 7:22 am Member Joined: Wed Aug 30, 2017 8:24 am
Posts: 619
sunnysideup wrote:
In the article, there is a formula for this real solution (There are cube roots involved, but since everything is real, I assume taking the cube root will be simple).
Well, almost. The cube root is not even the problem, since all real numbers have a cube root. No, the problem is the square root inside of the thing. It is possible (in fact, extremely possible, namely it happens whenever there are three real roots) that the radicand is negative, thereby turning the result of the square root into an imaginary number. In fact, the radicand of the first cube root is my u³.
sunnysideup wrote:
Do you just want a technique to get the cube root of a complex number?
Yes, but the number is given as the solution of a quadratic equation, so it is in Cartesian form. And I want to get a symbolic result, not a numeric one. Numeric is easy, anyone can do that.

As I said, in my example I have u³ = 10 + √243 i. In order to take the cube root, I want to convert this into polar form, but that only gets me u³ = 7√7 exp(i atan(√243 / 10)). The problem is, the cube root will divide the angle by three, and then turning that into Cartesian form again makes me work with the sin(atan(...)/3). And that is not very insightful. I have no way to simplify that. Maybe my geometry is too weak for that.

_________________
Life is beautiful. Nobody said easy.

Top Post subject: Re: Cube root of a complex number Posted: Wed Aug 05, 2020 8:03 am Member Joined: Sat Feb 08, 2020 11:11 am
Posts: 100
I'm not too familiar with the theory of cubic equations, Galois theory, etc... I just wanted to share this with you however:
Quote:
When a cubic equation with real coefficients has three real roots, the formulas expressing these roots in terms of radicals involve complex numbers. Galois theory allows proving that when the three roots are real, and none is rational (casus irreducibilis), one cannot express the roots in terms of real radicals.

https://en.wikipedia.org/wiki/Cubic_equ ... _solutions

Top Post subject: Re: Cube root of a complex number Posted: Wed Aug 05, 2020 9:29 am Member Joined: Wed Aug 30, 2017 8:24 am
Posts: 619
Awesome. So what I'm asking may be impossible. At least in the general case.

I thought about it a bit longer, and managed to refine the question into pure geometry: A right triangle with legs a and b has corner point C at the right angle. The angle between a and the hypotenuse is trisected, and the trisector closest to a meets leg b in point D. What is the length CD in terms of a and b?

Let us first define some more objects. The corner points A and B are opposite of legs a and b, respectively. So, B is the corner at which the angle was trisected. Obviously, since the right angle at C is also a part of it, triangle BDC is also a right triangle. Does that help me at all? Yes it does! The angle DBC is one third of angle ABC. So sin ABC = 3 sin DBC - 4 sin³ DBC = b/√(a² + b²). Gnarglblargl; that is as good as it was before. If I want to solve this for sin DBC, I have to solve a depressed cubic. Which is what I'm currently doing. I'm spinning in circles. Does someone have better geometry skills than me?

_________________
Life is beautiful. Nobody said easy.

Top Post subject: Re: Cube root of a complex number Posted: Wed Aug 05, 2020 10:24 am Member Joined: Sat Feb 08, 2020 11:11 am
Posts: 100
It's not a question about geometry skills anymore XD... To me, it feels like a thing one can/can't do. Kind of like the Second Law of Thermodynamics - It doesn't say much about what you can do, but what you can't. As my professor says, "A person who works for his entire life to build a heat engine more efficient that the Carnot engine is nothing but a fool" XD. No offence of course .

Top Post subject: Re: Cube root of a complex number Posted: Wed Aug 05, 2020 3:44 pm Member Joined: Wed Mar 09, 2011 3:55 am
Posts: 387
I think your difficulty may be related to the fact that it is impossible (in the general case) to trisect an angle with a compass and straightedge construction?

Top Post subject: Re: Cube root of a complex number Posted: Wed Aug 05, 2020 11:03 pm Member Joined: Wed Aug 30, 2017 8:24 am
Posts: 619
Maybe, but then I never limited the construction to compass and straightedge. Just because Pythagoras liked to do that doesn't mean I have to do the same. The whole world of possibilities is open to you. My problem is that it appears that in general, not much can be said about the sine/cosine of an angle that is only known to be some arctangent divided by three. However, trying to take the cube root in Cartesian form is also not a whole lot simpler. In fact, it is not simple at all.

In Cartesian form, the cube root of the complex number c + di can be defined as a + bi. Then the following holds:
Code:
c + di = (a + bi)³ = a³ + 3a²bi + 3ab²i² + b³i³ = a³ + 3a²bi - 3ab² - b³i = (a³ - 3ab²) + (3a²b - b³) i
Therefore:
I.  a³ - 3ab² = c
II. 3a²b - b³ = d

And now I only need to solve this system of equations for a and b. Seems like a fun afternoon. I typed this into maxima to have it solved automatically, and now it is calculating. I is still calculating at this point. If a CAS is taking this long I don't like the chances of a human doing this work. Oh god, now it is eating all my RAM. I thought 8 GB was overkill, but now they are gone! BRB.

_________________
Life is beautiful. Nobody said easy.

Top Post subject: Re: Cube root of a complex number Posted: Wed Aug 05, 2020 11:12 pm Member  Joined: Thu Jun 04, 2009 11:12 pm
Posts: 267
I would need to take some time to dig this further, it is a long time since I did something like this. But your approach of going with polar form seems right to me. BTW it is disputed whether Carden first solved cubic equations, he was the first to publish.

https://www.storyofmathematics.com/16th_tartaglia.html
--Thomas

Top Post subject: Re: Cube root of a complex number Posted: Wed Aug 05, 2020 11:24 pm Member Joined: Wed Aug 30, 2017 8:24 am
Posts: 619
OK, so maxima did not like this system of equations, and in the end failed to solve it. Therefore I don't think I will find any happiness this way, either. If the CAS runs out of memory, what would happen to the human?

So, that's it? You can't symbolically take the cube root of a complex number? Bummer.That means you can never show a solution to be actually real if numeric error creeps in. I am beginning to understand why that method isn't taught in school: Even "simple" equations with only natural roots are a pain to work with.
Thomas wrote:
BTW it is disputed whether Carden first solved cubic equations, he was the first to publish.
Yeah, publish or perish. As I know the story, Scipione del Ferro might have been the first to discover the method, but he kept it a secret because this way his job was secured. Niccolo Tartaglia discovered the method concurrently or shortly thereafter, independently, and also kept it secret. By a ruse, Cardano managed to get Tartaglia to tell him the secret, but was sworn to secrecy himself. But then, del Ferro died and Cardano was tasked with administrating his estate (it's a small Italy, I guess). Cardano discovered that del Ferro had known the method as well, and independently of Tartaglia. So now Cardano felt free to publish how to do it by del Ferro's method, since he had only sworn not to publish Tartaglia's method. Tartaglia himself was enraged by the publication and tried to publish his own book, telling the story from his point of view, but it was too late, and the formulas would go down in history as Cardano's formulas.

Luckily none of those bollocks happen anymore. These days we just sue each other into oblivion, much more civilized.

_________________
Life is beautiful. Nobody said easy.

Top Post subject: Re: Cube root of a complex number Posted: Tue Aug 11, 2020 7:25 am Member Joined: Wed Mar 09, 2011 3:55 am
Posts: 387
nullplan wrote:
Maybe, but then I never limited the construction to compass and straightedge. Just because Pythagoras liked to do that doesn't mean I have to do the same.

Not explicitly, but the point is that compass and straightedge constructions limit you to a certain set of operations, and depending on what you mean by "symbolically" taking the cube root of a complex number, I have a sneaking suspicion that you're limiting yourself to precisely that set of operations, in which case you won't be able to solve anything that can't be solved with compass and straighedge.

From Wikipedia:

Quote:
Given a set of points in the Euclidean plane, selecting any one of them to be called 0 and another to be called 1, together with an arbitrary choice of orientation allows us to consider the points as a set of complex numbers.

Given any such interpretation of a set of points as complex numbers, the points constructible using valid straightedge and compass constructions alone are precisely the elements of the smallest field containing the original set of points and closed under the complex conjugate and square root operations (to avoid ambiguity, we can specify the square root with complex argument less than π). The elements of this field are precisely those that may be expressed as a formula in the original points using only the operations of addition, subtraction, multiplication, division, complex conjugate, and square root, which is easily seen to be a countable dense subset of the plane. Each of these six operations corresponding to a simple straightedge and compass construction. From such a formula it is straightforward to produce a construction of the corresponding point by combining the constructions for each of the arithmetic operations. More efficient constructions of a particular set of points correspond to shortcuts in such calculations.

Top Post subject: Re: Cube root of a complex number Posted: Tue Aug 11, 2020 8:23 am Member Joined: Wed Aug 30, 2017 8:24 am
Posts: 619
linguofreak wrote:
Not explicitly, but the point is that compass and straightedge constructions limit you to a certain set of operations, and depending on what you mean by "symbolically" taking the cube root of a complex number, I have a sneaking suspicion that you're limiting yourself to precisely that set of operations, in which case you won't be able to solve anything that can't be solved with compass and straighedge.
I mean, I want a solution consisting of mathematical symbols that actually equals what I am looking for. And no, I don't limit myself to the four basic operations and the square root, you can give me a cube root as well. Or rather: You can give me any polynomial expression.

In my example, I have u³ = 10 + √243 i, and I am looking for u. I know that u is about 2.5 + 0.866024. I can take a reasonable guess that that first number is actually 5/2, but what is that imaginary part? A root of something? A cube root expression? I don't know!

_________________
Life is beautiful. Nobody said easy.

Top Post subject: Re: Cube root of a complex number Posted: Tue Aug 11, 2020 1:39 pm Member Joined: Sun Nov 23, 2008 5:56 am
Posts: 31
Location: Russia, Saint-Petersburg
Consider a quadratic equation x^2 + ax + b = 0 with roots p and q. Then the quadratic equation with roots p^3 and q^3 will be x^2 + (a^3 - 3ab)x + b^3 = 0.

Take our complex number and its complement: 10 + i sqrt(243) and 10 - i sqrt(243). These are the roots of x^2 - 20x + 343 = 0. So, b^3 = 343, thus, b = 7, and a^3 - 3ab = -20, a^3 - 21a + 20 = 0, this has rational roots that can be found by probing. Take any root, for instance, a = -5. Then we have equation x^2 - 5x + 7 = 0, whence x = 5/2 +- i sqrt(3)/2. This is a cube root of 10 +- i sqrt(243). Other values of a give remaining roots.

Top Post subject: Re: Cube root of a complex number Posted: Wed Aug 12, 2020 10:14 am Member Joined: Wed Aug 30, 2017 8:24 am
Posts: 619
Thanks, that helps a lot. That is an approach I had not considered. Of course, it means that in order to solve a cubic, I first have to solve a cubic, but still, this transformation might come in handy. In fact, if I'm not mistaken then in the quadratic equation for u³, the constant part is always a cube of a rational number (provided you start with rational coefficients), so the equation for a will always have rational coefficients.

_________________
Life is beautiful. Nobody said easy.

Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending

 All times are UTC - 6 hours

#### Who is online

Users browsing this forum: No registered users and 4 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ Operating System Development    OS Development    OS Design & Theory    Announcements, Test Requests, & Job openings Everything Else    General Programming    General Ramblings    Auto-Delete Forum OSDev.org    OSDev Wiki    About this site