Python Forum
Sympy error "object is not callable"
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sympy error "object is not callable"
#1
I am trying to use sympy to solve a second order ODE. When I run the code below, I get the error: 'f' object is not callable. T don't understand what that means. When I delete the initial conditions from dsolve line, the code works. But when I include it, the error appears. Any help will be greatly appreciated. I am a newby to Python.

from sympy import* 
from sympy.solvers import dsolve
import sympy as sp
from pylab import*
import matplotlib.pyplot as plt

x = symbols('x')
f = Function("f")(x)

gamma = 0.01
ode1 = gamma*f.diff(x,2)+4*x
sol1 = dsolve(ode1, f, ics={f(x): 0, sp.diff(f, x).subs(x,0): 1})

print(ode1, sol1)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  error in class: TypeError: 'str' object is not callable akbarza 2 456 Dec-30-2023, 04:35 PM
Last Post: deanhystad
  solve ODE with sympy Sergey_Novak 2 903 Dec-02-2023, 12:33 PM
Last Post: Sergey_Novak
  TypeError: 'NoneType' object is not callable akbarza 4 922 Aug-24-2023, 05:14 PM
Last Post: snippsat
  [NEW CODER] TypeError: Object is not callable iwantyoursec 5 1,262 Aug-23-2023, 06:21 PM
Last Post: deanhystad
  Need help with 'str' object is not callable error. Fare 4 779 Jul-23-2023, 02:25 PM
Last Post: Fare
  TypeError: 'float' object is not callable #1 isdito2001 1 1,046 Jan-21-2023, 12:43 AM
Last Post: Yoriz
  'SSHClient' object is not callable 3lnyn0 1 1,132 Dec-15-2022, 03:40 AM
Last Post: deanhystad
  TypeError: 'float' object is not callable TimofeyKolpakov 3 1,375 Dec-04-2022, 04:58 PM
Last Post: TimofeyKolpakov
  API Post issue "TypeError: 'str' object is not callable" makeeley 2 1,834 Oct-30-2022, 12:53 PM
Last Post: makeeley
  Merge htm files with shutil library (TypeError: 'module' object is not callable) Melcu54 5 1,495 Aug-28-2022, 07:11 AM
Last Post: Melcu54

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020