calculus

TypeError for derivative function

TypeError for derivative function Question: I used sympy to find derivative of a function. ( )= −5+√(4− ^2) import sympy def f_derivative(x): x = sympy.Symbol(‘x’) f = x – 5 + (4 – x**2)**0.5 derivative_f = f.diff(x) derivative_f = sympy.lambdify(x, derivative_f) print(derivative_f(1)) f_derivative(1) assert f_derivative(1) – 0.42264973 < 1e-5 However, there is an error when …

Total answers: 2

Difficulties using matplotlib plot method

Difficulties using matplotlib plot method Question: Very recently I have been tasked with ploting a derivative using Python and matplotlib. This is my code: x=np.linspace(-100,100,num=50) funcion=(56*(x**3))-(38.999*(x**2))+(4.196*x-0.15) plt.plot(x, funcion) The resulting plot is this: Plot generated in Python At first sight, the graph looks okay, but is not correct, given that the graph is suposed to …

Total answers: 1

Performing calculations in python using excel values

Performing calculations in python using excel values Question: I’m trying to do some calculations in python using an excel with several rows and using 3 columns. I’m using the columns ‘Band’ and ‘Antenna_Heigh’ and I would like to save these values in the column ‘Colors’. My code looks like this but I have an error …

Total answers: 2

Taylor series for log(x)

Taylor series for log(x) Question: I’m trying to evaluate a Taylor polynomial for the natural logarithm, ln(x), centred at a=1 in Python. I’m using the series given on Wikipedia however when I try a simple calculation like ln(2.7) instead of giving me something close to 1 it gives me a gigantic number. Is there something …

Total answers: 4

Integral of a Polynomial in Python

Integral of a Polynomial in Python Question: How would we write a function in python that returns the definite integral of a polynomial between two points (X_1 and X_2)? The function takes 3 arguments: a list A of polynomial coefficients (i.e. for polynomial f(x)=5x^4−2x+1, this list becomes A=[5,0,0,−2,1]) a real number X_1 a real number …

Total answers: 3