# Solve a cubic equation in one variable

**URL:** https://discourse.julialang.org/t/solve-a-cubic-equation-in-one-variable/90559
**Category:** Specific Domains
**Tags:** package
**Created:** [November 20, 2022, 10:41pm UTC](https://discourse.julialang.org/t/solve-a-cubic-equation-in-one-variable/90559 "2022-11-20T22:41:51Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![GottDengDirk](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gottdengdirk/32/43952_2.png) [@GottDengDirk](https://discourse.julialang.org/u/GottDengDirk)
#### Post date: [November 20, 2022, 10:41pm UTC](https://discourse.julialang.org/t/solve-a-cubic-equation-in-one-variable/90559/1 "2022-11-20T22:41:51Z")

</div>

Hi,  
i use PolynomialRoots.jl package.  
the result is  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/4/e/4eafcf916a959089656bc1b63067e8a6b3bce625.png)  
but when i use _Cubic Equation Calculator_, there is a different result:  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/f/b/fbd3ff5ae7ee5f6232d19524e7708a8a485f9f88.png)  
Am I using the roots function wrong and getting different results?

---

<div class="post-metadata">

### Author: ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)
#### Post date: [November 20, 2022, 10:47pm UTC](https://discourse.julialang.org/t/solve-a-cubic-equation-in-one-variable/90559/2 "2022-11-20T22:47:02Z")

</div>

I think the coefficients are in the opposite order. (i.e. `4.7...` is the x^3 term)

---

<div class="post-metadata">

### Author: ![GottDengDirk](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gottdengdirk/32/43952_2.png) [@GottDengDirk](https://discourse.julialang.org/u/GottDengDirk)
#### Post date: [November 20, 2022, 10:51pm UTC](https://discourse.julialang.org/t/solve-a-cubic-equation-in-one-variable/90559/3 "2022-11-20T22:51:49Z")

</div>

yes! you are right.  
But I followed the example in github, and its order is reversed.
