Sympy to numpy causes the AttributeError: 'Symbol' object has no attribute 'cos'

久未见 提交于 2019-12-01 12:45:58

This type of error occurs when you call np.cos(a_symbol), which apparently translates under-the-hood in numpy to a_symbol.cos().

lambdify is for numeric calculations - it replaces all sp calls with np calls. But what you're doing is symbolic. This is enough for your problem:

f1 = lambda t: y_1.subs({t_1: t})
f2 = lambda t: y_2.subs({t_2: t})
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!