I have never used stack overflow before and am unsure whether asking for help identifying errors is appropriate to ask but I shall ask anyway. I am writing a script to numerically integrate a particular function using trapezoid from the
Scipy library. My code is below:
from scipy.integrate import trapezoid import numpy as np def T(x): return 4*np.sqrt(1/c)*(1/(np.sqrt(1-k**2*(np.sin(x))**2)) x0 = 3 k = np.sin(x0/2) c = 7/4 x = np.linspace(0,np.pi/2,10) Int = trapezoid(T(x), x) print(Int)
I am receiving an error on line 7:
x0 = 3
saying invalid syntax though I cannot work out why. Any help identifying the issue would be greatly appreciated!
Source: Python Questions