Calculator that can factor and find exact roots of polynomials
Hello folks,
I have uploaded to [url]https://www.alpertron.com.ar/POLFACT.HTM[/url] a calculator that can factor polynomials over the integers or modulo a power of a prime. It also can find exact roots of polynomials expressed with radical expressions. At this moment the roots are shown only if the degree of the irreducible factor of the input polynomial is <= 5. It also indicates when the quintic equation cannot be expressed as radical expressions. Please let me know if there is any error. 
I opened a new tab in my FF session, went to your page, enabled JS in NoScript, and, with a view toward polyfactoring x^41 as a little test, entered 41 and clicked 'factor'. I notice that whether I click 'evaluate' or 'factor', both those buttons go gray together, and "Factoring polynomial..." appears. Waited a full minute before killing it ... no result.

I started Firefox 70.0.1 on Windows 10, entered .41 so it showed x^41 in the polynomial box, then I pressed the Factor button. The output with Pretty Print disabled is:
[CODE] x^4 − 1 Irreducible polynomial factors: x − 1 x + 1 x^2 + 1 Roots: x1 = 1 x2 = 1 x3 =  1 *i x4 = 1 *i Time elapsed: 0d 0h 0m 0.0s [/CODE] I do not have that NoScript plugin. 
[QUOTE=alpertron;530400]I started Firefox 70.0.1 on Windows 10, entered .41 so it showed x^41 in the polynomial box, then I pressed the Factor button. The output with Pretty Print disabled is:
[CODE] x^4 − 1 Irreducible polynomial factors: x − 1 x + 1 x^2 + 1 Roots: x1 = 1 x2 = 1 x3 =  1 *i x4 = 1 *i Time elapsed: 0d 0h 0m 0.0s [/CODE] I do not have that NoScript plugin.[/QUOTE] Part of it is that missing leading . in my input  suggest you add some kind of basic userinput parsing which indicates unrecognized input format, and only activates the buttons when the input is 'legal'. I retried with .41, it indeed autofilled x^41 in the entry field, but clicking 'factor' still gives same as before, both 'evaluate' and 'factor' widgets go gray, and things hang until I click 'stop'. This is FF on Mac  I suspect you have some Windowsonly stuff going on in your JS. Do you have ready access to a nonWin machine? 
[QUOTE=ewmayer;530403]Part of it is that missing leading . in my input  suggest you add some kind of basic userinput parsing which indicates unrecognized input format, and only activates the buttons when the input is 'legal'. I retried with .41, it indeed autofilled x^41 in the entry field, but clicking 'factor' still gives same as before, both 'evaluate' and 'factor' widgets go gray, and things hang until I click 'stop'. This is FF on Mac  I suspect you have some Windowsonly stuff going on in your JS. Do you have ready access to a nonWin machine?[/QUOTE]
The problem is that 41 is legal, because the parser converts that to 3. You can enter any polynomial expression, as explained in the help that you can read by expanding the "accordions". The trick using the dot (coefficient dot exponent) is optional and it makes a lot faster to enter the polynomials especially in mobile devices. With respect to the second part, my code does not know what operating system is running. It uses Javascript and WebAssembly. Maybe you have not enabled WebAssembly in your plugin. 
I installed the NoScript extension to Firefox on Windows 10, and the Javascript was disabled when I loaded the calculator. After selecting "Temp TRUSTED" for my Web site, it worked OK and I could see the responses from the application.

I tried the minimum polynomial for [tex]2\cos(\frac{2\pi}{11})[/tex],
x^5 + x^4  4*x^3  3*x^2 + 3*x+ 1 and the answer was a bit hard to read. I'm not sure whether it was right. 
[QUOTE=alpertron;530448]I installed the NoScript extension to Firefox on Windows 10, and the Javascript was disabled when I loaded the calculator. After selecting "Temp TRUSTED" for my Web site, it worked OK and I could see the responses from the application.[/QUOTE]
Exactly what I did using both FF and PaleMoon on my Mac. My next thought was that perhaps the versions of those browsers I'm running on that older legacy system (which has OS X frozen at 10.6.8 because my codebuild flow is set up for that, and upgrading would break stuff) can't handle something in your JS, but retrying under Ubuntu 19 running on my Intel NUC, which is 45 years old gives the same failure. Oh, well. 
[QUOTE=Dr Sardonicus;530489]I tried the minimum polynomial for [tex]2\cos(\frac{2\pi}{11})[/tex],
x^5 + x^4  4*x^3  3*x^2 + 3*x+ 1 and the answer was a bit hard to read. I'm not sure whether it was right.[/QUOTE] The answer shown by the application is wrong. I unchecked Pretty Print, copied the output to Notepad++, deleted all (xxx digits) and spaces, replaced i by I and finally copied that to gp. All five roots shown are nonreal, so something is not good. Another error is that the digits in group is not working. The program always shows groups of 6 digits. I will work on that. 
[QUOTE=ewmayer;530508]Exactly what I did using both FF and PaleMoon on my Mac. My next thought was that perhaps the versions of those browsers I'm running on that older legacy system (which has OS X frozen at 10.6.8 because my codebuild flow is set up for that, and upgrading would break stuff) can't handle something in your JS, but retrying under Ubuntu 19 running on my Intel NUC, which is 45 years old gives the same failure. Oh, well.[/QUOTE]
Those old browsers do not support WebAssembly. This was added on Firefox version 52, dated March 7, 2017. 
[QUOTE=alpertron;530510]The answer shown by the application is wrong. I unchecked Pretty Print, copied the output to Notepad++, deleted all (xxx digits) and spaces, replaced i by I and finally copied that to gp. All five roots shown are nonreal, so something is not good.
Another error is that the digits in group is not working. The program always shows groups of 6 digits. I will work on that.[/QUOTE]I think that [tex]2\cos(\frac{2\pi}{11})[/tex] and its conjugates are about as good as it gets for expressing the roots of this polynomial. There is no expression in terms of "real radicals." It is somewhat similar to the minimum polynomial x^3  3*x  1 for [tex]2\cos(\frac{\pi}{3})[/tex], which the calculator expresses in terms of cosines. Obviously, it "knows" the trigonometric solution for the [i]casus irreducibilis[/i] of the cubic. 
All times are UTC. The time now is 04:02. 
Powered by vBulletin® Version 3.8.11
Copyright ©2000  2021, Jelsoft Enterprises Ltd.