I am trying to solve for the variable B in that long expression. It is giving me an error that it cannot convert to float. I am not really sure what that exactly means and what I need to do in order to fix that and get a value for B. I am very new to Python so any help would be appreciated.
Code:
import matplotlib.pyplot as plt
import numpy as np
import math
from sympy.solvers import solve
from sympy import Symbol
W = 1*(10**(-4))
mu = 300
Cox = 6.906*(10**-6)
Leff = 1*(10**(-4))
Vg1 = 0.5
Vg2 = 1.0
Vg3 = 1.5
Vg4 = 2.0
Vth = 0.0259
tsi = 5 * (10 ** -7)
Vg = [0.5, 1, 1.5, 2]
Esi = 11.7
tox = 1.5 * (10 ** -7)
tsi = 5 * (10 ** -7)
ni = 1.5 * (10 ** 10)
q = 1.602 * (10 ** -19)
B = Symbol('B')
solve((Vg1/2*Vth) - math.log((2/tsi)*(np.sqrt((2*Esi*Vth)/(ni * q)))) -
math.log(B) + math.log(np.cos(B)) - 2*11.7*(tox)/(3.9 * tsi), B)
Error:
TypeError Traceback (most recent call last)
<ipython-input-3-003cda8dedbd> in <module>()
18 B = Symbol('B')
19
---> 20 solve((Vg1/2*Vth) - math.log((2/tsi)*(math.sqrt((2*Esi*Vth)/(ni *
q)))) - math.log(B) + math.log(math.cos(B)) - 2*11.7*(tox)/(3.9 * tsi), B)
~\Anaconda3\lib\site-packages\sympy\core\expr.py in __float__(self)
237 if result.is_number and result.as_real_imag()[1]:
238 raise TypeError("can't convert complex to float")
--> 239 raise TypeError("can't convert expression to float")
240
241 def __complex__(self):
TypeError: can't convert expression to float