# Using \`HomotopyContinuation.jl\` to find the roots of systems that include sin and cosine functions?

**URL:** <https://discourse.julialang.org/t/using-homotopycontinuation-jl-to-find-the-roots-of-systems-that-include-sin-and-cosine-functions/111799>\
**Category:** General Usage\
**Tags:** question, optimization, sciml\
**Created:** [March 19, 2024, 4:32am UTC](https://discourse.julialang.org/t/using-homotopycontinuation-jl-to-find-the-roots-of-systems-that-include-sin-and-cosine-functions/111799 "2024-03-19T04:32:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![00krishna](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/00krishna/32/8843_2.png) [@00krishna](https://discourse.julialang.org/u/00krishna)\
**Post date:** [March 19, 2024, 4:32am UTC](https://discourse.julialang.org/t/using-homotopycontinuation-jl-to-find-the-roots-of-systems-that-include-sin-and-cosine-functions/111799/1 "2024-03-19T04:32:17Z")

</div>

I am new to Homotopy continuation methods, but I understand the basics. While HC was designed for finding the roots of systems of polynomial equations, I was wondering in the method can be used to find the roots of a system of polynomial equations that includes `sin`, `cosine` or other trigonometric functions? I was looking in the docs for the package, but I did not find any reference to this.

So if I have a system such as a simple inverted pendulum, the equations look like the following system of [x\_1, x\_2]. I set the parameters g=9.8, L = 1.0.

x\_1 = x\_2\\ x\_2 = -\frac{g}{L}sin{x\_1}

The solutions to this system are [0, \pm \pi]. I wanted to see if I could use HC to find the roots of a system like this, but I was not sure of how to code this? Do I need to reparameterize the `sin` function into a polynomial?

Here is some code I was starting with, but it is not working:

```julia
    using HomotopyContinuation
    @var x y;
	x1 = y
	x2 = -9.8*x
	x3 = x^2 + y^2 - 1
	H = System([x1, x2, x3])
	result3 = HomotopyContinuation.solve(H)

```

Any suggestions would be appreciated. Thanks.
