Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] - The first few algebraic numbers

Neuro Fuzzy
Years of Service
User Offline
Joined: 11th Jun 2007
Posted: 26th Dec 2011 00:31 Edited at: 26th Dec 2011 00:32
An algebraic number is a number that can be expressed as the root of a polynomial with integer coefficients. For example, 2 and -2 are roots of the polynomial x^2-4, so they are algebraic. The complex constant i is also algebraic, since it is a root of x^2
+1. So the algebraic numbers are a subset of the complex numbers. A number like sqrt(3)/3 is algebraic, while pi or e are not. This program creates a bunch of polynomials (that's what that ugly bunch of for statements is, creating polynomials like "-1+x^2-3x^4"), finds their roots (using newton's method), then returns them and plots them based on the polynomial's degree and the size of its coefficients.

Inspired by this:
I'll also add: it plots about 16,000 points, each of those the result of a root finding operation, so it takes about 30 seconds to calculate it all. The picture I linked to has about 163,000 points, so that's one of the reasons my version looks worse

Login to post a reply

Server time is: 2022-12-01 13:20:24
Your offset time is: 2022-12-01 13:20:24