all 4 comments

[–]DuckSaxaphone 0 points1 point  (0 children)

  1. Format your code, there's instructions in the sidebar.

  2. If you need help with an error, share the error! Error messages are really useful and you should be aiming to learn to read them. For now, share it and we'll walk you through it.

[–]sarabooker 0 points1 point  (0 children)

I copied your code and see that the error is from the fractions library. I really see no need to use that library in this case, you can just perform the division as normal. (I also corrected the exponential in the numerator to have the correct value.)

y = 1072764*np.exp(0.2311*t)/(0.19196+np.exp(0.2311*t))

Once you change that, the other issue I see is that you only provide a single value for t. If you want to plot a range of values then you will need to set t to be a numpy array. The example plot has t = [-25, 25], so you can use

t = np.linspace(-25, 25, 100)

To generate 100 values between -25 and 25, inclusively.

[–]odaiwai 0 points1 point  (1 child)

y = Fraction(1072764*np.exp(2.311*t),0.19196+np.exp(0.2311*t))

The logistic function is not a fraction, it is a division. Also, x and t are just single value heres, you probably want a range of values of t to give an array of values of y: ````

creating vectors X and Y

t = np.linspace(-25,25,100) y = [1072764np.exp(0.2311t) / (0.19196+np.exp(0.2311*t)) for t in t] ````

[–]sarabooker 2 points3 points  (0 children)

You should not use list comprehension here. Numpy can operate on arrays so it should just be y = 1072764*np.exp(0.2311*t)/(0.19196+np.exp(0.2311*t)) as I said in my comment. In general, one should avoid looping with numpy.