# sin(y) results in “can’t convert expression to float” error

Your problem lies in this line:

``````bounds = [abs(round(float(solve(lowerProfile)[0]),5)),
abs(round(float(solve(upperProfile)[0]),5))]
``````

Specifically this part:

``````abs(round(float(solve(upperProfile)[0]),5))
``````

Here the `solve()` function returns complex solutions in a list. See this:

``````[1.5707963267949 - 1.04696791500319*I, 1.5707963267949 + 1.04696791500319*I]
``````

So, when you pick the 0 index it will be a complex result like this one:

``````1.5707963267949 - 1.04696791500319*I
``````

So, you are trying to cast `float()` to this solution which results in error. Instead you can remove the bounds for solutions having complex results by using `try-except` block like this:

``````try:
bounds = [abs(round(float(solve(lowerProfile)[0]),5)),
abs(round(float(solve(upperProfile)[0]),5))]
lowerBound = np.amin(bounds)
upperBound = np.amax(bounds)
except:
print("The solutions are complex. Cant find a result")
``````

Also import like this:

``````from vpython import *
from scipy.optimize import fsolve
import math
import numpy as np
import sympy as sp
from sympy import *
import matplotlib.pyplot as plt
``````