Ask Your Question

Flavius's profile - activity

2023-05-03 11:56:13 +0200 received badge  Notable Question (source)
2015-02-22 06:30:40 +0200 received badge  Popular Question (source)
2013-03-30 16:08:16 +0200 received badge  Student (source)
2012-09-15 09:45:50 +0200 received badge  Scholar (source)
2012-09-15 09:45:50 +0200 marked best answer Generating functions and plotting them with different colors
a=1.
b=0.2 
f(c,d)= a / (1 + b*e^(-(x-c)/d))  
sum([plot(f(c,d),[x,0,5],color=hue((c+10*d)/3)) for c in srange(0.2,1.3,.2) for d in srange(0.2,1.3,.2)]).show()

#It seems that 36 curves is too many but I hope it can help to experiment

Or using the suggestion by kcrisman

a=1.
b=0.2 
f(c,d)=a/(1+b*e^(-(x-c)/d)) 
curves=[f(c,d) for c in srange(0.2,1.3,.2) for d in srange(0.2,1.3,.2)]
l=len(curves)
colors=rainbow(l)                                            
sum(plot(curves[k],[x,0,5],color=colors[k]) for k in range(l)).show()
2012-09-15 09:45:49 +0200 received badge  Supporter (source)
2012-09-15 08:02:15 +0200 received badge  Editor (source)
2012-09-15 07:58:01 +0200 asked a question Generating functions and plotting them with different colors

Let's say I have the logistic function

f(x) = a / (1 + b*e^(-(x-c)/d))

For a, the value will likely not change, it stays fixed at 1. b will remain in the meanwhile at 0.2, but I would like to plot all other variants of the function for x in the interval 0, 21 for different values of c and d in different colors (like color lerp).

Like, for all combinations of c,d in [0.2,0.4,0.6,0.8,1.0,1.2]

How to achieve this in sage 5.2 and python? I've tried simply using a python function that returns a "sage function" but it doesn't work.