Python Forum

Full Version: TypeError: _linspace_dispatcher() missing 1 required positional argument: 'stop'
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm triying to make a double reimann sum, with a limit b = (x^2 + y^2 = 16), the problem is when I use Sympy and marks as a TypeError in the linespace column, I tried to def the ecuation but nothing works, I'm doing somethin wrong or should I change something?
import numpy as np
import matplotlib.pyplot as plt
import sympy

#  function to integrate = x +3*y + 1
# Limit funtion 'b' =(x^2 + y^2 = 16)
Width=15; Length=20;

x = sympy.Symbol('x')
a = 0
b =(sympy.sqrt(16-x**2))
c = 0
d = 3
#Heigth of x
deltax= (b - a) / Width
#Heigth of y
deltay = (d - c) / Length


#Area of each square
dA = deltax * deltay


x = np.linspace((a, b - deltax, Ancho));
y = np.linspace((c, d - deltay, Largo));


f = lambda x,y: x +3*y + 1

[X, Y] = np.meshgrid(x, y);
#reimann sum
Suma=sum(dA * f(X, Y))
Suma = sum(Suma)

int(Suma)

print(Suma)

Error:
File "<__array_function__ internals>", line 4, in linspace TypeError: _linspace_dispatcher() missing 1 required positional argument: 'stop'
Ancho, Largo Not defined
Sorry it was a typo error, but my code stills send the same error Ancho = Width and Largo = Length **
linspace syntax:
numpy.linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None, axis=0)

why double parenthesis, whole command?
unlikely a cuase, but add parenthesis around b - deltax and d - deltay
also, just before command, print out values of b - deltax and d - deltay