'I keep getting the TypeError: unsupported operand type(s) for ** or pow(): 'list' and 'int even though there are no lists or integers
I've looked at numerous answers now but none apply to my issue which is that in my code I've made sure that none of the values are integers and that both the terms are arrays and not lists.
term = R1**2-Rsun**2*np.sin(lrad1)**2
lrad_new=([])
R_new=([])
for lrad_el,R_el,term_el in zip(lrad1,R1,term):
for i in range (0,178):
if term_el >= 0:
lrad_new.append(lrad1[i])
R_new.append(R1[i])
np.asarray(R_new)
With this part I get no errors, however as soon as I place it in the next equation I get the TrackError:
term_new = R_new**2-Rsun**2*np.sin(lrad_new)**2
d = ((Rsun*np.cos(lrad_new))+np.sqrt(term_new))
The error I get is from the R_new, which is an array and contains no integers or negative numbers
Edit: I managed to fix the issue by making the new code: R_new = np.asarray(R_new) however I now get invalid values in my square root, but I though the element section of my code removed that issue.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
