Search code examples
pythonsymbolsdifferential-equations

PYTHON Symbol is not callable


I started to learn Python for differential and difference equations and this is from the SymPy tutorial, but still I get this error: 'Symbol' object is not callable. How can I solve this problem?

t = symbols('t',real=True)

x, y = symbols('x, y', function=True)

eq = (Eq(Derivative(x(t),t), 12*t*x(t) + 8*y(t)), Eq(Derivative(y(t),t), 21*x(t) + 7*t*y(t)))

Solution

  • If I interpret the docs correctly, your example should be defined as follows:

    from sympy import Function
    
    t = symbols('t',real=True)
    
    x = Function('x')(t)
    y = Function('y')(t)
    
    eq = (Eq(Derivative(x,t), 12*t*x + 8*y), 
          Eq(Derivative(y,t), 21*x + 7*t*y))
    

    enter image description here