Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
483 views

##Lab 9 SAGE and Higher Degree Polynomial Functions Now we concentrate on finding or approximating zeroes of general polynomials. Besides the quadratic formula for 2nd degree poly's, there is are complicated formulas for cubics and quartics(4th degree). Beyond that, there are no formulas in general. Keep in mind also that some zeros may be complex. In this case, if the coefficents are all real, a complex zero of the form, a+bia+bi will have a conjugate zero equal to abia-bi. You will also see in this lab that SAGE has a mind of its own and even though it will find exact solutions for zeros for at least up to 4th degree polynomials, you might not like what you see!!! Take for example the quartic, 2x47x3+3x28x112x^4-7x^3+3x^2-8x-11. . .

#Asking SAGE to solve the quartic after setting equal to zero: x=var('x') solve(2*x^4-7*x^3+3*x^2-8*x-11==0,x); show(solve(2*x^4-7*x^3+3*x^2-8*x-11==0,x)) #WARNING!!!!!! Don't jump out of your seat when you see these answers!! ︠31eaed27-a439-442b-8ffe-426b6285eef3is︠ %md Obviously, these solutions are unwieldy at best. Decimal approximations would be better. Below I copied and pasted the first long root and added **.n(3)** at the end(3 bits of precision, not decimal places) so that the value of the root makes more sense. I could do this with the other 4 too.

Obviously, these solutions are unwieldy at best. Decimal approximations would be better. Below I copied and pasted the first long root and added .n(3) at the end(3 bits of precision, not decimal places) so that the value of the root makes more sense. I could do this with the other 4 too.

#execute this command for simpler root form. (-1/8*sqrt((16*(1/16*sqrt(498813) - 289/16)^(2/3) + 33*(1/16*sqrt(498813) - 289/16)^(1/3) - 188)/(1/16*sqrt(498813) - 289/16)^(1/3)) - 1/2*sqrt(-(1/16*sqrt(498813) - 289/16)^(1/3) + 47/4/(1/16*sqrt(498813) - 289/16)^(1/3) - 431/8/sqrt((16*(1/16*sqrt(498813) - 289/16)^(2/3) + 33*(1/16*sqrt(498813) - 289/16)^(1/3) - 188)/(1/16*sqrt(498813) - 289/16)^(1/3)) + 33/8) + 7/8).n(3) ︠0bfc3639-d272-463b-bc9f-0d5d9080dc80is︠ %md The more efficient thing to do is immediately graph the polynomial with suitably wide bounds for "x", using -1 and 1 for the "y"-bounds to see approximately what the real(if any) x-intercepts are approximately. Then use the **find_root** command.

The more efficient thing to do is immediately graph the polynomial with suitably wide bounds for "x", using -1 and 1 for the "y"-bounds to see approximately what the real(if any) x-intercepts are approximately. Then use the find_root command.

f(x)=2*x^4-7*x^3+3*x^2-8*x-11#gave the function a name for housekeeping purposes plot(f(x),xmin=-12, xmax=12,ymin=-1, ymax=1)
#from the above graph it appears that the only two real zeroes are between {-1,0} and {3,4} #using the new command twice: find_root(f(x),-1,0);find_root(f(x),3,4)
-0.7400331275323897 3.5223939225028023

We can work with these approximations. Keep in mind that the problems you will encounter in MathLab are usually contrived so that the zeroes turn out nice. SAGE can be a real time-saver in these cases. Take for instance, 103x6+13x5+463x4+73x3116x26x+144\frac{10}{3}x^6+\frac{1}{3}x^5+\frac{46}{3}x^4+\frac{7}{3}x^3-116x^2-6x+144.

︠525b2879-6b5a-4aee-831b-8221ab857bbcs︠ solve(10/3*x^6 + 1/3*x^5 + 46/3*x^4 + 7/3*x^3 - 116*x^2 - 6*x + 144==0,x);show(solve(10/3*x^6 + 1/3*x^5 + 46/3*x^4 + 7/3*x^3 - 116*x^2 - 6*x + 144==0,x))
[x == (-8/5), x == (3/2), x == -sqrt(2), x == sqrt(2), x == (-3*I), x == (3*I)]
[x=(85)\displaystyle x = \left(-\frac{8}{5}\right), x=(32)\displaystyle x = \left(\frac{3}{2}\right), x=2\displaystyle x = -\sqrt{2}, x=2\displaystyle x = \sqrt{2}, x=(3i)\displaystyle x = \left(-3 i\right), x=(3i)\displaystyle x = \left(3 i\right)]

Pretty nice, huh?

  1. Graph first then find approximations for all the real zeroes of the 5th degree polynomial, 2x55x43x3+x82x^5-5x^4-3x^3+x-8.

  2. Graph first then find exact values of ALL zeroes, real or complex, for x612x5+58x4130x3+99x2+34x14x^6-12x^5+58x^4-130x^3+99x^2+34x-14. This one's contrived. Make sure you note that the zeroes come in conjugate pairs!!!

︠45c5c9d1-280b-41c7-811e-b40b97d3bd2b︠ ︠a84f457b-fa3b-4917-b8cd-6fdbae8e9aec︠ ︠816379b2-d66f-4ed8-82d8-1d7d329dc9dc︠ ︠b696be06-eeb5-4d13-bc0e-85573be7e7bf︠ ︠d9f947fc-e233-44c7-9f9f-60473f612561︠ ︠d8dfaba9-2c4f-49ac-a9bf-d1125487dc90︠ ︠e7c8f7ba-4fe5-4e9e-b61b-01b4a41cd22c︠ ︠9153da6a-6b6f-43be-aae6-ddb9dccd310b︠ ︠dddf41aa-d30d-443e-9ca0-935fded21c70︠