0

So i'm very new to Python and i'm not used to the syntax yet. This is probably a simple problem but then again, i'm new so I don't know what is the proper way to write this. I'm supposed to integrate f(x)= 6x*(1-x) with intervals [0,1] but I get a syntax error when I write the code. I tried changing the parenthesis but still got the same error. Again, I know this is probably very simple but i'm still trying to get used to Python so help will be very appreciated.

from sympy import Symbol
from sympy import integrate 
x=Symbol('x')
print (integrate((6x)*(1-x))
f=((6x)*(1-x))
print(quad(f,0,1))
aj_23
  • 11

1 Answers1

1

Changing what you currently have to:

from sympy import Symbol
from sympy import integrate 
x = sympy.Symbol('x')
print(sympy.integrate( (6*x)* (1-x) ))
f = ((6*x)*(1-x))
print(sympy.quad(f,0,1))

Fixes your errors. For sympy, you need to write n*y, not ny, and you also had some missing parenthesis.

artemis
  • 6,857
  • 11
  • 46
  • 99