Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168742
Image: ubuntu2004
# general solutions are complex, but with inconsequentially small imaginary parts a = var('a') b = var('b') c = var('c') x = var('x') eqn = (a + x)^2 * (b + 2 * x) == c solve(eqn, x)
[x == -1/72*(-I*sqrt(3) + 1)*(4*a^2 - 4*a*b + b^2)/(1/27*a^3 - 1/18*a^2*b + 1/36*a*b^2 - 1/216*b^3 + 1/36*sqrt((8*a^3 - 12*a^2*b + 6*a*b^2 - b^3 + 27*c)*c)*sqrt(3) + 1/4*c)^(1/3) - 1/2*(I*sqrt(3) + 1)*(1/27*a^3 - 1/18*a^2*b + 1/36*a*b^2 - 1/216*b^3 + 1/36*sqrt((8*a^3 - 12*a^2*b + 6*a*b^2 - b^3 + 27*c)*c)*sqrt(3) + 1/4*c)^(1/3) - 2/3*a - 1/6*b, x == -1/72*(I*sqrt(3) + 1)*(4*a^2 - 4*a*b + b^2)/(1/27*a^3 - 1/18*a^2*b + 1/36*a*b^2 - 1/216*b^3 + 1/36*sqrt((8*a^3 - 12*a^2*b + 6*a*b^2 - b^3 + 27*c)*c)*sqrt(3) + 1/4*c)^(1/3) - 1/2*(-I*sqrt(3) + 1)*(1/27*a^3 - 1/18*a^2*b + 1/36*a*b^2 - 1/216*b^3 + 1/36*sqrt((8*a^3 - 12*a^2*b + 6*a*b^2 - b^3 + 27*c)*c)*sqrt(3) + 1/4*c)^(1/3) - 2/3*a - 1/6*b, x == -2/3*a - 1/6*b + 1/36*(4*a^2 - 4*a*b + b^2)/(1/27*a^3 - 1/18*a^2*b + 1/36*a*b^2 - 1/216*b^3 + 1/36*sqrt((8*a^3 - 12*a^2*b + 6*a*b^2 - b^3 + 27*c)*c)*sqrt(3) + 1/4*c)^(1/3) + (1/27*a^3 - 1/18*a^2*b + 1/36*a*b^2 - 1/216*b^3 + 1/36*sqrt((8*a^3 - 12*a^2*b + 6*a*b^2 - b^3 + 27*c)*c)*sqrt(3) + 1/4*c)^(1/3)]
a = var('a') b = var('b') c = var('c') a = 0;b = 7.2;c = 2.05;f = -1.2;g = .72 a = 0.875;b = 6.163461538461538;c = 2.05;f = -1.610576923076923;g = 0.27053670488165676 # !!!!!!!!!!!!!!!!!!!!! # the problem is that sometimes the positive root is the third form, and sometimes it is not # we need to do find the real part of these two equations: # x1 == f - g*(-I*sqrt(3) + 1)/h^(1/3) - 1/2*(I*sqrt(3) + 1)*h^(1/3) # x2 == f - g*(I*sqrt(3) + 1)/h^(1/3) - 1/2*(-I*sqrt(3) + 1)*h^(1/3) # !!!!!!!!!!!!!!!!!!!!! x = var('x') v = a^3/27 - a^2*b/18 + a*b^2/36 - b^3/216 + c/4 u = -c/432*(8*a^3 - 12*a^2*b + 6*a*b^2 - b^3 + 27*c) h = (v + sqrt(u) * I) # third solution: x3 == f + 2*g/h^(1/3) + h^(1/3) x = f + 2 * g / h^(1/3) + h^(1/3) show(x) vvu = (v*v + u)^(1/6) theta = atan2(sqrt(u),v) costheta = cos(theta/3) xcalc = f + 2 * g * costheta / vvu + vvu * costheta show(xcalc)
\newcommand{\Bold}[1]{\mathbf{#1}}-0.271106271993302 - 5.55111512312578 \times 10^{-17}i
\newcommand{\Bold}[1]{\mathbf{#1}}-0.271106271993302