Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168749
Image: ubuntu2004
P1=PolynomialRing(ZZ,'x') x=P1.gen() p=-1*x^5+3*x^8-1+6*x^2;p
3*x^8 - x^5 + 6*x^2 - 1
P2=PolynomialRing(RR,'t') t=P2.gen() q=2*t^2+5*t^4-t-4;q
5.00000000000000*t^4 + 2.00000000000000*t^2 - t - 4.00000000000000
p(2)
759
y=matrix(RR,[[1,2],[3,4]]);y
[1.00000000000000 2.00000000000000] [3.00000000000000 4.00000000000000]
p(y)
[ 496225.000000000 723212.000000000] [1.08481800000000e6 1.58104300000000e6]
p.change_ring(QQ)
3*x^8 - x^5 + 6*x^2 - 1
P2=PolynomialRing(QQ,'x') t=P2.gen() q=2*t^2+5*t^4-t-4;q
5*x^4 + 2*x^2 - x - 4
q.change_ring(QQ)
5*x^4 + 2*x^2 - x - 4
p*q
15*x^12 + 6*x^10 - 8*x^9 - 12*x^8 - 2*x^7 + 31*x^6 + 4*x^5 + 7*x^4 - 6*x^3 - 26*x^2 + x + 4
u=p//q;u
0
p%q
-2/25*x^3 + 476/125*x^2 + 32/125*x + 163/125
p.roots() p.complex_roots()
[-0.405551899600305, 0.410122280158637, -0.931044157794464 - 0.617070397270502*I, -0.931044157794464 + 0.617070397270502*I, -0.0409077197884951 - 1.14412829588053*I, -0.0409077197884951 + 1.14412829588053*I, 0.969666687303793 - 0.534135779668537*I, 0.969666687303793 + 0.534135779668537*I]
q1=(x-1)*(x-2)*(x-3)^2*(x-4);q
5*x^4 + 2*x^2 - x - 4
q1.roots()
[(4, 1), (2, 1), (1, 1), (3, 2)]
p.is_irreducible()
True
q2=x^3-9*x^2+20*x-12;q2
x^3 - 9*x^2 + 20*x - 12
gcd(q1,q2)
x^2 - 3*x + 2
lcm(q1,q2)
x^6 - 19*x^5 + 143*x^4 - 545*x^3 + 1104*x^2 - 1116*x + 432
q1.factor()
(x - 4) * (x - 2) * (x - 1) * (x - 3)^2
q2.factor()
(x - 6) * (x - 2) * (x - 1)