# Code to calculate characteristic polynomial?

**URL:** <https://discourse.julialang.org/t/code-to-calculate-characteristic-polynomial/19903>\
**Category:** General Usage\
**Created:** [January 22, 2019, 12:19am UTC](https://discourse.julialang.org/t/code-to-calculate-characteristic-polynomial/19903 "2019-01-22T00:19:05Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![JeffFessler](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jefffessler/32/6650_2.png) [@JeffFessler](https://discourse.julialang.org/u/JeffFessler)\
**Post date:** [November 23, 2020, 3:27pm UTC](https://discourse.julialang.org/t/code-to-calculate-characteristic-polynomial/19903/6 "2020-11-23T15:27:43Z")

</div>

Cool! Seems like something like this 1-line addition to the package would be useful?

```julia
AbstractAlgebra.charpoly(A::Matrix) = charpoly(ZZ["x"][1], matrix(ZZ,A))

```

Then `charpoly(A)` would work “as expected” out of the box 🙂  
(I realize that one might want a different letter than `x`…)

---

_[View the full topic](https://discourse.julialang.org/t/code-to-calculate-characteristic-polynomial/19903)._
