 # 'float' object has no attribute 'subs'

I have been getting floating errors for a while and can not figure out how to get around it.

import math
import sympy

t = sympy.symbols(‘t’)

t_point = [0, 0.45, 1.1, 1.75, 2.25, 2.7]
y_point = [0, 0.23, 0.4, 0.18, 0.07, 0.01]

t = float(3/50)
f1 = (t2)*math.exp(-t2)
f2 = (t4)*math.exp(-t2)
f1y =
f2y =
x =
x.append(t)

while t <50:
ans1 = float(f1.subs(t))
ans2 = float(f2.subs(t))
f1y.append(ans1)
f2y.append(ans2)
t = t + (3/50)
x.append(t)

Hi,

Please see here regarding formatting your post: [How to] Format code in posts - #7 In terms of your code, what are you trying to do with `subs`? Where is it coming from and what do you expect it to do? These are important questions to work out. Even if you are not sure, you should consider sharing a hypothesis and failed attempts so the process is more constructive.

Here’s an example of how `subs` can work

``````>>> from sympy import sin
>>> x = 90
>>> my_expression = sin(x) + 7
>>> my_expression
sin(90) + 7
>>> my_expression.subs(x, 0)
7
``````
1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.